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