diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-07-16 05:43:04 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-07-16 05:43:04 +0000 |
commit | 5e9d53ef29710380368b60c82e146c5d82235e12 (patch) | |
tree | efc287af4d977d585b4717455c68e31c6d57439f /gita | |
parent | Releasing debian version 0.16.4-1. (diff) | |
download | gita-5e9d53ef29710380368b60c82e146c5d82235e12.tar.xz gita-5e9d53ef29710380368b60c82e146c5d82235e12.zip |
Merging upstream version 0.16.5.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gita')
-rw-r--r-- | gita/__main__.py | 32 | ||||
-rw-r--r-- | gita/info.py | 5 |
2 files changed, 33 insertions, 4 deletions
diff --git a/gita/__main__.py b/gita/__main__.py index 4cc0e1e..3d091c6 100644 --- a/gita/__main__.py +++ b/gita/__main__.py @@ -149,10 +149,20 @@ def f_info(args: argparse.Namespace): def f_clone(args: argparse.Namespace): + + if args.dry_run: + if args.from_file: + for url, repo_name, abs_path in utils.parse_clone_config(args.clonee): + print(f"git clone {url} {abs_path}") + else: + print(f"git clone {args.clonee}") + return + if args.directory: path = args.directory else: path = Path.cwd() + if not args.from_file: subprocess.run(["git", "clone", args.clonee], cwd=path) return @@ -169,9 +179,15 @@ def f_clone(args: argparse.Namespace): ) -def f_freeze(_): - # TODO: filter context +def f_freeze(args): repos = utils.get_repos() + ctx = utils.get_context() + if args.group is None and ctx: + args.group = ctx.stem + group_repos = None + if args.group: # only display repos in this group + group_repos = utils.get_groups()[args.group]["repos"] + repos = {k: repos[k] for k in group_repos if k in repos} seen = {""} for name, prop in repos.items(): path = prop["path"] @@ -460,6 +476,12 @@ def main(argv=None): description="print all repo information", help="print all repo information", ) + p_freeze.add_argument( + "-g", + "--group", + choices=utils.get_groups(), + help="freeze repos in the specified group", + ) p_freeze.set_defaults(func=f_freeze) p_clone = subparsers.add_parser( @@ -487,6 +509,12 @@ def main(argv=None): action="store_true", help="clone repo(s) in their original paths", ) + p_clone.add_argument( + "-n", + "--dry-run", + action="store_true", + help="If set, show command without execution", + ) p_clone.set_defaults(func=f_clone) p_rename = subparsers.add_parser( diff --git a/gita/info.py b/gita/info.py index 3af3178..bfb463b 100644 --- a/gita/info.py +++ b/gita/info.py @@ -198,9 +198,10 @@ def get_commit_time(prop: Dict[str, str]) -> str: def get_repo_status(prop: Dict[str, str], no_colors=False) -> str: head = get_head(prop["path"]) dirty, staged, untracked, color = _get_repo_status(prop, no_colors) + info = f"{head:<10} [{dirty+staged+untracked}]" if color: - return f"{color}{head+' ['+dirty+staged+untracked+']':<13}{Color.end}" - return f"{head+' ['+dirty+staged+untracked+']':<13}" + return f"{color}{info:<17}{Color.end}" + return f"{info:<17}" def get_repo_branch(prop: Dict[str, str]) -> str: |