diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -610,15 +610,14 @@ class queue: m, a, r, d = repo.status(files=fns, match=match)[:4] else: m, a, r, d = self.check_localchanges(repo, force) + fns, match, anypats = cmdutil.matchpats(repo, m + a + r) commitfiles = m + a + r self.check_toppatch(repo) wlock = repo.wlock() try: insert = self.full_series_end() - if msg: - n = repo.commit(commitfiles, msg, force=True) - else: - n = repo.commit(commitfiles, "[mq]: %s" % patch, force=True) + commitmsg = msg and msg or ("[mq]: %s" % patch) + n = repo.commit(commitfiles, commitmsg, match=match, force=True) if n == None: raise util.Abort(_("repo commit failed")) self.full_series[insert:insert] = [patch] diff --git a/tests/test-mq b/tests/test-mq --- a/tests/test-mq +++ b/tests/test-mq @@ -84,6 +84,27 @@ cd .. cd a +echo a > somefile +hg add somefile + +echo % qnew with uncommitted changes + +hg qnew uncommitted.patch +hg st +hg qseries + +echo '% qnew with uncommitted changes and missing file (issue 803)' + +hg qnew issue803.patch someotherfile 2>&1 | \ + sed -e 's/someotherfile:.*/someotherfile: No such file or directory/' +hg st +hg qseries +hg qpop -f +hg qdel issue803.patch + +hg revert --no-backup somefile +rm somefile + echo % qnew -m hg qnew -m 'foo bar' test.patch diff --git a/tests/test-mq.out b/tests/test-mq.out --- a/tests/test-mq.out +++ b/tests/test-mq.out @@ -83,6 +83,14 @@ bleh series: A B +% qnew with uncommitted changes +abort: local changes found, refresh first +A somefile +% qnew with uncommitted changes and missing file (issue 803) +someotherfile: No such file or directory +A somefile +issue803.patch +Patch queue now empty % qnew -m foo bar % qrefresh