Mercurial > hg
comparison mercurial/commands.py @ 1016:836667830fee
Teach annotate about binary files
author | mpm@selenic.com |
---|---|
date | Tue, 23 Aug 2005 20:21:52 -0700 |
parents | 22571b8d35d3 |
children | 28e2f13ca7c4 |
comparison
equal
deleted
inserted
replaced
1015:22571b8d35d3 | 1016:836667830fee |
---|---|
431 node = repo.changelog.lookup(opts['rev']) | 431 node = repo.changelog.lookup(opts['rev']) |
432 else: | 432 else: |
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: |
445 if opts[o]: | 451 if opts[o]: |
446 l = [f(n) for n, dummy in lines] | 452 l = [f(n) for n, dummy in lines] |
1283 ('X', 'exclude', [], 'exclude path from search')], | 1289 ('X', 'exclude', [], 'exclude path from search')], |
1284 "hg addremove [OPTION]... [FILE]..."), | 1290 "hg addremove [OPTION]... [FILE]..."), |
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'), |
1291 ('I', 'include', [], 'include path in search'), | 1298 ('I', 'include', [], 'include path in search'), |
1292 ('X', 'exclude', [], 'exclude path from search')], | 1299 ('X', 'exclude', [], 'exclude path from search')], |