mq: abort qnew -f if any file in an explicit list cannot be read
authorBrendan Cully <brendan@kublai.com>
Sat, 18 Oct 2008 20:45:53 -0700
changeset 7161 b420ef2c812b
parent 7160 1b7b21b634f2
child 7162 ce10a2f22258
mq: abort qnew -f if any file in an explicit list cannot be read
hgext/mq.py
tests/test-mq
tests/test-mq.out
--- a/hgext/mq.py	Sat Oct 18 17:29:45 2008 -0700
+++ b/hgext/mq.py	Sat Oct 18 20:45:53 2008 -0700
@@ -655,6 +655,10 @@
             raise util.Abort(_('patch "%s" already exists') % patch)
         if opts.get('include') or opts.get('exclude') or pats:
             match = cmdutil.match(repo, pats, opts)
+            # detect missing files in pats
+            def badfn(f, msg):
+                raise util.Abort('%s: %s' % (f, msg))
+            match.bad = badfn
             m, a, r, d = repo.status(match=match)[:4]
         else:
             m, a, r, d = self.check_localchanges(repo, force)
--- a/tests/test-mq	Sat Oct 18 17:29:45 2008 -0700
+++ b/tests/test-mq	Sat Oct 18 20:45:53 2008 -0700
@@ -99,14 +99,8 @@
 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
+echo '% qnew missing'
+hg qnew missing.patch missing
 
 hg revert --no-backup somefile
 rm somefile
--- a/tests/test-mq.out	Sat Oct 18 17:29:45 2008 -0700
+++ b/tests/test-mq.out	Sat Oct 18 20:45:53 2008 -0700
@@ -99,12 +99,8 @@
 % 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
-someotherfile: No such file or directory
-A somefile
-issue803.patch
-Patch queue now empty
+% qnew missing
+abort: missing: No such file or directory
 % qnew -m
 foo bar
 % qrefresh