changeset 10114:3e7663b2f3fc stable

mq: qnew -f should reject merge working directories
author timeless <timeless@mozdev.org>
date Wed, 23 Dec 2009 13:09:11 +0100
parents 703db37d186b
children c23626384b7e 4b514a70ea72
files hgext/mq.py tests/test-mq-qnew tests/test-mq-qnew.out
diffstat 3 files changed, 30 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Tue Dec 22 00:50:03 2009 +0100
+++ b/hgext/mq.py	Wed Dec 23 13:09:11 2009 +0100
@@ -770,6 +770,10 @@
         else:
             m, a, r, d = self.check_localchanges(repo, force)
             match = cmdutil.matchfiles(repo, m + a + r)
+        if force:
+            p = repo[None].parents()
+            if len(p) > 1:
+                raise util.Abort(_('cannot manage merge changesets'))
         commitfiles = m + a + r
         self.check_toppatch(repo)
         insert = self.full_series_end()
--- a/tests/test-mq-qnew	Tue Dec 22 00:50:03 2009 +0100
+++ b/tests/test-mq-qnew	Wed Dec 23 13:09:11 2009 +0100
@@ -58,3 +58,19 @@
 echo '% qnew -u with no username configured'
 HGUSER= hg qnew -u blue red
 cat ../.hg/patches/red
+
+echo '% fail when trying to import a merge'
+hg init merge
+cd merge
+touch a
+hg ci -Am null
+echo a >> a
+hg ci -m a
+hg up -r 0
+echo b >> a
+hg ci -m b
+hg merge -f 1
+hg resolve --mark a
+hg qnew -f merge
+
+exit 0
--- a/tests/test-mq-qnew.out	Tue Dec 22 00:50:03 2009 +0100
+++ b/tests/test-mq-qnew.out	Wed Dec 23 13:09:11 2009 +0100
@@ -35,3 +35,13 @@
 % qnew -u with no username configured
 From: blue
 
+% fail when trying to import a merge
+adding a
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+created new head
+merging a
+warning: conflicts during merge.
+merging a failed!
+0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+use 'hg resolve' to retry unresolved file merges or 'hg update -C' to abandon
+abort: cannot manage merge changesets