Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 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 | 4f5ed2bd1724 |
children | 9c4e04fe267e |
comparison
equal
deleted
inserted
replaced
13696:136854393eed | 13697:eaee75036725 |
---|---|
124 funcmap = [func for op, func in opmap if opts.get(op)] | 124 funcmap = [func for op, func in opmap if opts.get(op)] |
125 if linenumber: | 125 if linenumber: |
126 lastfunc = funcmap[-1] | 126 lastfunc = funcmap[-1] |
127 funcmap[-1] = lambda x: "%s:%s" % (lastfunc(x), x[1]) | 127 funcmap[-1] = lambda x: "%s:%s" % (lastfunc(x), x[1]) |
128 | 128 |
129 def bad(x, y): | |
130 raise util.Abort("%s: %s" % (x, y)) | |
131 | |
129 ctx = cmdutil.revsingle(repo, opts.get('rev')) | 132 ctx = cmdutil.revsingle(repo, opts.get('rev')) |
130 m = cmdutil.match(repo, pats, opts) | 133 m = cmdutil.match(repo, pats, opts) |
134 m.bad = bad | |
131 follow = not opts.get('no_follow') | 135 follow = not opts.get('no_follow') |
132 for abs in ctx.walk(m): | 136 for abs in ctx.walk(m): |
133 fctx = ctx[abs] | 137 fctx = ctx[abs] |
134 if not opts.get('text') and util.binary(fctx.data()): | 138 if not opts.get('text') and util.binary(fctx.data()): |
135 ui.write(_("%s: binary file\n") % ((pats and m.rel(abs)) or abs)) | 139 ui.write(_("%s: binary file\n") % ((pats and m.rel(abs)) or abs)) |