summaryrefslogtreecommitdiffstats
path: root/gita/utils.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-01-30 10:51:07 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-01-30 10:51:07 +0000
commit796cd975463ee8184796fb16d91c4af32d41dbff (patch)
tree446971c4543ffd8e6af6b7c4f4894d261fe8af39 /gita/utils.py
parentReleasing debian version 0.16.1-1. (diff)
downloadgita-796cd975463ee8184796fb16d91c4af32d41dbff.tar.xz
gita-796cd975463ee8184796fb16d91c4af32d41dbff.zip
Merging upstream version 0.16.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gita/utils.py')
-rw-r--r--gita/utils.py13
1 files changed, 11 insertions, 2 deletions
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: