1440 class changeset_templater(changeset_printer): |
1440 class changeset_templater(changeset_printer): |
1441 '''format changeset information.''' |
1441 '''format changeset information.''' |
1442 |
1442 |
1443 def __init__(self, ui, repo, matchfn, diffopts, tmpl, mapfile, buffered): |
1443 def __init__(self, ui, repo, matchfn, diffopts, tmpl, mapfile, buffered): |
1444 changeset_printer.__init__(self, ui, repo, matchfn, diffopts, buffered) |
1444 changeset_printer.__init__(self, ui, repo, matchfn, diffopts, buffered) |
1445 formatnode = ui.debugflag and (lambda x: x) or (lambda x: x[:12]) |
|
1446 filters = {'formatnode': formatnode} |
|
1447 defaulttempl = { |
1445 defaulttempl = { |
1448 'parent': '{rev}:{node|formatnode} ', |
1446 'parent': '{rev}:{node|formatnode} ', |
1449 'manifest': '{rev}:{node|formatnode}', |
1447 'manifest': '{rev}:{node|formatnode}', |
1450 'file_copy': '{name} ({source})', |
1448 'file_copy': '{name} ({source})', |
1451 'envvar': '{key}={value}', |
1449 'envvar': '{key}={value}', |
1453 } |
1451 } |
1454 # filecopy is preserved for compatibility reasons |
1452 # filecopy is preserved for compatibility reasons |
1455 defaulttempl['filecopy'] = defaulttempl['file_copy'] |
1453 defaulttempl['filecopy'] = defaulttempl['file_copy'] |
1456 assert not (tmpl and mapfile) |
1454 assert not (tmpl and mapfile) |
1457 if mapfile: |
1455 if mapfile: |
1458 self.t = templater.templater.frommapfile(mapfile, filters=filters, |
1456 self.t = templater.templater.frommapfile(mapfile, |
1459 cache=defaulttempl) |
1457 cache=defaulttempl) |
1460 else: |
1458 else: |
1461 self.t = formatter.maketemplater(ui, 'changeset', tmpl, |
1459 self.t = formatter.maketemplater(ui, 'changeset', tmpl, |
1462 filters=filters, |
|
1463 cache=defaulttempl) |
1460 cache=defaulttempl) |
1464 |
1461 |
1465 self.cache = {} |
1462 self.cache = {} |
1466 |
1463 |
1467 # find correct templates for current mode |
1464 # find correct templates for current mode |