[PATCH 4 of 8 evolve-ext, V2] metaedit: remove the code gating the new metaedit feature and test it

Mateusz Kwapich mitrandir at fb.com
Tue Dec 6 11:41:13 EST 2016


# HG changeset patch
# User Mateusz Kwapich <mitrandir at fb.com>
# Date 1481038866 28800
#      Tue Dec 06 07:41:06 2016 -0800
# Branch stable
# Node ID d4a8c386a14b3e455e60fffec7fb315f9629ff12
# Parent  2495e78f6db6bb8d885121c45c16b9ba9266d1a1
metaedit: remove the code gating the new metaedit feature and test it

diff --git a/hgext/evolve.py b/hgext/evolve.py
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -3220,17 +3220,6 @@ def metaedit(ui, repo, *revs, **opts):
         lock = repo.lock()
 
         revs = scmutil.revrange(repo, revs)
-        if not opts['fold'] and len(revs) > 1:
-            # TODO: handle multiple revisions. This is somewhat tricky because
-            # if we want to edit a series of commits:
-            #
-            #   a ---- b ---- c
-            #
-            # we need to rewrite a first, then directly rewrite b on top of the
-            # new a, then rewrite c on top of the new b. So we need to handle
-            # revisions in topological order.
-            raise error.Abort(_('editing multiple revisions without --fold is '
-                                'not currently supported'))
 
         if opts['fold']:
             root, head = _foldcheck(repo, revs)
diff --git a/tests/test-evolve.t b/tests/test-evolve.t
--- a/tests/test-evolve.t
+++ b/tests/test-evolve.t
@@ -1496,10 +1496,8 @@ check that metaedit respects allowunstab
   $ hg log --template '{rev}: {author}\n' -r .
   43: foobar
 
-TODO: support this
-  $ hg metaedit '.^::.'
-  abort: editing multiple revisions without --fold is not currently supported
-  [255]
+  $ HGEDITOR="sed -i'' -e 's/safely/quickly/g'" hg metaedit '.^::.'
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
   $ HGEDITOR=cat hg metaedit '.^::.' --fold
   HG: This is a fold of 2 changesets.
@@ -1507,9 +1505,9 @@ TODO: support this
   
   amended
   
-  HG: Commit message of changeset 43.
+  HG: Commit message of changeset 44.
   
-  will be evolved safely
+  will be evolved quickly
   
   
   
@@ -1524,16 +1522,17 @@ TODO: support this
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
   $ glog -r .
-  @  44:41bf1183869c at default(draft) amended
+  @  45:ca7a9e928b25 at default(draft) amended
   |
   ~
 
 no new commit is created here because the date is the same
   $ HGEDITOR=cat hg metaedit
+  HG: Commit message of changeset ca7a9e928b25
   amended
   
   
-  will be evolved safely
+  will be evolved quickly
   
   
   HG: Enter commit message.  Lines beginning with 'HG:' are removed.
@@ -1546,7 +1545,7 @@ no new commit is created here because th
   nothing changed
 
   $ glog -r '.^::.'
-  @  44:41bf1183869c at default(draft) amended
+  @  45:ca7a9e928b25 at default(draft) amended
   |
   o  36:43c3f5ef149f at default(draft) add uu
   |
@@ -1557,21 +1556,22 @@ TODO: don't create a new commit in this 
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg log -r '.^::.' --template '{rev}: {desc|firstline}\n'
   36: add uu
-  45: amended
+  46: amended
 
   $ hg up .^
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ hg metaedit --user foobar2 45
+  $ hg metaedit --user foobar2 46
   $ hg log --template '{rev}: {author}\n' -r '42:' --hidden
   42: test
   43: foobar
-  44: test
+  44: foobar
   45: test
-  46: foobar2
+  46: test
+  47: foobar2
   $ hg diff -r 45 -r 46 --hidden
 
 'fold' one commit
   $ hg metaedit 39 --fold --user foobar3
   1 changesets folded
-  $ hg log -r 47 --template '{rev}: {author}\n'
-  47: foobar3
+  $ hg log -r 48 --template '{rev}: {author}\n'
+  48: foobar3


More information about the Mercurial-devel mailing list