filter-repo: rename to --prune-empty and --prune-degenerate

Imperative form sounds better than --empty-pruning and
--degenerate-pruning, and it probably works better with command line
completion.

Signed-off-by: Elijah Newren <newren@gmail.com>
pull/13/head
Elijah Newren 5 years ago
parent ece8a74df9
commit 6fb7da0f0a

@ -1610,14 +1610,14 @@ class FilteringOptions(object):
"existing replace ref. default is 'update-and-add' if "
"$GIT_DIR/filter-repo/already_ran does not exist; "
"'update-or-add' otherwise."))
parents.add_argument('--empty-pruning', default='auto',
parents.add_argument('--prune-empty', default='auto',
choices=['always', 'auto', 'never'],
help=_("Whether to prune empty commits. 'auto' (the default) means "
"only prune commits which become empty (not commits which were "
"empty in the original repo, unless their parent was pruned). "
"When the parent of a commit is pruned, the first non-pruned "
"ancestor becomes the new parent."))
parents.add_argument('--degenerate-pruning', default='auto',
parents.add_argument('--prune-degenerate', default='auto',
choices=['always', 'auto', 'never'],
help=_("Since merge commits are needed for history topology, they "
"are typically exempt from pruning. However, they can become "
@ -2651,9 +2651,9 @@ class RepoFilter(object):
Returns a tuple:
(parents, new_first_parent_if_would_become_non_merge)'''
if self._args.degenerate_pruning == 'never':
if self._args.prune_degenerate == 'never':
return parents, None
always_prune = (self._args.degenerate_pruning == 'always')
always_prune = (self._args.prune_degenerate == 'always')
# Pruning of empty commits means multiple things:
# * An original parent of this commit may have been pruned causing the
@ -2728,9 +2728,9 @@ class RepoFilter(object):
def _prunable(self, commit, new_1st_parent, had_file_changes, orig_parents):
parents = commit.parents
if self._args.empty_pruning == 'never':
if self._args.prune_empty == 'never':
return False
always_prune = (self._args.empty_pruning == 'always')
always_prune = (self._args.prune_empty == 'always')
# For merge commits, unless there are prunable (redundant) parents, we
# do not want to prune

@ -39,10 +39,10 @@ filter_testcase basic basic-numbers --invert-paths --path-regex 'f.*e.*e'
filter_testcase basic basic-mailmap --mailmap ../t9390/sample-mailmap
filter_testcase basic basic-replace --replace-text ../t9390/sample-replace
filter_testcase empty empty-keepme --path keepme
filter_testcase empty more-empty-keepme --path keepme --empty-pruning=always \
--degenerate-pruning=always
filter_testcase empty less-empty-keepme --path keepme --empty-pruning=never \
--degenerate-pruning=never
filter_testcase empty more-empty-keepme --path keepme --prune-empty=always \
--prune-degenerate=always
filter_testcase empty less-empty-keepme --path keepme --prune-empty=never \
--prune-degenerate=never
filter_testcase degenerate degenerate-keepme --path moduleA/keepme
filter_testcase degenerate degenerate-moduleA --path moduleA
filter_testcase degenerate degenerate-globme --path-glob *me

Loading…
Cancel
Save