changeset 24920:b5eb01500696 stable

histedit: fix --edit-plan --edit-plan was completely broken from the command line because it used an old api that was not updated (it would crash with a stack trace). Let's update it and add tests to catch this.
author Durham Goode <durham@fb.com>
date Wed, 22 Apr 2015 15:53:03 -0700
parents a4ee6f774f14
children 41cd8171e58f
files hgext/histedit.py tests/test-histedit-edit.t
diffstat 2 files changed, 42 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/histedit.py	Thu Apr 30 22:40:18 2015 +0900
+++ b/hgext/histedit.py	Wed Apr 22 15:53:03 2015 -0700
@@ -747,7 +747,8 @@
     elif goal == 'edit-plan':
         state.read()
         if not rules:
-            comment = editcomment % (state.parentctx, node.short(state.topmost))
+            comment = editcomment % (node.short(state.parentctxnode),
+                                     node.short(state.topmost))
             rules = ruleeditor(repo, ui, state.rules, comment)
         else:
             if rules == '-':
--- a/tests/test-histedit-edit.t	Thu Apr 30 22:40:18 2015 +0900
+++ b/tests/test-histedit-edit.t	Wed Apr 22 15:53:03 2015 -0700
@@ -70,12 +70,51 @@
   Make changes as needed, you may commit or record as needed now.
   When you are finished, run hg histedit --continue to resume.
 
-edit the plan
+edit the plan via the editor
+  $ cat >> ../editplan.sh <<EOF
+  > cat > \$1 <<EOF2
+  > drop e860deea161a e
+  > drop 652413bf663e f
+  > drop 3c6a8ed2ebe8 g
+  > EOF2
+  > EOF
+  $ chmod a+x ../editplan.sh
+  $ HGEDITOR=../editplan.sh hg histedit --edit-plan
+  $ cat .hg/histedit-state
+  v1
+  055a42cdd88768532f9cf79daa407fc8d138de9b
+  3c6a8ed2ebe862cc949d2caa30775dd6f16fb799
+  False
+  3
+  drop
+  e860deea161a2f77de56603b340ebbb4536308ae
+  drop
+  652413bf663ef2a641cab26574e46d5f5a64a55a
+  drop
+  3c6a8ed2ebe862cc949d2caa30775dd6f16fb799
+  0
+  strip-backup/177f92b77385-0ebe6a8f-histedit.hg
+
+edit the plan via --commands
   $ hg histedit --edit-plan --commands - 2>&1 << EOF
   > edit e860deea161a e
   > pick 652413bf663e f
   > drop 3c6a8ed2ebe8 g
   > EOF
+  $ cat .hg/histedit-state
+  v1
+  055a42cdd88768532f9cf79daa407fc8d138de9b
+  3c6a8ed2ebe862cc949d2caa30775dd6f16fb799
+  False
+  3
+  edit
+  e860deea161a2f77de56603b340ebbb4536308ae
+  pick
+  652413bf663ef2a641cab26574e46d5f5a64a55a
+  drop
+  3c6a8ed2ebe862cc949d2caa30775dd6f16fb799
+  0
+  strip-backup/177f92b77385-0ebe6a8f-histedit.hg
 
 Go at a random point and try to continue