##// END OF EJS Templates
command line templates: add formatnode filter...
Alexis S. L. Carvalho -
r4352:051fb8c2 default
parent child Browse files
Show More
@@ -325,10 +325,14 b' class changeset_templater(changeset_prin'
325
325
326 def __init__(self, ui, repo, patch, brinfo, mapfile, buffered):
326 def __init__(self, ui, repo, patch, brinfo, mapfile, buffered):
327 changeset_printer.__init__(self, ui, repo, patch, brinfo, buffered)
327 changeset_printer.__init__(self, ui, repo, patch, brinfo, buffered)
328 self.t = templater.templater(mapfile, templater.common_filters,
328 filters = templater.common_filters.copy()
329 cache={'parent': '{rev}:{node|short} ',
329 filters['formatnode'] = (ui.debugflag and (lambda x: x)
330 'manifest': '{rev}:{node|short}',
330 or (lambda x: x[:12]))
331 'filecopy': '{name} ({source})'})
331 self.t = templater.templater(mapfile, filters,
332 cache={
333 'parent': '{rev}:{node|formatnode} ',
334 'manifest': '{rev}:{node|formatnode}',
335 'filecopy': '{name} ({source})'})
332
336
333 def use_template(self, t):
337 def use_template(self, t):
334 '''set template string to use'''
338 '''set template string to use'''
@@ -1,4 +1,4 b''
1 changeset = 'changeset: {rev}:{node|short}\n{branches}{tags}{short_parents}user: {author}\ndate: {date|date}\nsummary: {desc|firstline}\n\n'
1 changeset = 'changeset: {rev}:{node|short}\n{branches}{tags}{parents}user: {author}\ndate: {date|date}\nsummary: {desc|firstline}\n\n'
2 changeset_quiet = '{rev}:{node|short}\n'
2 changeset_quiet = '{rev}:{node|short}\n'
3 changeset_verbose = 'changeset: {rev}:{node|short}\n{branches}{tags}{parents}{manifest}user: {author}\ndate: {date|date}\n{files}{file_adds}{file_dels}{file_copies}description:\n{desc|strip}\n\n\n'
3 changeset_verbose = 'changeset: {rev}:{node|short}\n{branches}{tags}{parents}{manifest}user: {author}\ndate: {date|date}\n{files}{file_adds}{file_dels}{file_copies}description:\n{desc|strip}\n\n\n'
4 changeset_debug = 'changeset: {rev}:{node}\n{branches}{tags}{parents}{manifest}user: {author}\ndate: {date|date}\n{files}{file_adds}{file_dels}{file_copies}{extras}description:\n{desc|strip}\n\n\n'
4 changeset_debug = 'changeset: {rev}:{node}\n{branches}{tags}{parents}{manifest}user: {author}\ndate: {date|date}\n{files}{file_adds}{file_dels}{file_copies}{extras}description:\n{desc|strip}\n\n\n'
@@ -14,8 +14,7 b" end_file_dels = '\\n'"
14 start_file_copies = 'copies: '
14 start_file_copies = 'copies: '
15 file_copy = ' {name} ({source})'
15 file_copy = ' {name} ({source})'
16 end_file_copies = '\n'
16 end_file_copies = '\n'
17 short_parent = 'parent: {rev}:{node|short}\n'
17 parent = 'parent: {rev}:{node|formatnode}\n'
18 parent = 'parent: {rev}:{node}\n'
19 manifest = 'manifest: {rev}:{node}\n'
18 manifest = 'manifest: {rev}:{node}\n'
20 branch = 'branch: {branch}\n'
19 branch = 'branch: {branch}\n'
21 tag = 'tag: {tag}\n'
20 tag = 'tag: {tag}\n'
@@ -96,6 +96,16 b" hg log --template '{date|rfc822date}\\n'"
96 hg log --template '{desc|firstline}\n'
96 hg log --template '{desc|firstline}\n'
97 hg log --template '{node|short}\n'
97 hg log --template '{node|short}\n'
98
98
99 echo '# formatnode filter works'
100 echo '# quiet'
101 hg -q log -r 0 --template '#node|formatnode#\n'
102 echo '# normal'
103 hg log -r 0 --template '#node|formatnode#\n'
104 echo '# verbose'
105 hg -v log -r 0 --template '#node|formatnode#\n'
106 echo '# debug'
107 hg --debug log -r 0 --template '#node|formatnode#\n'
108
99 echo '# error on syntax'
109 echo '# error on syntax'
100 echo 'x = "f' >> t
110 echo 'x = "f' >> t
101 hg log
111 hg log
@@ -230,11 +230,11 b' manifest--verbose:'
230 manifest--verbose:
230 manifest--verbose:
231 manifest--verbose:
231 manifest--verbose:
232 manifest--verbose:
232 manifest--verbose:
233 manifest--debug: 4:90ae8dda64e1
233 manifest--debug: 4:90ae8dda64e1a876c792bccb9af66284f6018363
234 manifest--debug: 3:cb5a1327723b
234 manifest--debug: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc
235 manifest--debug: 2:6e0e82995c35
235 manifest--debug: 2:6e0e82995c35d0d57a52aca8da4e56139e06b4b1
236 manifest--debug: 1:4e8d705b1e53
236 manifest--debug: 1:4e8d705b1e53e3f9375e0e60dc7b525d8211fe55
237 manifest--debug: 0:a0c8bcbbb45c
237 manifest--debug: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0
238 node: 32a18f097fcccf76ef282f62f8a85b3adf8d13c4
238 node: 32a18f097fcccf76ef282f62f8a85b3adf8d13c4
239 node: 10e46f2dcbf4823578cf180f33ecf0b957964c47
239 node: 10e46f2dcbf4823578cf180f33ecf0b957964c47
240 node: 97054abb4ab824450e9164180baf491ae0078465
240 node: 97054abb4ab824450e9164180baf491ae0078465
@@ -260,11 +260,11 b' parents--verbose:'
260 parents--verbose:
260 parents--verbose:
261 parents--verbose:
261 parents--verbose:
262 parents--verbose:
262 parents--verbose:
263 parents--debug: 3:10e46f2dcbf4 -1:000000000000
263 parents--debug: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47 -1:0000000000000000000000000000000000000000
264 parents--debug: 2:97054abb4ab8 -1:000000000000
264 parents--debug: 2:97054abb4ab824450e9164180baf491ae0078465 -1:0000000000000000000000000000000000000000
265 parents--debug: 1:b608e9d1a3f0 -1:000000000000
265 parents--debug: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965 -1:0000000000000000000000000000000000000000
266 parents--debug: 0:1e4e1b8f71e0 -1:000000000000
266 parents--debug: 0:1e4e1b8f71e05681d422154f5421e385fec3454f -1:0000000000000000000000000000000000000000
267 parents--debug: -1:000000000000 -1:000000000000
267 parents--debug: -1:0000000000000000000000000000000000000000 -1:0000000000000000000000000000000000000000
268 rev: 4
268 rev: 4
269 rev: 3
269 rev: 3
270 rev: 2
270 rev: 2
@@ -336,6 +336,15 b' 10e46f2dcbf4'
336 97054abb4ab8
336 97054abb4ab8
337 b608e9d1a3f0
337 b608e9d1a3f0
338 1e4e1b8f71e0
338 1e4e1b8f71e0
339 # formatnode filter works
340 # quiet
341 1e4e1b8f71e0
342 # normal
343 1e4e1b8f71e0
344 # verbose
345 1e4e1b8f71e0
346 # debug
347 1e4e1b8f71e05681d422154f5421e385fec3454f
339 # error on syntax
348 # error on syntax
340 abort: t:3: unmatched quotes
349 abort: t:3: unmatched quotes
341 # done
350 # done
General Comments 0
You need to be logged in to leave comments. Login now