Submitter | timeless@mozdev.org |
---|---|
Date | Feb. 26, 2016, 7:02 p.m. |
Message ID | <795e4acf6b27e8b1bff1.1456513338@waste.org> |
Download | mbox | patch |
Permalink | /patch/13426/ |
State | Superseded |
Commit | f6b5b041c6c9a0d33bbc4115d47cafc4ff701411 |
Headers | show |
Comments
On 02/26/2016 08:02 PM, timeless wrote: > # HG changeset patch > # User timeless <timeless@mozdev.org> > # Date 1455435350 0 > # Sun Feb 14 07:35:50 2016 +0000 > # Node ID 795e4acf6b27e8b1bff19bb1d479f5229a29bfcd > # Parent 41dcd754526612c43b9695df8851557c851828ef > commit: block amend while histedit is in progress (issue4800) > > 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. Most of this changeset description, should be moved as inline comment next to this new guard. Because the next poor soul looking at it will be confused about the why and will wonder if this can be lifted. Can you get us a V3 o:-) (also see my comment regarding your test) > diff --git a/mercurial/commands.py b/mercurial/commands.py > --- a/mercurial/commands.py > +++ b/mercurial/commands.py > @@ -1681,6 +1681,8 @@ > allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt) > if not allowunstable and old.children(): > raise error.Abort(_('cannot amend changeset with children')) > + 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): > 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 > @@ -450,3 +450,42 @@ > > 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] Can you put a small comment in the test here to indicate you are testing another aspect of this behavior? > + $ cat >>$HGRCPATH <<EOF > + > [experimental] > + > evolution=createmarkers,allowunstable > + > EOF > + $ hg commit --amend -m 'allow this fold' > + $ hg histedit --continue Cheers,
Patch
diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1681,6 +1681,8 @@ allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt) if not allowunstable and old.children(): raise error.Abort(_('cannot amend changeset with children')) + 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): 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 @@ -450,3 +450,42 @@ > 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] + $ cat >>$HGRCPATH <<EOF + > [experimental] + > evolution=createmarkers,allowunstable + > EOF + $ hg commit --amend -m 'allow this fold' + $ hg histedit --continue