evolve: kill `--obsolete` and `--old-obsolete` flags for graft
authorPulkit Goyal <7895pulkit@gmail.com>
Thu, 15 Mar 2018 00:09:24 +0530
changeset 3599 5a796d753427
parent 3598 dd0d2e90e653
child 3602 f7297afb0273
evolve: kill `--obsolete` and `--old-obsolete` flags for graft Evolve extension used to add the couple of flags to `hg graft` command for reasons I don't know but they were deprecated. For the functionality of `hg graft --old-obsolete`, we have `hg grab` now which can do that. One more reason to kill this is that we have logic to parse the graftstate, whereas in core, we are going to change how state files are read and write. Tweaked the tests a bit to use `hg grab` instead of these flags to make rest of the test output consistent. Replaced an entry of `hg graft -O` in doc by `hg grab`.
CHANGELOG
docs/from-mq.rst
hgext3rd/evolve/__init__.py
tests/test-evolve.t
--- a/CHANGELOG	Thu Mar 22 00:56:48 2018 +0100
+++ b/CHANGELOG	Thu Mar 15 00:09:24 2018 +0530
@@ -5,6 +5,7 @@
 -------------------
 
   * drop support for Mercurial 4.1
+  * `--obsolete` and `--old-obsolete` flags for `hg graft` are dropped
 
 7.3.0 -- 2018-03-21
 ---------------------
--- a/docs/from-mq.rst	Thu Mar 22 00:56:48 2018 +0100
+++ b/docs/from-mq.rst	Thu Mar 15 00:09:24 2018 +0530
@@ -125,7 +125,7 @@
 
 You can also decide to do it manually using::
 
-  $ hg graft -O <old-version>
+  $ hg grab <old-version>
 
 or::
 
--- a/hgext3rd/evolve/__init__.py	Thu Mar 22 00:56:48 2018 +0100
+++ b/hgext3rd/evolve/__init__.py	Thu Mar 15 00:09:24 2018 +0530
@@ -1266,33 +1266,6 @@
     kwargs['biject'] = False
     return cmdrewrite.cmdprune(ui, repo, *revs, **kwargs)
 
-@eh.wrapcommand('graft')
-def graftwrapper(orig, ui, repo, *revs, **kwargs):
-    kwargs = dict(kwargs)
-    revs = list(revs) + kwargs.get('rev', [])
-    kwargs['rev'] = []
-    obsoleted = kwargs.setdefault('obsolete', [])
-
-    wlock = lock = None
-    try:
-        wlock = repo.wlock()
-        lock = repo.lock()
-        if kwargs.get('old_obsolete'):
-            if kwargs.get('continue'):
-                obsoleted.extend(repo.vfs.read('graftstate').splitlines())
-            else:
-                obsoleted.extend(revs)
-        # convert obsolete target into revs to avoid alias joke
-        obsoleted[:] = [str(i) for i in repo.revs('%lr', obsoleted)]
-        if obsoleted and len(revs) > 1:
-
-            raise error.Abort(_('cannot graft multiple revisions while '
-                                'obsoleting (for now).'))
-
-        return commitwrapper(orig, ui, repo, *revs, **kwargs)
-    finally:
-        lockmod.release(lock, wlock)
-
 @eh.extsetup
 def oldevolveextsetup(ui):
     for cmd in ['prune', 'uncommit', 'touch', 'fold']:
@@ -1306,11 +1279,6 @@
     entry = cmdutil.findcmd('commit', commands.table)[1]
     entry[1].append(('o', 'obsolete', [],
                      _("make commit obsolete this revision (DEPRECATED)")))
-    entry = cmdutil.findcmd('graft', commands.table)[1]
-    entry[1].append(('o', 'obsolete', [],
-                     _("make graft obsoletes this revision (DEPRECATED)")))
-    entry[1].append(('O', 'old-obsolete', False,
-                     _("make graft obsoletes its source (DEPRECATED)")))
 
 @eh.wrapfunction(obsolete, '_checkinvalidmarkers')
 def _checkinvalidmarkers(orig, markers):
