##// END OF EJS Templates
Teach annotate about binary files
mpm@selenic.com -
r1016:83666783 default
parent child Browse files
Show More
@@ -72,7 +72,12 b' annotate [-r <rev> -u -n -c] [files ...]'
72 This command is useful to discover who did a change or when a change took
72 This command is useful to discover who did a change or when a change took
73 place.
73 place.
74
74
75 Without the -a option, annotate will avoid processing files it
76 detects as binary. With -a, annotate will generate an annotation
77 anyway, probably with undesirable results.
78
75 options:
79 options:
80 -a, --text treat all files as text
76 -I, --include <pat> include names matching the given patterns
81 -I, --include <pat> include names matching the given patterns
77 -X, --exclude <pat> exclude names matching the given patterns
82 -X, --exclude <pat> exclude names matching the given patterns
78 -r, --revision <rev> annotate the specified revision
83 -r, --revision <rev> annotate the specified revision
@@ -433,12 +433,18 b' def annotate(ui, repo, *pats, **opts):'
433 node = repo.dirstate.parents()[0]
433 node = repo.dirstate.parents()[0]
434 change = repo.changelog.read(node)
434 change = repo.changelog.read(node)
435 mmap = repo.manifest.read(change[0])
435 mmap = repo.manifest.read(change[0])
436
436 for src, abs, rel, exact in walk(repo, pats, opts):
437 for src, abs, rel, exact in walk(repo, pats, opts):
437 if abs not in mmap:
438 if abs not in mmap:
438 ui.warn("warning: %s is not in the repository!\n" % rel)
439 ui.warn("warning: %s is not in the repository!\n" % rel)
439 continue
440 continue
440
441
441 lines = repo.file(abs).annotate(mmap[abs])
442 f = repo.file(abs)
443 if not opts['text'] and util.binary(f.read(mmap[abs])):
444 ui.write("%s: binary file\n" % rel)
445 continue
446
447 lines = f.annotate(mmap[abs])
442 pieces = []
448 pieces = []
443
449
444 for o, f in opmap:
450 for o, f in opmap:
@@ -1285,6 +1291,7 b' table = {'
1285 "^annotate":
1291 "^annotate":
1286 (annotate,
1292 (annotate,
1287 [('r', 'rev', '', 'revision'),
1293 [('r', 'rev', '', 'revision'),
1294 ('a', 'text', None, 'treat all files as text'),
1288 ('u', 'user', None, 'show user'),
1295 ('u', 'user', None, 'show user'),
1289 ('n', 'number', None, 'show revision number'),
1296 ('n', 'number', None, 'show revision number'),
1290 ('c', 'changeset', None, 'show changeset'),
1297 ('c', 'changeset', None, 'show changeset'),
General Comments 0
You need to be logged in to leave comments. Login now