prune: spell --successor flag without any unnecessary shortcuts stable
authorAnton Shestakov <av6@dwimlabs.net>
Fri, 19 Jul 2019 17:25:29 +0800
branchstable
changeset 4763 184c64c81528
parent 4751 d0965c5c5335
child 4764 3968f6d58591
prune: spell --successor flag without any unnecessary shortcuts If a user wants to spell out -s, it makes sense to allow that. Before this patch, prune would complain that --successor is not a recognized option. Obviously people don't usually need to spell --successors by hand thanks to shell completion (at least for Bash) using debugcomplete to see all available flags, so this patch doesn't bring any need for more typing. And thanks to Mercurial understanding shortened forms of command-line flags as long as they are unambiguous, the old-style `--succ` flags still work normally, and there are tests that use them. But two tests now use the full form to demonstrate that both ways work.
CHANGELOG
hgext3rd/evolve/__init__.py
hgext3rd/evolve/cmdrewrite.py
tests/test-evolve-split.t
tests/test-evolve.t
--- a/CHANGELOG	Fri Jun 14 18:44:43 2019 -0700
+++ b/CHANGELOG	Fri Jul 19 17:25:29 2019 +0800
@@ -7,6 +7,7 @@
   * pick: no longer forget file in case of conflict (issue6037)
   * pick: properly report and cleanup "unfinished state"
   * prune: don't update wcp if pruned revision are unrelated (issue6137)
+  * prune: spell --successor flag without any unnecessary shortcuts
   * evolve: properly prune changeset with no change in case of conflict (issue5967)
   * touch: detect resulting divergence in more cases (issue6107)
 
--- a/hgext3rd/evolve/__init__.py	Fri Jun 14 18:44:43 2019 -0700
+++ b/hgext3rd/evolve/__init__.py	Fri Jul 19 17:25:29 2019 +0800
@@ -1276,7 +1276,7 @@
     revs = repo.revs("(%ld)::", revs)
     kwargs['rev'] = []
     kwargs['new'] = []
-    kwargs['succ'] = []
+    kwargs['successor'] = []
     kwargs['biject'] = False
     return cmdrewrite.cmdprune(ui, repo, *revs, **kwargs)
 
--- a/hgext3rd/evolve/cmdrewrite.py	Fri Jun 14 18:44:43 2019 -0700
+++ b/hgext3rd/evolve/cmdrewrite.py	Fri Jul 19 17:25:29 2019 +0800
@@ -958,7 +958,7 @@
 @eh.command(
     'prune|obsolete',
     [('n', 'new', [], _("successor changeset (DEPRECATED)")),
-     ('s', 'succ', [], _("successor changeset"), _('REV')),
+     ('s', 'successor', [], _("successor changeset"), _('REV')),
      ('r', 'rev', [], _("revisions to prune"), _('REV')),
      ('k', 'keep', None, _("does not modify working copy during prune")),
      ('n', 'note', '', _('store a note on prune'), _('TEXT')),
@@ -985,12 +985,12 @@
     When you prune the parent of your working copy, Mercurial updates the working
     copy to a non-obsolete parent.
 
-    You can use ``-s/--succ`` to tell Mercurial that a newer version (successor) of the
-    pruned changeset exists. Mercurial records successor revisions in obsolescence
-    markers.
+    You can use ``-s/--successor`` to tell Mercurial that a newer version
+    (successor) of the pruned changeset exists. Mercurial records successor
+    revisions in obsolescence markers.
 
     If you prune a single revision and specify multiple revisions in
-    ``-s/--succ``, you are recording a "split" and must acknowledge it by
+    ``-s/--successor``, you are recording a "split" and must acknowledge it by
     passing ``--split``. Similarly, when you prune multiple changesets with a
     single successor, you must pass the ``--fold`` option.
 
@@ -1001,7 +1001,7 @@
     """
     _checknotesize(ui, opts)
     revs = scmutil.revrange(repo, list(revs) + opts.get('rev'))
-    succs = opts['new'] + opts['succ']
+    succs = opts['new'] + opts['successor']
     bookmarks = set(opts.get('bookmark'))
     metadata = _getmetadata(**opts)
     biject = opts.get('pair') or opts.get('biject')
--- a/tests/test-evolve-split.t	Fri Jun 14 18:44:43 2019 -0700
+++ b/tests/test-evolve-split.t	Fri Jul 19 17:25:29 2019 +0800
@@ -42,7 +42,7 @@
   $ printf "pp" > pp;
   $ hg add pp
   $ hg commit -m "_pp"
-  $ hg prune --succ "desc(_oo) + desc(_pp)" -r "desc('oo+pp')" --split
+  $ hg prune --successor "desc(_oo) + desc(_pp)" -r "desc('oo+pp')" --split
   1 changesets pruned
   1 new orphan changesets
   $ hg log -G
--- a/tests/test-evolve.t	Fri Jun 14 18:44:43 2019 -0700
+++ b/tests/test-evolve.t	Fri Jul 19 17:25:29 2019 +0800
@@ -595,7 +595,7 @@
   picking 3:0e84df4912da "add 3"
   $ hg graft -r1
   grafting 1:73d38bb17fd7 "add 1"
-  $ hg prune -r2 --succ .
+  $ hg prune -r2 --successor .
   1 changesets pruned
   $ glog --hidden
   @  6:417185465d2c@default(draft) add 1