changeset 13697:eaee75036725

annotate: catch nonexistent files using match.bad callback (issue1590)
author Matt Mackall <mpm@selenic.com>
date Sat, 19 Mar 2011 01:34:49 -0500
parents 136854393eed
children f30ce5983896
files mercurial/commands.py tests/test-annotate.t
diffstat 2 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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]