annotate: catch nonexistent files using match.bad callback (issue1590)
authorMatt Mackall <mpm@selenic.com>
Sat, 19 Mar 2011 01:34:49 -0500
changeset 13697 eaee75036725
parent 13696 136854393eed
child 13698 f30ce5983896
annotate: catch nonexistent files using match.bad callback (issue1590)
mercurial/commands.py
tests/test-annotate.t
--- a/mercurial/commands.py	Fri Mar 18 13:01:18 2011 -0500
+++ b/mercurial/commands.py	Sat Mar 19 01:34:49 2011 -0500
@@ -126,8 +126,12 @@
         lastfunc = funcmap[-1]
         funcmap[-1] = lambda x: "%s:%s" % (lastfunc(x), x[1])
 
+    def bad(x, y):
+        raise util.Abort("%s: %s" % (x, y))
+
     ctx = cmdutil.revsingle(repo, opts.get('rev'))
     m = cmdutil.match(repo, pats, opts)
+    m.bad = bad
     follow = not opts.get('no_follow')
     for abs in ctx.walk(m):
         fctx = ctx[abs]
--- a/tests/test-annotate.t	Fri Mar 18 13:01:18 2011 -0500
+++ b/tests/test-annotate.t	Sat Mar 19 01:34:49 2011 -0500
@@ -228,3 +228,8 @@
   $ hg annotate --follow foo
   foo: foo
 
+missing file
+
+  $ hg ann nosuchfile
+  abort: nosuchfile: no such file in rev c8abddb41a00
+  [255]