-
Notifications
You must be signed in to change notification settings - Fork 14
Description
The hackable repo manager, built on libvcs. With great defaults, and presets if those don't work
Config Loaders and backends
Finds configs (based on template loaders in django) and processes them them
- Loader: Searches
- Backend: Parser, e.g. yaml, json, toml, ini, python
CONFIG_LOADERS = [
{
"BACKEND": "vcspull.configs.loaders.json.JSONLoader",
"XDG_DIRS": True,
# optionally
"DIRS": [
"/custom/lookup/path",
],
},
{"BACKEND": "vcspull.configs.loaders.json.YAMLLoader", "XDG_DIRS": True},
{"BACKEND": "vcspull.configs.loaders.json.TOMLLoader", "XDG_DIRS": True},
{"BACKEND": "vcspull.configs.loaders.json.PythonLoader", "XDG_DIRS": True},
]Config processors
(inspired by context processors / middleware):
helpers that expand config, e.g.
repo: 'git+https://github.com/vcs-python/vcspull'repo:
remotes:
origin:
push: 'git+https://github.com/vcs-python/vcspull'
pull: 'git+https://github.com/vcs-python/vcspull'CONFIG_PROCESSORS = [
# before:
# repo: 'git+https://github.com/vcs-python/vcspull'
# after:
# repo:
# remotes:
# origin:
# push: 'git+https://github.com/vcs-python/vcspull'
# pull: 'git+https://github.com/vcs-python/vcspull'
"vcspull.configs.processors.simple_repo",
# before:
# repo:
# origin: 'git+https://github.com/vcs-python/vcspull'
# after:
# repo:
# origin:
# push: 'git+https://github.com/vcs-python/vcspull'
# pull: 'git+https://github.com/vcs-python/vcspull'
"vcspull.configs.processors.simple_remote",
]URL Parsers / adapters
e.g. pip, npm/yarn, normal vcs URLs
Merge / conflict resolutions
Function to handle merge behavior when same repo name exists. `
'MERGE_BEHAVIOR: 'vcspull.config.merge.default'
default = deep_extend
def overwrite(a, b, config_a, config_b):
return b
def extend(a, b, config_a, config_b):
a.extend(b)
def deep_extend(a, b, config_a, config_b):
# deep merge codeabove: hopefully if we pass config_a and config_b, if at all, they'd be immutable
see:https://github.com/TehShrike/deepmerge#custommerge
VCS backends
VCS_BACKENDS = {
'git': 'libvcs.git.Git',
'svn': 'libvcs.svn.Svn'
'hg': 'libvcs.hg.Mercurial'
}Allows people to override with custom behavior, esp. overriding sync()
Initialization
vcspull settings:
{
"extends": "vcspull.settings.default",
"CONFIG_LOADERS": [],
"CONFIG_PROCESSORS": []
}Consider a json wrapper for jsonc
Strip removing trailing commas and comments
VCSPull(settings='str_or_dict', init=True)
vp = VCSPull(settings='vcspull.config.default')
vp = VCSPull(settings='~/.config/vcspull/settings.py')
vp = VCSPull(settings='~/.config/vcspull/settings.json')
Without initializing / finding configs:
vp = VCSPull(settings='~/.config/vcspull/settings.json', init=False)
vp.settings
vp.init() # Finds configs via loaders, parses via backends, builds index of reposMetadata
Metadata
Assignees
Labels
Type
Projects
Status