Mercurial > hg
changeset 28359:f6b5b041c6c9
commit: block amend while histedit is in progress (issue4800)
author | timeless <timeless@mozdev.org> |
---|---|
date | Sun, 14 Feb 2016 07:35:50 +0000 |
parents | ffd3ac07b1d7 |
children | 11287888ce4b |
files | mercurial/commands.py tests/test-histedit-arguments.t |
diffstat | 2 files changed, 52 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Wed Mar 02 10:42:58 2016 +0000 +++ b/mercurial/commands.py Sun Feb 14 07:35:50 2016 +0000 @@ -1720,6 +1720,15 @@ if not allowunstable and old.children(): raise error.Abort(_('cannot amend changeset with children')) + # Currently histedit gets confused if an amend happens while histedit + # is in progress. Since we have a checkunfinished command, we are + # temporarily honoring it. + # + # Note: eventually this guard will be removed. Please do not expect + # this behavior to remain. + if not obsolete.isenabled(repo, obsolete.createmarkersopt): + cmdutil.checkunfinished(repo) + # commitfunc is used only for temporary amend commit by cmdutil.amend def commitfunc(ui, repo, message, match, opts): return repo.commit(message,
--- a/tests/test-histedit-arguments.t Wed Mar 02 10:42:58 2016 +0000 +++ b/tests/test-histedit-arguments.t Sun Feb 14 07:35:50 2016 +0000 @@ -450,3 +450,46 @@ > pick 6f2f0241f119 > pick 8cde254db839 > EOF + +commit --amend should abort if histedit is in progress +(issue4800) and markers are not being created. +Eventually, histedit could perhaps look at `source` extra, +in which case this test should be revisited. + + $ hg -q up 8cde254db839 + $ hg histedit 6f2f0241f119 --commands - <<EOF + > pick 8cde254db839 + > edit 6f2f0241f119 + > EOF + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + merging foo + warning: conflicts while merging foo! (edit, then use 'hg resolve --mark') + Fix up the change (pick 8cde254db839) + (hg histedit --continue to resume) + [1] + $ hg resolve -m --all + (no more unresolved files) + continue: hg histedit --continue + $ hg histedit --cont + merging foo + warning: conflicts while merging foo! (edit, then use 'hg resolve --mark') + Editing (6f2f0241f119), you may commit or record as needed now. + (hg histedit --continue to resume) + [1] + $ hg resolve -m --all + (no more unresolved files) + continue: hg histedit --continue + $ hg commit --amend -m 'reject this fold' + abort: histedit in progress + (use 'hg histedit --continue' or 'hg histedit --abort') + [255] + +With markers enabled, histedit does not get confused, and +amend should not be blocked by the ongoing histedit. + + $ cat >>$HGRCPATH <<EOF + > [experimental] + > evolution=createmarkers,allowunstable + > EOF + $ hg commit --amend -m 'allow this fold' + $ hg histedit --continue