From 3e086e962acad75b4ecaf99e80584a65000744db Mon Sep 17 00:00:00 2001 From: Saugat Pachhai Date: Mon, 2 Mar 2020 13:30:27 +0545 Subject: [PATCH 1/3] gc: make --all-commits visible --- dvc/command/gc.py | 2 +- dvc/repo/__init__.py | 2 +- dvc/repo/brancher.py | 4 ++-- scripts/completion/dvc.bash | 2 +- scripts/completion/dvc.zsh | 1 + 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/dvc/command/gc.py b/dvc/command/gc.py index 67c0927d2e..345ad93df8 100644 --- a/dvc/command/gc.py +++ b/dvc/command/gc.py @@ -100,7 +100,7 @@ def add_parser(subparsers, parent_parser): "--all-commits", action="store_true", default=False, - help=argparse.SUPPRESS, + help="Keep data files for all git commits.", ) gc_parser.add_argument( "-c", diff --git a/dvc/repo/__init__.py b/dvc/repo/__init__.py index 5912d5dc57..5850f0f56b 100644 --- a/dvc/repo/__init__.py +++ b/dvc/repo/__init__.py @@ -229,7 +229,7 @@ def used_cache( (namely, a file described as an output on a stage). The scope is, by default, the working directory, but you can use - `all_branches` or `all_tags` to expand scope. + `all_branches`/`all_tags`/`all_commits` to expand the scope. Returns: A dictionary with Schemes (representing output's location) as keys, diff --git a/dvc/repo/brancher.py b/dvc/repo/brancher.py index 955b135135..67a3b19b36 100644 --- a/dvc/repo/brancher.py +++ b/dvc/repo/brancher.py @@ -9,9 +9,9 @@ def brancher( # noqa: E302 """Generator that iterates over specified revisions. Args: - branches (list): a list of branches to iterate over. + revs (list): a list of revisions to iterate over. all_branches (bool): iterate over all available branches. - tags (list): a list of tags to iterate over. + all_commits (bool): iterate over all commits. all_tags (bool): iterate over all available tags. Yields: diff --git a/scripts/completion/dvc.bash b/scripts/completion/dvc.bash index 004685410c..53a704af18 100644 --- a/scripts/completion/dvc.bash +++ b/scripts/completion/dvc.bash @@ -26,7 +26,7 @@ _dvc_fetch='-j --jobs -r --remote -a --all-branches -T --all-tags -d --with-deps _dvc_fetch_COMPGEN=_dvc_compgen_DVCFiles _dvc_get_url='' _dvc_get='-o --out --rev --show-url' -_dvc_gc='-a --all-branches -T --all-tags -c --cloud -r --remote -f --force -p --projects -j --jobs' +_dvc_gc='-a --all-branches --all-commits -T --all-tags -c --cloud -r --remote -f --force -p --projects -j --jobs' _dvc_import_url='-f --file' _dvc_import='-o --out --rev' _dvc_init='--no-scm -f --force' diff --git a/scripts/completion/dvc.zsh b/scripts/completion/dvc.zsh index af97520e00..5f5878e120 100644 --- a/scripts/completion/dvc.zsh +++ b/scripts/completion/dvc.zsh @@ -129,6 +129,7 @@ _dvc_get=( _dvc_gc=( {-a,--all-branches}"[Keep data files for the tips of all git branches.]" + {-a,--all-commits}"[Keep data files for all git commits.]" {-T,--all-tags}"[Keep data files for all git tags.]" {-c,--cloud}"[Collect garbage in remote repository.]" {-r,--remote}"[Remote storage to collect garbage in.]:Remote repository:" From 145037d499d901073ff08e913e4f33d728864f58 Mon Sep 17 00:00:00 2001 From: Saugat Pachhai Date: Thu, 5 Mar 2020 20:38:14 +0545 Subject: [PATCH 2/3] gc: fix help message and completion scripts --- dvc/command/gc.py | 8 ++++---- scripts/completion/dvc.bash | 2 +- scripts/completion/dvc.zsh | 7 ++++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/dvc/command/gc.py b/dvc/command/gc.py index 345ad93df8..b4b710ae73 100644 --- a/dvc/command/gc.py +++ b/dvc/command/gc.py @@ -80,27 +80,27 @@ def add_parser(subparsers, parent_parser): "--workspace", action="store_true", default=False, - help="Keep data files used in the current workspace.", + help="Keep data files used in the current workspace (working tree).", ) gc_parser.add_argument( "-a", "--all-branches", action="store_true", default=False, - help="Keep data files for the tips of all git branches.", + help="Keep data files for the tips of all Git branches.", ) gc_parser.add_argument( "-T", "--all-tags", action="store_true", default=False, - help="Keep data files for all git tags.", + help="Keep data files for all Git tags.", ) gc_parser.add_argument( "--all-commits", action="store_true", default=False, - help="Keep data files for all git commits.", + help="Keep data files for all Git commits.", ) gc_parser.add_argument( "-c", diff --git a/scripts/completion/dvc.bash b/scripts/completion/dvc.bash index 53a704af18..9d2ca8ec59 100644 --- a/scripts/completion/dvc.bash +++ b/scripts/completion/dvc.bash @@ -26,7 +26,7 @@ _dvc_fetch='-j --jobs -r --remote -a --all-branches -T --all-tags -d --with-deps _dvc_fetch_COMPGEN=_dvc_compgen_DVCFiles _dvc_get_url='' _dvc_get='-o --out --rev --show-url' -_dvc_gc='-a --all-branches --all-commits -T --all-tags -c --cloud -r --remote -f --force -p --projects -j --jobs' +_dvc_gc='-a --all-branches --all-commits -T --all-tags -w -c --cloud -r --remote -f --force -p --projects -j --jobs' _dvc_import_url='-f --file' _dvc_import='-o --out --rev' _dvc_init='--no-scm -f --force' diff --git a/scripts/completion/dvc.zsh b/scripts/completion/dvc.zsh index 5f5878e120..49c9ecf22d 100644 --- a/scripts/completion/dvc.zsh +++ b/scripts/completion/dvc.zsh @@ -128,9 +128,10 @@ _dvc_get=( ) _dvc_gc=( - {-a,--all-branches}"[Keep data files for the tips of all git branches.]" - {-a,--all-commits}"[Keep data files for all git commits.]" - {-T,--all-tags}"[Keep data files for all git tags.]" + {-w,--workspace}"[Keep data files used in the current workspace (working tree).]" + {-a,--all-branches}"[Keep data files for the tips of all Git branches.]" + "--all-commits[Keep data files for all Git commits.]" + {-T,--all-tags}"[Keep data files for all Git tags.]" {-c,--cloud}"[Collect garbage in remote repository.]" {-r,--remote}"[Remote storage to collect garbage in.]:Remote repository:" {-f,--force}"[Force garbage collection - automatically agree to all prompts.]:Repos:_files" From 06eac46e32cfa20f8a26063ab29d8495e235f18d Mon Sep 17 00:00:00 2001 From: Saugat Pachhai Date: Thu, 5 Mar 2020 20:39:44 +0545 Subject: [PATCH 3/3] bash: add longform --workspace flag --- scripts/completion/dvc.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/completion/dvc.bash b/scripts/completion/dvc.bash index 9d2ca8ec59..135f706619 100644 --- a/scripts/completion/dvc.bash +++ b/scripts/completion/dvc.bash @@ -26,7 +26,7 @@ _dvc_fetch='-j --jobs -r --remote -a --all-branches -T --all-tags -d --with-deps _dvc_fetch_COMPGEN=_dvc_compgen_DVCFiles _dvc_get_url='' _dvc_get='-o --out --rev --show-url' -_dvc_gc='-a --all-branches --all-commits -T --all-tags -w -c --cloud -r --remote -f --force -p --projects -j --jobs' +_dvc_gc='-a --all-branches --all-commits -T --all-tags -w --workspace -c --cloud -r --remote -f --force -p --projects -j --jobs' _dvc_import_url='-f --file' _dvc_import='-o --out --rev' _dvc_init='--no-scm -f --force'