comparison mercurial/cmdutil.py @ 3837:7df171ea50cd

Fix log regression where log -p file showed diffs for other files
author Matt Mackall <mpm@selenic.com>
date Fri, 08 Dec 2006 20:44:58 -0600
parents 3674ca805a5b
children dec4eba7ccad
comparison
equal deleted inserted replaced
3836:925b1816c746 3837:7df171ea50cd
312 self.showpatch(changenode) 312 self.showpatch(changenode)
313 313
314 def showpatch(self, node): 314 def showpatch(self, node):
315 if self.patch: 315 if self.patch:
316 prev = self.repo.changelog.parents(node)[0] 316 prev = self.repo.changelog.parents(node)[0]
317 patch.diff(self.repo, prev, node, fp=self.ui) 317 patch.diff(self.repo, prev, node, match=self.patch, fp=self.ui)
318 self.ui.write("\n") 318 self.ui.write("\n")
319 319
320 class changeset_templater(changeset_printer): 320 class changeset_templater(changeset_printer):
321 '''format changeset information.''' 321 '''format changeset information.'''
322 322
508 raise util.Abort(_("%s: no key named '%s'") % (self.t.mapfile, 508 raise util.Abort(_("%s: no key named '%s'") % (self.t.mapfile,
509 inst.args[0])) 509 inst.args[0]))
510 except SyntaxError, inst: 510 except SyntaxError, inst:
511 raise util.Abort(_('%s: %s') % (self.t.mapfile, inst.args[0])) 511 raise util.Abort(_('%s: %s') % (self.t.mapfile, inst.args[0]))
512 512
513 def show_changeset(ui, repo, opts, buffered=False): 513 def show_changeset(ui, repo, opts, buffered=False, matchfn=False):
514 """show one changeset using template or regular display. 514 """show one changeset using template or regular display.
515 515
516 Display format will be the first non-empty hit of: 516 Display format will be the first non-empty hit of:
517 1. option 'template' 517 1. option 'template'
518 2. option 'style' 518 2. option 'style'
520 4. [ui] setting 'style' 520 4. [ui] setting 'style'
521 If all of these values are either the unset or the empty string, 521 If all of these values are either the unset or the empty string,
522 regular display via changeset_printer() is done. 522 regular display via changeset_printer() is done.
523 """ 523 """
524 # options 524 # options
525 patch = opts.get('patch') 525 patch = False
526 if opts.get('patch'):
527 patch = lambda x: True
528 if matchfn:
529 patch = matchfn
530
526 br = None 531 br = None
527 if opts.get('branches'): 532 if opts.get('branches'):
528 ui.warn(_("the --branches option is deprecated, " 533 ui.warn(_("the --branches option is deprecated, "
529 "please use 'hg branches' instead\n")) 534 "please use 'hg branches' instead\n"))
530 br = True 535 br = True