--- a/tests/test-evolve.t	Thu Mar 22 00:56:48 2018 +0100
+++ b/tests/test-evolve.t	Thu Mar 15 00:09:24 2018 +0530
@@ -574,7 +574,7 @@
 
   $ cd ..
 
-Test graft --obsolete/--old-obsolete
+Normal testing
 
   $ hg init test-graft
   $ cd test-graft
@@ -596,14 +596,16 @@
   |/
   o  0:8685c6d34325@default(draft) add 0
   
-  $ hg graft -r3 -O
-  grafting 3:0e84df4912da "add 3"
-  $ hg graft -r1 -o 2
+  $ hg grab -r3
+  grabbing 3:0e84df4912da "add 3"
+  $ hg graft -r1
   grafting 1:73d38bb17fd7 "add 1"
+  $ hg prune -r2 --succ .
+  1 changesets pruned
   $ glog --hidden
-  @  6:acb28cd497b7@default(draft) add 1
+  @  6:417185465d2c@default(draft) add 1
   |
-  o  5:0b9e50c35132@default(draft) add 3
+  o  5:fa455b5098e0@default(draft) add 3
   |
   o  4:ce341209337f@default(draft) add 4
   |
@@ -616,39 +618,37 @@
   o  0:8685c6d34325@default(draft) add 0
   
   $ hg debugobsolete
-  0e84df4912da4c7cad22a3b4fcfd58ddfb7c8ae9 0b9e50c35132ff548ec0065caea6a87e1ebcef32 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'amend', 'user': 'test'}
-  db038628b9e56f51a454c0da0c508df247b41748 acb28cd497b7f8767e01ef70f68697a959573c2d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'amend', 'user': 'test'}
+  0e84df4912da4c7cad22a3b4fcfd58ddfb7c8ae9 fa455b5098e0ce8c1871edf6369f32be7d8b4d1c 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'grab', 'user': 'test'}
+  db038628b9e56f51a454c0da0c508df247b41748 417185465d2c68e575cff4cd6ed8a4047505ef24 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'prune', 'user': 'test'}
 
-Test graft --continue
+Test grab --continue
 
   $ hg up -qC 0
   $ echo 2 > 1
   $ hg ci -Am conflict 1
   created new head
   $ hg up -qC 6
-  $ hg graft -O 7
-  grafting 7:a5bfd90a2f29 "conflict" (tip)
+  $ hg grab -r 7
+  grabbing 7:a5bfd90a2f29 "conflict"
   merging 1
   warning: conflicts while merging 1! (edit, then use 'hg resolve --mark')
-  abort: unresolved conflicts, can't continue
-  (use 'hg resolve' and 'hg graft --continue')
-  [255]
+  unresolved merge conflicts (see hg help resolve)
+  [1]
   $ hg log -r7 --template '{rev}:{node|short} {obsolete}\n'
   7:a5bfd90a2f29 
   $ echo 3 > 1
   $ hg resolve -m 1
   (no more unresolved files)
-  continue: hg graft --continue
-  $ hg graft --continue -O
-  grafting 7:a5bfd90a2f29 "conflict" (tip)
+  continue: hg grab --continue
+  $ hg grab --continue
   $ glog --hidden
-  @  8:920e58bb443b@default(draft) conflict
+  @  8:fb2c0f0a0c54@default(draft) conflict
   |
   | x  7:a5bfd90a2f29@default(draft) conflict
   | |
-  o |  6:acb28cd497b7@default(draft) add 1
+  o |  6:417185465d2c@default(draft) add 1
   | |
-  o |  5:0b9e50c35132@default(draft) add 3
+  o |  5:fa455b5098e0@default(draft) add 3
   | |
   o |  4:ce341209337f@default(draft) add 4
   |/
