prune: replace --biject with --pair
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 30 Aug 2018 19:50:39 +0200
changeset 4045 821e4be40c6c
parent 4044 c0fbe70f2e48
child 4046 669b32100eca
prune: replace --biject with --pair People have been complaining about `--biject` being to obscure for a while. A recent discussion with Pulkit Goyal and Dan Villiom Podlaski Christiansen produce some new concrete proposal that we liked. We eventually settle on using `--pair`. The `--biject` flag will be kept as an alias for a while.
CHANGELOG
hgext3rd/evolve/cmdrewrite.py
tests/test-prune.t
--- a/CHANGELOG	Tue Aug 28 21:28:41 2018 +0800
+++ b/CHANGELOG	Thu Aug 30 19:50:39 2018 +0200
@@ -1,6 +1,11 @@
 Changelog
 =========
 
+8.1.2 - in progress
+-------------------
+
+  * prune: rename `--biject` flag to `--pair` (old flag is kept as an alias)
+
 8.1.2 -- 2018-08-28
 -------------------
 
--- a/hgext3rd/evolve/cmdrewrite.py	Tue Aug 28 21:28:41 2018 +0800
+++ b/hgext3rd/evolve/cmdrewrite.py	Thu Aug 30 19:50:39 2018 +0200
@@ -942,7 +942,9 @@
      ('r', 'rev', [], _("revisions to prune")),
      ('k', 'keep', None, _("does not modify working copy during prune")),
      ('n', 'note', '', _('store a note on prune')),
-     ('', 'biject', False, _("do a 1-1 map between rev and successor ranges")),
+     ('', 'pair', False, _("record a pairing, such as a rebase or divergence resolution "
+                           "(pairing multiple precursors to multiple successors)")),
+     ('', 'biject', False, _("alias to --pair (DEPRECATED)")),
      ('', 'fold', False,
       _("record a fold (multiple precursors, one successors)")),
      ('', 'split', False,
@@ -972,7 +974,7 @@
     single successor, you must pass the ``--fold`` option.
 
     If you want to supersede multiple revisions at the same time, use
-    ``--biject`` option to pair the pruned precursor and successor changesets.
+    ``--pair`` option to pair the pruned precursor and successor changesets.
     This is commonly useful for resolving history divergence, or when someone
     else does edits history without obsolescence enabled.
     """
@@ -981,11 +983,11 @@
     succs = opts['new'] + opts['succ']
     bookmarks = set(opts.get('bookmark'))
     metadata = _getmetadata(**opts)
-    biject = opts.get('biject')
+    biject = opts.get('pair') or opts.get('biject')
     fold = opts.get('fold')
     split = opts.get('split')
 
-    options = [o for o in ('biject', 'fold', 'split') if opts.get(o)]
+    options = [o for o in ('pair', 'fold', 'split') if opts.get(o)]
     if 1 < len(options):
         raise error.Abort(_("can only specify one of %s") % ', '.join(options))
 
@@ -1020,7 +1022,7 @@
         sucs = tuple(repo[n] for n in sucs)
         if not biject and len(sucs) > 1 and len(precs) > 1:
             msg = "Can't use multiple successors for multiple precursors"
-            hint = _("use --biject to mark a series as a replacement"
+            hint = _("use --pair to mark a series as a replacement"
                      " for another")
             raise error.Abort(msg, hint=hint)
         elif biject and len(sucs) != len(precs):
--- a/tests/test-prune.t	Tue Aug 28 21:28:41 2018 +0800
+++ b/tests/test-prune.t	Thu Aug 30 19:50:39 2018 +0200
@@ -35,14 +35,20 @@
 Check arguments exclusive to each other
 ---------------------------------------
 
+  $ hg prune --fold --pair
+  abort: can only specify one of pair, fold
+  [255]
   $ hg prune --fold --biject
-  abort: can only specify one of biject, fold
+  abort: nothing to prune
   [255]
   $ hg prune --split --fold
   abort: can only specify one of fold, split
   [255]
+  $ hg prune --split --fold --pair
+  abort: can only specify one of pair, fold, split
+  [255]
   $ hg prune --split --fold --biject
-  abort: can only specify one of biject, fold, split
+  abort: can only specify one of fold, split
   [255]
 
 Check simple case
@@ -196,7 +202,7 @@
 
   $ hg prune 'desc("add cc")' 'desc("add bb")' -s 'desc("add nD")' -s 'desc("add nC")'
   abort: Can't use multiple successors for multiple precursors
-  (use --biject to mark a series as a replacement for another)
+  (use --pair to mark a series as a replacement for another)
   [255]
   $ hg debugobsolete
   9d206ffc875e1bc304590549be293be36821e66c 0 {47d2a3944de8b013de3be9578e8e344ea2e6c097} (Sat Dec 15 00:00:00 1979 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'blah'}
@@ -223,7 +229,7 @@
   814c38b95e72dfe2cbf675b1649ea9d780c89a80 6f6f25e4f748d8f7571777e6e168aedf50350ce8 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '9', 'operation': 'prune', 'user': 'test'}
   354011cd103f58bbbd9091a3cee6d6a6bd0dddf7 6f6f25e4f748d8f7571777e6e168aedf50350ce8 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'prune', 'user': 'test'}
 
-two old, two new with --biject
+two old, two new with --pair
 
   $ hg up 0
   0 files updated, 0 files merged, 4 files removed, 0 files unresolved
@@ -231,7 +237,7 @@
   created new head
   $ mkcommit n2
 
-  $ hg prune 'desc("add n1")::desc("add n2")' -s 'desc("add nD")::desc("add nE")' --biject
+  $ hg prune 'desc("add n1")::desc("add n2")' -s 'desc("add nD")::desc("add nE")' --pair
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   working directory now at 1f0dee641bb7
   2 changesets pruned