##// END OF EJS Templates
annotate: rename {line_number} to {lineno} (BC)...
Yuya Nishihara -
r39965:47cb6750 default
parent child Browse files
Show More
@@ -342,9 +342,10 b' def annotate(ui, repo, *pats, **opts):'
342 ('node', ' ', lambda x: hex(scmutil.binnode(x.fctx)), formathex),
342 ('node', ' ', lambda x: hex(scmutil.binnode(x.fctx)), formathex),
343 ('date', ' ', lambda x: x.fctx.date(), util.cachefunc(datefunc)),
343 ('date', ' ', lambda x: x.fctx.date(), util.cachefunc(datefunc)),
344 ('path', ' ', lambda x: x.fctx.path(), pycompat.bytestr),
344 ('path', ' ', lambda x: x.fctx.path(), pycompat.bytestr),
345 ('line_number', ':', lambda x: x.lineno, pycompat.bytestr),
345 ('lineno', ':', lambda x: x.lineno, pycompat.bytestr),
346 ]
346 ]
347 opnamemap = {'rev': 'number', 'node': 'changeset', 'path': 'file'}
347 opnamemap = {'rev': 'number', 'node': 'changeset', 'path': 'file',
348 'lineno': 'line_number'}
348
349
349 if (not opts.get('user') and not opts.get('changeset')
350 if (not opts.get('user') and not opts.get('changeset')
350 and not opts.get('date') and not opts.get('file')):
351 and not opts.get('date') and not opts.get('file')):
@@ -64,7 +64,7 b' annotate (JSON)'
64 $ hg annotate -Tjson -cdfnul a
64 $ hg annotate -Tjson -cdfnul a
65 [
65 [
66 {
66 {
67 "lines": [{"date": [1.0, 0], "line": "a\n", "line_number": 1, "node": "8435f90966e442695d2ded29fdade2bac5ad8065", "path": "a", "rev": 0, "user": "nobody"}],
67 "lines": [{"date": [1.0, 0], "line": "a\n", "lineno": 1, "node": "8435f90966e442695d2ded29fdade2bac5ad8065", "path": "a", "rev": 0, "user": "nobody"}],
68 "path": "a"
68 "path": "a"
69 }
69 }
70 ]
70 ]
@@ -74,12 +74,12 b' log-like templating'
74 $ hg annotate -T'{lines % "{rev} {node|shortest}: {line}"}' a
74 $ hg annotate -T'{lines % "{rev} {node|shortest}: {line}"}' a
75 0 8435: a
75 0 8435: a
76
76
77 '{line_number}' field should be populated as necessary
77 '{lineno}' field should be populated as necessary
78
78
79 $ hg annotate -T'{lines % "{rev}:{line_number}: {line}"}' a
79 $ hg annotate -T'{lines % "{rev}:{lineno}: {line}"}' a
80 0:1: a
80 0:1: a
81 $ hg annotate -Ta a \
81 $ hg annotate -Ta a \
82 > --config templates.a='"{lines % "{rev}:{line_number}: {line}"}"'
82 > --config templates.a='"{lines % "{rev}:{lineno}: {line}"}"'
83 0:1: a
83 0:1: a
84
84
85 $ cat <<EOF >>a
85 $ cat <<EOF >>a
@@ -77,7 +77,7 b' annotate (JSON)'
77 $ hg annotate -Tjson -cdfnul a
77 $ hg annotate -Tjson -cdfnul a
78 [
78 [
79 {
79 {
80 "lines": [{"date": [1.0, 0], "line": "a\n", "line_number": 1, "node": "8435f90966e442695d2ded29fdade2bac5ad8065", "path": "a", "rev": 0, "user": "nobody"}],
80 "lines": [{"date": [1.0, 0], "line": "a\n", "lineno": 1, "node": "8435f90966e442695d2ded29fdade2bac5ad8065", "path": "a", "rev": 0, "user": "nobody"}],
81 "path": "a"
81 "path": "a"
82 }
82 }
83 ]
83 ]
General Comments 0
You need to be logged in to leave comments. Login now