[PATCH STABLE] histedit: fix --edit-plan
Durham Goode
durham at fb.com
Mon May 4 19:57:49 UTC 2015
# HG changeset patch
# User Durham Goode <durham at fb.com>
# Date 1429743183 25200
# Wed Apr 22 15:53:03 2015 -0700
# Node ID 10e58e9637db75481660ca00c09ac702ad68f4bc
# Parent e5b507efb36e2b9ad8edb1a38459d26c934d74dd
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.
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -747,7 +747,8 @@ def _histedit(ui, repo, state, *freeargs
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 == '-':
diff --git a/tests/test-histedit-edit.t b/tests/test-histedit-edit.t
--- a/tests/test-histedit-edit.t
+++ b/tests/test-histedit-edit.t
@@ -70,12 +70,51 @@ edit the history
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
More information about the Mercurial-devel
mailing list