comparison mercurial/cmdutil.py @ 11950:d157e040ac4c stable

log: fix the bug 'hg log --stat -p == hg log --stat' Before: hg log --stat -p -r tip # only show stat After: hg log --stat -p -r tip # show stat _and_ diff
author Alecs King <alecsk@gmail.com>
date Fri, 13 Aug 2010 14:29:30 +0800
parents f786fc4b8764
children 60bfb876dc45 70236d6fd844
comparison
equal deleted inserted replaced
11927:8e56928e8991 11950:d157e040ac4c
661 else: 661 else:
662 def write(s, **kw): 662 def write(s, **kw):
663 fp.write(s) 663 fp.write(s)
664 664
665 if stat: 665 if stat:
666 diffopts.context = 0 666 diffopts = diffopts.copy(context=0)
667 width = 80 667 width = 80
668 if not ui.plain(): 668 if not ui.plain():
669 width = util.termwidth() 669 width = util.termwidth()
670 chunks = patch.diff(repo, node1, node2, match, changes, diffopts) 670 chunks = patch.diff(repo, node1, node2, match, changes, diffopts)
671 for chunk, label in patch.diffstatui(util.iterlines(chunks), 671 for chunk, label in patch.diffstatui(util.iterlines(chunks),
801 def showpatch(self, node, matchfn): 801 def showpatch(self, node, matchfn):
802 if not matchfn: 802 if not matchfn:
803 matchfn = self.patch 803 matchfn = self.patch
804 if matchfn: 804 if matchfn:
805 stat = self.diffopts.get('stat') 805 stat = self.diffopts.get('stat')
806 diff = self.diffopts.get('patch')
806 diffopts = patch.diffopts(self.ui, self.diffopts) 807 diffopts = patch.diffopts(self.ui, self.diffopts)
807 prev = self.repo.changelog.parents(node)[0] 808 prev = self.repo.changelog.parents(node)[0]
808 diffordiffstat(self.ui, self.repo, diffopts, prev, node, 809 if stat:
809 match=matchfn, stat=stat) 810 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
811 match=matchfn, stat=True)
812 if diff:
813 if stat:
814 self.ui.write("\n")
815 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
816 match=matchfn, stat=False)
810 self.ui.write("\n") 817 self.ui.write("\n")
811 818
812 def _meaningful_parentrevs(self, log, rev): 819 def _meaningful_parentrevs(self, log, rev):
813 """Return list of meaningful (or all if debug) parentrevs for rev. 820 """Return list of meaningful (or all if debug) parentrevs for rev.
814 821