merge with stable
authorMartin Geisler <mg@aragost.com>
Wed, 02 Mar 2011 14:23:22 +0100
changeset 13523 644166163116
parent 13522 7ac93ec49c2d (current diff)
parent 13520 9510ddf87c43 (diff)
child 13524 121c89dd7983
merge with stable
--- a/hgext/mq.py	Wed Mar 02 14:22:50 2011 +0100
+++ b/hgext/mq.py	Wed Mar 02 14:23:22 2011 +0100
@@ -2921,8 +2921,9 @@
 
         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,
--- a/tests/test-mq-merge.t	Wed Mar 02 14:22:50 2011 +0100
+++ b/tests/test-mq-merge.t	Wed Mar 02 14:23:22 2011 +0100
@@ -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 @@
   >     fi
   > }
 
-  $ echo "[extensions]" >> $HGRCPATH
-  $ echo "mq =" >> $HGRCPATH
-  $ echo "[mq]" >> $HGRCPATH
-  $ echo "git = keep" >> $HGRCPATH
-
 Commit two dummy files in "init" changeset:
 
   $ hg init t