comparison mercurial/commands.py @ 1914:a5bf0030df5f

make --style=compact look for map-cmdline.compact. change name of key in map file from changelog to changeset. rename command map files to start with map-cmdline. rename ui.logmap to ui.style in hgrc. now --style=foo does this: tries to open foo as file. tries as map-cmdline.foo in template path. tries as foo in template path.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Sat, 04 Mar 2006 15:15:18 -0800
parents 74cf2b2f43d4
children 7f578969f3f6
comparison
equal deleted inserted replaced
1913:74cf2b2f43d4 1914:a5bf0030df5f
347 self.ui = ui 347 self.ui = ui
348 self.repo = repo 348 self.repo = repo
349 349
350 def use_template(self, t): 350 def use_template(self, t):
351 '''set template string to use''' 351 '''set template string to use'''
352 self.t.cache['changelog'] = t 352 self.t.cache['changeset'] = t
353 353
354 def write(self, thing): 354 def write(self, thing):
355 '''write expanded template. 355 '''write expanded template.
356 uses in-order recursive traverse of iterators.''' 356 uses in-order recursive traverse of iterators.'''
357 for t in thing: 357 for t in thing:
487 'rev': rev, 487 'rev': rev,
488 'tags': showtags, 488 'tags': showtags,
489 } 489 }
490 490
491 try: 491 try:
492 if self.ui.verbose and 'changelog_verbose' in self.t: 492 if self.ui.verbose and 'changeset_verbose' in self.t:
493 key = 'changelog_verbose' 493 key = 'changeset_verbose'
494 else: 494 else:
495 key = 'changelog' 495 key = 'changeset'
496 self.write(self.t(key, **props)) 496 self.write(self.t(key, **props))
497 except KeyError, inst: 497 except KeyError, inst:
498 raise util.Abort(_("%s: no key named '%s'") % (self.t.mapfile, 498 raise util.Abort(_("%s: no key named '%s'") % (self.t.mapfile,
499 inst.args[0])) 499 inst.args[0]))
500 except SyntaxError, inst: 500 except SyntaxError, inst:
576 if tmpl: 576 if tmpl:
577 tmpl = templater.parsestring(tmpl, quoted=False) 577 tmpl = templater.parsestring(tmpl, quoted=False)
578 else: 578 else:
579 tmpl = ui.config('ui', 'logtemplate') 579 tmpl = ui.config('ui', 'logtemplate')
580 if tmpl: tmpl = templater.parsestring(tmpl) 580 if tmpl: tmpl = templater.parsestring(tmpl)
581 mapfile = opts.get('style') or ui.config('ui', 'logmap') 581 mapfile = opts.get('style') or ui.config('ui', 'style')
582 if tmpl or mapfile: 582 if tmpl or mapfile:
583 if mapfile: 583 if mapfile:
584 if not os.path.isfile(mapfile): 584 if not os.path.isfile(mapfile):
585 mapname = templater.templatepath(mapfile) 585 mapname = templater.templatepath('map-cmdline.' + mapfile)
586 if not mapname: mapname = templater.templatepath(mapfile)
586 if mapname: mapfile = mapname 587 if mapname: mapfile = mapname
587 try: 588 try:
588 t = changeset_templater(ui, repo, mapfile) 589 t = changeset_templater(ui, repo, mapfile)
589 except SyntaxError, inst: 590 except SyntaxError, inst:
590 raise util.Abort(inst.args[0]) 591 raise util.Abort(inst.args[0])