Repository aliases¶
Generic directory names repeat across workspace roots. A workspace under
~/work/libtmux/ and a workspace under ~/study/python/ can both contain a
repository entry named docs. Running vcspull sync docs
selects both entries, and vcspull status prints two docs
rows with nothing in the name to tell them apart.
An alias gives a repository entry one extra handle on the command line while
leaving its checkout directory, its name, and its merge identity across
configuration scopes untouched. If every repository
entry in your configuration already has a distinct name,
you can stop reading; everything here is optional.
~/work/libtmux/:
libtmux:
repo: git+https://github.com/tmux-python/libtmux.git
libtmux-haskell:
repo: git+https://github.com/tmux-python/libtmux-haskell.git
docs:
repo: git+https://github.com/tmux-python/libtmux-docs.git
alias: libtmux-docs
assets:
repo: git+https://github.com/tmux-python/libtmux-assets.git
alias: libtmux-assets
~/study/python/:
docs:
repo: git+https://github.com/python/cpython-docs.git
With alias: libtmux-docs on the docs entry under ~/work/libtmux/, you can
address ~/work/libtmux/docs as libtmux-docs without matching
~/study/python/docs, group the whole libtmux family under 'libtmux*',
and keep docs matching both entries as before.
alias: differs from name: and path::
name:renames the repository entry and (unlesspath:is also set) its checkout directory; the old key stops matchingfnmatchhandles insync, list,status, and worktree (anchor regexes such as'name:^docs$'in vcspull search).path:overrides the entry’s destination path verbatim without~or$HOMEexpansion, so pairingname:withpath:requires a machine-specific absolute path, and unscopedvcspull searchstill matchespathandurl.alias:adds a second command-line handle and leaves the directory andnameunchanged.
The sections below use three terms: a handle is an entry’s name or alias,
a term is a pattern you pass on the command line, and a shared handle is an
alias that equals another entry’s alias or name.
Allowed alias values¶
An alias is a single case-sensitive string of at most 255 characters. It must
start with an ASCII letter, digit, or underscore (A-Z, a-z, 0-9, _) and
contain only ASCII letters, digits, _, ., and -. Checkout directory names
stay unrestricted.
Any invalid character or empty string fails when the configuration file loads
and states the rule. For example, when ~/invalid.yaml sets alias: libtmux/docs on docs:
$ vcspull list --file ~/invalid.yaml
vcspull: ~/invalid.yaml: '~/work/libtmux/' -> 'docs'.alias: must start with a letter, digit, or underscore, contain only letters, digits, _, ., and -, and be at most 255 characters
Each repository entry holds at most one alias. When ~/multi.yaml passes a
list (alias: [lt-docs, libtmux-docs]), loading fails:
$ vcspull list --file ~/multi.yaml
vcspull: ~/multi.yaml: '~/work/libtmux/' -> 'docs'.alias: expected a string; an alias must start with a letter, digit, or underscore, contain only letters, digits, _, ., and -, and be at most 255 characters (got a list; an entry holds one alias)
An alias equal to its own entry’s name adds nothing. vcspull ignores a
self-alias when loading the file, treats the entry as having no alias when
attaching via vcspull add --alias, and removes the redundant
key when you run vcspull fmt --write. vcspull fmt also
prints a Notes section for shared aliases and pinned self-aliases in the file
it formats without altering non-redundant aliases. For example, when
~/fmt-demo.yaml sets alias: docs on docs and alias: shared-docs on both
assets and manual:
$ vcspull list --file ~/fmt-demo.yaml docs
• docs → ~/work/libtmux/docs
$ vcspull fmt --file ~/fmt-demo.yaml
i Found 3 formatting issues in ~/fmt-demo.yaml
• Redundant alias 'docs' on 'docs' will be removed
• Directories will be sorted alphabetically
• Repositories in ~/work/libtmux/ will be sorted alphabetically
Notes (fmt changes nothing for these):
handle 'shared-docs' is shared by 2 entries in this file; a term naming it selects all of them:
'~/study/tmux/manual' (alias, ~/fmt-demo.yaml (explicit scope))
'~/work/libtmux/assets' (alias, ~/fmt-demo.yaml (explicit scope))
rename one alias to make the handle select one entry (other files may hold it too; see 'vcspull config ls')
→ Run with --write to apply these formatting changes.
Selecting entries by alias¶
vcspull sync, vcspull list, vcspull status, and
vcspull worktree match fnmatch patterns against
both name and alias:
$ vcspull list 'libtmux*'
• libtmux → ~/work/libtmux/libtmux
• libtmux-haskell → ~/work/libtmux/libtmux-haskell
• docs (alias libtmux-docs) → ~/work/libtmux/docs
• assets (alias libtmux-assets) → ~/work/libtmux/assets
$ vcspull sync --dry-run 'libtmux*'
Plan: 3 to clone (+), 0 to update (~), 1 unchanged (✓), 0 blocked (⚠), 0 errors (✗)
~/work/libtmux/
+ assets (alias libtmux-assets) ~/work/libtmux/assets missing
+ libtmux ~/work/libtmux/libtmux missing
+ libtmux-haskell ~/work/libtmux/libtmux-haskell missing
✓ docs (alias libtmux-docs) ~/work/libtmux/docs configured target matches
Tip: run without --dry-run to apply.
$ vcspull worktree list libtmux-docs
docs (alias libtmux-docs) (~/work/libtmux/docs)
+ tag:v1.0.0 ~/work/docs-v1 (will create configured worktree)
vcspull sync classifies terms starting with git, http, svn, or hg as
URL patterns, the same rule that applies to repository names. Choose an alias
with another prefix when you want vcspull sync to match it as a handle.
vcspull search includes alias in its default searched
fields and accepts alias: prefixes as well as --field alias:
$ vcspull search alias:libtmux
• docs (alias libtmux-docs) → ~/work/libtmux/docs
• assets (alias libtmux-assets) → ~/work/libtmux/assets
Sharing a directory name across different workspace roots is normal and never emits a warning. Only an alias can create a shared handle:
$ vcspull list docs
• docs (alias libtmux-docs) → ~/work/libtmux/docs
• docs → ~/study/python/docs
Aliases across configuration scopes¶
Within your own configuration files, a stronger scope replaces the weaker entry
whole (see Configuration scopes). Redefining an entry in ~/.vcspull.yaml
without repeating alias: drops the alias from ~/.config/vcspull/base.yaml,
and a term naming the lost alias warns which file replaced it:
$ vcspull list old-assets
alias 'old-assets' of the entry 'assets' is lost: ~/.vcspull.yaml (user scope) replaces the entry without an alias:
'~/work/libtmux/assets' (alias, entry 'assets' under '~/work/libtmux/', ~/.config/vcspull/base.yaml (user scope))
'~/work/libtmux/assets' (name, entry 'assets' under '~/work/libtmux/', ~/.vcspull.yaml (user scope))
to keep it, add 'alias: old-assets' to the entry in ~/.vcspull.yaml (see 'vcspull config ls')
No repositories found.
Project .vcspull.* files cannot remove or replace an alias declared in a user
or system configuration file. Even when ~/work/libtmux/.vcspull.yaml
redefines ./docs with alias: project-docs (or with no alias), your
libtmux-docs handle continues to select the entry from inside the project:
$ vcspull list libtmux-docs
• docs (alias libtmux-docs) → ~/work/libtmux/docs
Querying the ignored project alias explains why the user alias stayed in effect:
$ vcspull list project-docs
alias 'project-docs' of the entry 'docs' in ~/work/libtmux/.vcspull.yaml (project scope) is ignored: the entry keeps its alias 'libtmux-docs', and a project file cannot replace it:
'~/work/libtmux/docs' (alias, entry 'docs' under './', ~/work/libtmux/.vcspull.yaml (project scope))
'~/work/libtmux/docs' (alias, entry 'docs' under '~/work/libtmux/', ~/.config/vcspull/base.yaml (user scope))
to select the entry as 'project-docs', put that alias in ~/.config/vcspull/base.yaml in place of 'libtmux-docs'; otherwise nothing needs doing (see 'vcspull config ls')
No repositories found.
Recording and attaching aliases¶
Pass --alias HANDLE to vcspull add when registering a new repository entry:
$ vcspull add ~/study/python/docs --alias python-docs --yes
Found new repository to import:
+ docs (https://github.com/python/cpython-docs.git)
• workspace: ~/study/python/
↳ path: ~/study/python/docs
? Import this repository with alias 'python-docs'? [y/N]: y (auto-confirm)
✓ Successfully added 'docs' (git+https://github.com/python/cpython-docs.git) to ~/.vcspull.yaml under '~/study/python/' with alias 'python-docs'.
When PATH already resolves to a configured destination — regardless of its
entry key or path: override — vcspull add PATH --alias HANDLE attaches the
alias to the winning repository entry in place, preserving section layout, key
order, and all other fields. Before prompting, vcspull renders the updated file
and reloads it through the configuration loader to verify that the target entry
gains alias and every other entry stays unchanged:
$ vcspull add ~/work/libtmux/assets --alias libtmux-assets --dry-run
Found configured repository to alias:
+ assets (git+https://github.com/tmux-python/libtmux-assets.git)
• workspace: ~/work/libtmux/
↳ path: ~/work/libtmux/assets
• file: ~/.vcspull.yaml
? Attach alias 'libtmux-assets' to this repository? [y/N]: skipped (dry-run)
→ Would attach alias 'libtmux-assets' to 'assets' in ~/.vcspull.yaml under '~/work/libtmux/'.
$ vcspull add ~/work/libtmux/assets --alias libtmux-assets --yes
Found configured repository to alias:
+ assets (git+https://github.com/tmux-python/libtmux-assets.git)
• workspace: ~/work/libtmux/
↳ path: ~/work/libtmux/assets
• file: ~/.vcspull.yaml
? Attach alias 'libtmux-assets' to this repository? [y/N]: y (auto-confirm)
✓ Attached alias 'libtmux-assets' to 'assets' in ~/.vcspull.yaml under '~/work/libtmux/'.
An attach refuses before any prompt whenever the edit is not one unambiguous alias addition:
Situation |
Outcome |
|---|---|
Two or more entries resolve to the directory |
Refused, naming each workspace root and key |
|
Refused, naming the file that wins |
|
Refused, naming the loaded file |
|
Edited in |
The entry is defined only in a project or system file |
Refused unless |
The entry already has a non-redundant alias |
Refused; edit the file by hand to change or remove it |
The entry is pinned ( |
Refused; pins guard against every writer |
You pass |
Refused; an attach changes only |
$ vcspull add ~/work/libtmux/assets --alias libtmux-assets --pin v1.0.0
Cannot attach alias 'libtmux-assets' to 'assets': an attach changes only the alias; --pin would change the entry (edit the config file, or remove the entry and add it again)
vcspull add never changes or removes an existing alias; edit the
configuration file directly to rename or delete one:
$ vcspull add ~/work/libtmux/assets --alias other-assets
Cannot attach alias 'other-assets' to 'assets': 'assets' already has the alias 'libtmux-assets', held as '~/work/libtmux/assets' (alias, ~/.vcspull.yaml (user scope)); edit ~/.vcspull.yaml to change it
vcspull discover and vcspull import never write alias:, and both treat a
repository entry configured with an alias (or custom key) as already covering
its destination (as shown in the vcspull discover ~/study/python --yes output
under Shared handles and warnings).
Human and JSON output¶
Human-readable output prints (alias HANDLE) immediately after name in
list, status, search, sync, and worktree:
$ vcspull status --no-concurrent
✗ libtmux: missing
✗ libtmux-haskell: missing
✓ docs (alias libtmux-docs): up to date
✗ assets (alias libtmux-assets): missing
✗ docs: missing
Summary: 5 repositories, 1 exist, 4 missing
$ vcspull sync --color never libtmux-docs
✓ Synced docs (alias libtmux-docs) → ~/work/libtmux/docs
Summary: 1 repos, 1 synced, 0 failed
--json and --ndjson repository payloads include "alias" (null when
unset) while keeping "name" unchanged so existing scripts that read "name"
continue to work:
$ vcspull list --json docs
[
{
"name": "docs",
"alias": "libtmux-docs",
"url": "git+https://github.com/tmux-python/libtmux-docs.git",
"path": "~/work/libtmux/docs",
"workspace_root": "~/work/libtmux/"
},
{
"name": "docs",
"alias": null,
"url": "git+https://github.com/python/cpython-docs.git",
"path": "~/study/python/docs",
"workspace_root": "~/study/python/"
}
]
For the Python reader¶
vcspull.validator.alias_problem() validates candidate alias strings with
the same rules enforced by vcspull.validator.validate_repo_entry() and
the published JSON Schema.
vcspull.config.load_scoped_configs() resolves aliases across scopes and
emits any term-triggered handle warnings when you pass terms, and
vcspull.config.filter_repos() matches name patterns against both name
and case-sensitive alias values.