# HG changeset patch # User Durham Goode # Date 2015-04-22 22:53:03 # Node ID b5eb01500696f941efe357817f05de5136b4cc80 # Parent a4ee6f774f14b68e8dc887745699ba6a2ae28355 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 < cat > \$1 < 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