Mercurial > public > mercurial-scm > hg
comparison mercurial/cmdutil.py @ 26083:027763aed157
templater: minor whitespace tweaks
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Tue, 25 Aug 2015 09:38:06 -0500 |
parents | 221491bbaf7e |
children | b029d029354a |
comparison
equal
deleted
inserted
replaced
26082:b188f60bd955 | 26083:027763aed157 |
---|---|
1439 props['repo'] = self.repo | 1439 props['repo'] = self.repo |
1440 props['revcache'] = {'copies': copies} | 1440 props['revcache'] = {'copies': copies} |
1441 props['cache'] = self.cache | 1441 props['cache'] = self.cache |
1442 | 1442 |
1443 # find correct templates for current mode | 1443 # find correct templates for current mode |
1444 | |
1445 tmplmodes = [ | 1444 tmplmodes = [ |
1446 (True, None), | 1445 (True, None), |
1447 (self.ui.verbose, 'verbose'), | 1446 (self.ui.verbose, 'verbose'), |
1448 (self.ui.quiet, 'quiet'), | 1447 (self.ui.quiet, 'quiet'), |
1449 (self.ui.debugflag, 'debug'), | 1448 (self.ui.debugflag, 'debug'), |
1450 ] | 1449 ] |
1451 | 1450 |
1452 types = {'header': '', 'footer':'', 'changeset': 'changeset'} | 1451 types = {'header': '', 'footer': '', 'changeset': 'changeset'} |
1453 for mode, postfix in tmplmodes: | 1452 for mode, postfix in tmplmodes: |
1454 for type in types: | 1453 for type in types: |
1455 cur = postfix and ('%s_%s' % (type, postfix)) or type | 1454 cur = postfix and ('%s_%s' % (type, postfix)) or type |
1456 if mode and cur in self.t: | 1455 if mode and cur in self.t: |
1457 types[type] = cur | 1456 types[type] = cur |
1458 | 1457 |
1459 try: | 1458 try: |
1460 | |
1461 # write header | 1459 # write header |
1462 if types['header']: | 1460 if types['header']: |
1463 h = templater.stringify(self.t(types['header'], **props)) | 1461 h = templater.stringify(self.t(types['header'], **props)) |
1464 if self.buffered: | 1462 if self.buffered: |
1465 self.header[ctx.rev()] = h | 1463 self.header[ctx.rev()] = h |
1475 | 1473 |
1476 if types['footer']: | 1474 if types['footer']: |
1477 if not self.footer: | 1475 if not self.footer: |
1478 self.footer = templater.stringify(self.t(types['footer'], | 1476 self.footer = templater.stringify(self.t(types['footer'], |
1479 **props)) | 1477 **props)) |
1480 | |
1481 except KeyError as inst: | 1478 except KeyError as inst: |
1482 msg = _("%s: no key named '%s'") | 1479 msg = _("%s: no key named '%s'") |
1483 raise util.Abort(msg % (self.t.mapfile, inst.args[0])) | 1480 raise util.Abort(msg % (self.t.mapfile, inst.args[0])) |
1484 except SyntaxError as inst: | 1481 except SyntaxError as inst: |
1485 raise util.Abort('%s: %s' % (self.t.mapfile, inst.args[0])) | 1482 raise util.Abort('%s: %s' % (self.t.mapfile, inst.args[0])) |