diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -770,6 +770,10 @@ class queue(object): 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() diff --git a/tests/test-mq-qnew b/tests/test-mq-qnew --- a/tests/test-mq-qnew +++ b/tests/test-mq-qnew @@ -58,3 +58,19 @@ cat ../.hg/patches/p 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 diff --git a/tests/test-mq-qnew.out b/tests/test-mq-qnew.out --- a/tests/test-mq-qnew.out +++ b/tests/test-mq-qnew.out @@ -35,3 +35,13 @@ diff --git a/d/b b/d/b % 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