Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ $ pipx install --suffix=@next 'vcspull' --pip-args '\--pre' --force

<!-- Maintainers, insert changes / features for the next release here -->

### Internal

- `sync()`: Rename `repo_terms` to `repo_patterns` (#406)

## vcspull v1.15.8 (2022-10-16)

### CLI
Expand Down
2 changes: 1 addition & 1 deletion src/vcspull/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def cli(args=None):
return
elif args.subparser_name == "sync":
sync(
repo_terms=args.repo_terms,
repo_patterns=args.repo_patterns,
config=args.config,
exit_on_error=args.exit_on_error,
parser=sync_parser,
Expand Down
18 changes: 9 additions & 9 deletions src/vcspull/cli/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def create_sync_subparser(parser: argparse.ArgumentParser) -> argparse.ArgumentP
help="optional filepath to specify vcspull config",
)
parser.add_argument(
"repo_terms",
"repo_patterns",
metavar="filter",
nargs="*",
help="patterns / terms of repos, accepts globs / fnmatch(3)",
Expand All @@ -51,14 +51,14 @@ def create_sync_subparser(parser: argparse.ArgumentParser) -> argparse.ArgumentP


def sync(
repo_terms,
repo_patterns,
config,
exit_on_error: bool,
parser: t.Optional[
argparse.ArgumentParser
] = None, # optional so sync can be unit tested
) -> None:
if isinstance(repo_terms, list) and len(repo_terms) == 0:
if isinstance(repo_patterns, list) and len(repo_patterns) == 0:
if parser is not None:
parser.print_help()
sys.exit(2)
Expand All @@ -69,14 +69,14 @@ def sync(
configs = load_configs(find_config_files(include_home=True))
found_repos = []

for repo_term in repo_terms:
for repo_pattern in repo_patterns:
dir, vcs_url, name = None, None, None
if any(repo_term.startswith(n) for n in ["./", "/", "~", "$HOME"]):
dir = repo_term
elif any(repo_term.startswith(n) for n in ["http", "git", "svn", "hg"]):
vcs_url = repo_term
if any(repo_pattern.startswith(n) for n in ["./", "/", "~", "$HOME"]):
dir = repo_pattern
elif any(repo_pattern.startswith(n) for n in ["http", "git", "svn", "hg"]):
vcs_url = repo_pattern
else:
name = repo_term
name = repo_pattern

# collect the repos from the config files
found = filter_repos(configs, dir=dir, vcs_url=vcs_url, name=name)
Expand Down