From 796cd975463ee8184796fb16d91c4af32d41dbff Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 30 Jan 2022 11:51:07 +0100 Subject: Merging upstream version 0.16.2. Signed-off-by: Daniel Baumann --- gita/utils.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'gita/utils.py') diff --git a/gita/utils.py b/gita/utils.py index 8e7d9c4..5332255 100644 --- a/gita/utils.py +++ b/gita/utils.py @@ -279,6 +279,7 @@ def _make_name(path: str, repos: Dict[str, Dict[str, str]], def add_repos(repos: Dict[str, Dict[str, str]], new_paths: List[str], include_bare=False, exclude_submodule=False, + dry_run=False, ) -> Dict[str, Dict[str, str]]: """ Write new repo paths to file; return the added repos. @@ -291,6 +292,10 @@ def add_repos(repos: Dict[str, Dict[str, str]], new_paths: List[str], new_repos = {} if new_paths: print(f"Found {len(new_paths)} new repo(s).") + if dry_run: + for p in new_paths: + print(p) + return {} name_counts = Counter( os.path.basename(os.path.normpath(p)) for p in new_paths ) @@ -453,14 +458,14 @@ def get_cmds_from_files() -> Dict[str, Dict[str, str]]: return cmds -def parse_repos_and_rest(input: List[str] +def parse_repos_and_rest(input: List[str], quote_mode=False, ) -> Tuple[Dict[str, Dict[str, str]], List[str]]: """ Parse gita input arguments @return: repos and the rest (e.g., gita shell and super commands) """ - i = None + i = 0 names = [] repos = get_repos() groups = get_groups() @@ -475,6 +480,10 @@ def parse_repos_and_rest(input: List[str] i += 1 if not names and ctx: names = [ctx.stem] + if quote_mode and i + 1 != len(input): + print(input[i], 'is not a repo or group' ) + sys.exit(2) + if names: chosen = {} for k in names: -- cgit v1.2.3