[PATCH STABLE] histedit: fix keep during --continue

Durham Goode durham at fb.com
Fri May 29 03:49:39 UTC 2015


# HG changeset patch
# User Durham Goode <durham at fb.com>
# Date 1432870220 25200
#      Thu May 28 20:30:20 2015 -0700
# Branch stable
# Node ID 170ac339a0871ff4c33ed8e6a0eb15f83286db0c
# Parent  884ef09cf658cf565c056ff75e675665fe520044
histedit: fix keep during --continue

The --keep option was being serialized to the state file, but it wasn't actually
being used when running a histedit --continue. This fixes that.

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -741,7 +741,7 @@ def _histedit(ui, repo, state, *freeargs
 
 
     replacements = []
-    keep = opts.get('keep', False)
+    state.keep = opts.get('keep', False)
 
     # rebuild state
     if goal == 'continue':
@@ -810,7 +810,7 @@ def _histedit(ui, repo, state, *freeargs
                     'exactly one common root'))
             root = rr[0].node()
 
-        revs = between(repo, root, topmost, keep)
+        revs = between(repo, root, topmost, state.keep)
         if not revs:
             raise util.Abort(_('%s is not an ancestor of working directory') %
                              node.short(root))
@@ -834,7 +834,6 @@ def _histedit(ui, repo, state, *freeargs
 
         state.parentctxnode = parentctxnode
         state.rules = rules
-        state.keep = keep
         state.topmost = topmost
         state.replacements = replacements
 
@@ -870,7 +869,7 @@ def _histedit(ui, repo, state, *freeargs
                     for n in succs[1:]:
                         ui.debug(m % node.short(n))
 
-    if not keep:
+    if not state.keep:
         if mapping:
             movebookmarks(ui, repo, mapping, state.topmost, ntm)
             # TODO update mq state
diff --git a/tests/test-histedit-arguments.t b/tests/test-histedit-arguments.t
--- a/tests/test-histedit-arguments.t
+++ b/tests/test-histedit-arguments.t
@@ -295,3 +295,32 @@ Test that trimming description using mul
   #  m, mess = edit message without changing commit content
   #
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+Test --continue with --keep
+
+  $ hg strip -q -r . --config extensions.strip=
+  $ hg histedit '.^' -q --keep --commands - << EOF
+  > edit eb57da33312f 2 three
+  > pick f3cfcca30c44 4 x
+  > EOF
+  Make changes as needed, you may commit or record as needed now.
+  When you are finished, run hg histedit --continue to resume.
+  [1]
+  $ echo edit >> alpha
+  $ hg histedit -q --continue
+  $ hg log -G -T '{rev}:{node|short} {desc}'
+  @  6:8fda0c726bf2 x
+  |
+  o  5:63379946892c three
+  |
+  | o  4:f3cfcca30c44 x
+  | |
+  | | o  3:2a30f3cfee78 four
+  | |/   ***
+  | |    five
+  | o  2:eb57da33312f three
+  |/
+  o  1:579e40513370 two
+  |
+  o  0:6058cbb6cfd7 one
+  


More information about the Mercurial-devel mailing list