mq: forbid commit of merge involving mq patches

This commit is contained in:
Martin Geisler 2011-03-02 14:09:06 +01:00
parent 9b2d3c510c
commit 3334dc51b6
2 changed files with 32 additions and 7 deletions

View File

@ -2921,8 +2921,9 @@ def reposetup(ui, repo):
def abort_if_wdir_patched(self, errmsg, force=False):
if self.mq.applied and not force:
parent = self.dirstate.parents()[0]
if parent in [s.node for s in self.mq.applied]:
parents = self.dirstate.parents()
patches = [s.node for s in self.mq.applied]
if parents[0] in patches or parents[1] in patches:
raise util.Abort(errmsg)
def commit(self, text="", user=None, date=None, match=None,

View File

@ -1,3 +1,32 @@
Setup extension:
$ echo "[extensions]" >> $HGRCPATH
$ echo "mq =" >> $HGRCPATH
$ echo "[mq]" >> $HGRCPATH
$ echo "git = keep" >> $HGRCPATH
Test merge with mq changeset as the second parent:
$ hg init m
$ cd m
$ touch a b c
$ hg add a
$ hg commit -m a
$ hg add b
$ hg qnew -d "0 0" b
$ hg update 0
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ hg add c
$ hg commit -m c
created new head
$ hg merge
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg commit -m merge
abort: cannot commit over an applied mq patch
[255]
$ cd ..
Issue529: mq aborts when merging patch deleting files
$ checkundo()
@ -7,11 +36,6 @@ Issue529: mq aborts when merging patch deleting files
> fi
> }
$ echo "[extensions]" >> $HGRCPATH
$ echo "mq =" >> $HGRCPATH
$ echo "[mq]" >> $HGRCPATH
$ echo "git = keep" >> $HGRCPATH
Commit two dummy files in "init" changeset:
$ hg init t