Show More
@@ -19,6 +19,8 b' from .node import (' | |||
|
19 | 19 | nullid, |
|
20 | 20 | nullrev, |
|
21 | 21 | short, |
|
22 | wdirhex, | |
|
23 | wdirrev, | |
|
22 | 24 | ) |
|
23 | 25 | from . import ( |
|
24 | 26 | archival, |
@@ -313,37 +315,31 b' def annotate(ui, repo, *pats, **opts):' | |||
|
313 | 315 | else: |
|
314 | 316 | datefunc = dateutil.datestr |
|
315 | 317 | if ctx.rev() is None: |
|
316 | def hexfn(node): | |
|
317 | if node is None: | |
|
318 | return None | |
|
319 | else: | |
|
320 | return hex(node) | |
|
321 | 318 | if opts.get('changeset'): |
|
322 | 319 | # omit "+" suffix which is appended to node hex |
|
323 | 320 | def formatrev(rev): |
|
324 |
if rev |
|
|
321 | if rev == wdirrev: | |
|
325 | 322 | return '%d' % ctx.p1().rev() |
|
326 | 323 | else: |
|
327 | 324 | return '%d' % rev |
|
328 | 325 | else: |
|
329 | 326 | def formatrev(rev): |
|
330 |
if rev |
|
|
327 | if rev == wdirrev: | |
|
331 | 328 | return '%d+' % ctx.p1().rev() |
|
332 | 329 | else: |
|
333 | 330 | return '%d ' % rev |
|
334 | 331 | def formathex(h): |
|
335 |
if h |
|
|
332 | if h == wdirhex: | |
|
336 | 333 | return '%s+' % shorthex(hex(ctx.p1().node())) |
|
337 | 334 | else: |
|
338 | 335 | return '%s ' % shorthex(h) |
|
339 | 336 | else: |
|
340 | hexfn = hex | |
|
341 | 337 | formatrev = b'%d'.__mod__ |
|
342 | 338 | formathex = shorthex |
|
343 | 339 | |
|
344 | 340 | opmap = [('user', ' ', lambda x: x.fctx.user(), ui.shortuser), |
|
345 |
('rev', ' ', lambda x: x.fctx |
|
|
346 |
('node', ' ', lambda x: hex |
|
|
341 | ('rev', ' ', lambda x: scmutil.intrev(x.fctx), formatrev), | |
|
342 | ('node', ' ', lambda x: hex(scmutil.binnode(x.fctx)), formathex), | |
|
347 | 343 | ('date', ' ', lambda x: x.fctx.date(), util.cachefunc(datefunc)), |
|
348 | 344 | ('path', ' ', lambda x: x.fctx.path(), pycompat.bytestr), |
|
349 | 345 | ('line_number', ':', lambda x: x.lineno, pycompat.bytestr), |
@@ -564,7 +564,7 b' annotate modified file' | |||
|
564 | 564 | $ hg annotate -ncr "wdir()" -Tjson foo |
|
565 | 565 | [ |
|
566 | 566 | { |
|
567 |
"lines": [{"line": "foo\n", "node": "472b18db256d1e8282064eab4bfdaf48cbfe83cd", "rev": 11}, {"line": "foofoo\n", "node": |
|
|
567 | "lines": [{"line": "foo\n", "node": "472b18db256d1e8282064eab4bfdaf48cbfe83cd", "rev": 11}, {"line": "foofoo\n", "node": "ffffffffffffffffffffffffffffffffffffffff", "rev": 2147483647}], | |
|
568 | 568 | "path": "foo" |
|
569 | 569 | } |
|
570 | 570 | ] |
@@ -569,7 +569,7 b' annotate modified file' | |||
|
569 | 569 | $ hg annotate -ncr "wdir()" -Tjson foo |
|
570 | 570 | [ |
|
571 | 571 | { |
|
572 |
"lines": [{"line": "foo\n", "node": "472b18db256d1e8282064eab4bfdaf48cbfe83cd", "rev": 11}, {"line": "foofoo\n", "node": |
|
|
572 | "lines": [{"line": "foo\n", "node": "472b18db256d1e8282064eab4bfdaf48cbfe83cd", "rev": 11}, {"line": "foofoo\n", "node": "ffffffffffffffffffffffffffffffffffffffff", "rev": 2147483647}], | |
|
573 | 573 | "path": "foo" |
|
574 | 574 | } |
|
575 | 575 | ] |
General Comments 0
You need to be logged in to leave comments.
Login now