@@ -661,18 +661,18 @@
   o  0:8685c6d34325@default(draft) add 0
   
   $ hg debugobsolete
-  0e84df4912da4c7cad22a3b4fcfd58ddfb7c8ae9 0b9e50c35132ff548ec0065caea6a87e1ebcef32 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'amend', 'user': 'test'}
-  db038628b9e56f51a454c0da0c508df247b41748 acb28cd497b7f8767e01ef70f68697a959573c2d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'amend', 'user': 'test'}
-  a5bfd90a2f29c7ccb8f917ff4e5013a9053d0a04 920e58bb443b73eea9d6d65570b4241051ea3229 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '12', 'operation': 'amend', 'user': 'test'}
+  0e84df4912da4c7cad22a3b4fcfd58ddfb7c8ae9 fa455b5098e0ce8c1871edf6369f32be7d8b4d1c 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'grab', 'user': 'test'}
+  db038628b9e56f51a454c0da0c508df247b41748 417185465d2c68e575cff4cd6ed8a4047505ef24 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'prune', 'user': 'test'}
+  a5bfd90a2f29c7ccb8f917ff4e5013a9053d0a04 fb2c0f0a0c54be4367988521bad2cbd33a540969 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '12', 'operation': 'grab', 'user': 'test'}
 
 Test touch
 
   $ glog
-  @  8:920e58bb443b@default(draft) conflict
+  @  8:fb2c0f0a0c54@default(draft) conflict
   |
-  o  6:acb28cd497b7@default(draft) add 1
+  o  6:417185465d2c@default(draft) add 1
   |
-  o  5:0b9e50c35132@default(draft) add 3
+  o  5:fa455b5098e0@default(draft) add 3
   |
   o  4:ce341209337f@default(draft) add 4
   |
@@ -684,9 +684,9 @@
   $ glog
   @  9:*@default(draft) conflict (glob)
   |
-  o  6:acb28cd497b7@default(draft) add 1
+  o  6:417185465d2c@default(draft) add 1
   |
-  o  5:0b9e50c35132@default(draft) add 3
+  o  5:fa455b5098e0@default(draft) add 3
   |
   o  4:ce341209337f@default(draft) add 4
   |
@@ -698,9 +698,9 @@
   $ glog
   @  10:*@default(draft) conflict (glob)
   |
-  o  6:acb28cd497b7@default(draft) add 1
+  o  6:417185465d2c@default(draft) add 1
   |
-  o  5:0b9e50c35132@default(draft) add 3
+  o  5:fa455b5098e0@default(draft) add 3
   |
   o  4:ce341209337f@default(draft) add 4
   |
@@ -765,14 +765,14 @@
   $ hg olog | head -n 10 # hg touch makes the output unstable (fix it with devel option for more stable touch)
   @    d26d339c513f (12) add 4
   |\
-  x |    af636757ce3b (11) add 3
-  |\ \     rewritten(description, user, parent, content) as d26d339c513f using fold by test (Thu Jan 01 00:00:00 1970 +0000)
-  | | |
-  | \ \
-  | |\ \
-  | | | x  ce341209337f (4) add 4
-  | | |      rewritten(description, user, content) as d26d339c513f using fold by test (Thu Jan 01 00:00:00 1970 +0000)
-  | | |
+  x |  ce341209337f (4) add 4
+   /     rewritten(description, user, content) as d26d339c513f using fold by test (Thu Jan 01 00:00:00 1970 +0000)
+  |
+  x    cf0c3904643c (11) add 3
+  |\     rewritten(description, user, parent, content) as d26d339c513f using fold by test (Thu Jan 01 00:00:00 1970 +0000)
+  | |
+  | \
+  | |\
 
 Test obsstore stat
 
@@ -793,7 +793,7 @@
           smallest length:           90
           longer length:             92
           median length:             91
-          mean length:               91
+          mean length:               90
       format v0:
           smallest length:           * (glob)
           longer length:             * (glob)