Show More
@@ -477,25 +477,9 b' class queue(object):' | |||
|
477 | 477 | def printdiff(self, repo, diffopts, node1, node2=None, files=None, |
|
478 | 478 | fp=None, changes=None, opts={}): |
|
479 | 479 | stat = opts.get('stat') |
|
480 | ||
|
481 | 480 | m = cmdutil.match(repo, files, opts) |
|
482 | if fp is None: | |
|
483 | write = repo.ui.write | |
|
484 | else: | |
|
485 | def write(s, **kw): | |
|
486 | fp.write(s) | |
|
487 | if stat: | |
|
488 | diffopts.context = 0 | |
|
489 | width = self.ui.interactive() and util.termwidth() or 80 | |
|
490 | chunks = patch.diff(repo, node1, node2, m, changes, diffopts) | |
|
491 | for chunk, label in patch.diffstatui(util.iterlines(chunks), | |
|
492 | width=width, | |
|
493 | git=diffopts.git): | |
|
494 | write(chunk, label=label) | |
|
495 | else: | |
|
496 | for chunk, label in patch.diffui(repo, node1, node2, m, changes, | |
|
497 | diffopts): | |
|
498 | write(chunk, label=label) | |
|
481 | cmdutil.diffordiffstat(self.ui, repo, diffopts, node1, node2, m, | |
|
482 | changes, stat, fp) | |
|
499 | 483 | |
|
500 | 484 | def mergeone(self, repo, mergeq, head, patch, rev, diffopts): |
|
501 | 485 | # first try just applying the patch |
@@ -701,6 +701,30 b" def export(repo, revs, template='hg-%h.p" | |||
|
701 | 701 | for seqno, rev in enumerate(revs): |
|
702 | 702 | single(rev, seqno + 1, fp) |
|
703 | 703 | |
|
704 | def diffordiffstat(ui, repo, diffopts, node1, node2, match, | |
|
705 | changes=None, stat=False, fp=None): | |
|
706 | '''show diff or diffstat.''' | |
|
707 | if fp is None: | |
|
708 | write = ui.write | |
|
709 | else: | |
|
710 | def write(s, **kw): | |
|
711 | fp.write(s) | |
|
712 | ||
|
713 | if stat: | |
|
714 | diffopts.context = 0 | |
|
715 | width = 80 | |
|
716 | if not ui.plain(): | |
|
717 | width = util.termwidth() | |
|
718 | chunks = patch.diff(repo, node1, node2, match, changes, diffopts) | |
|
719 | for chunk, label in patch.diffstatui(util.iterlines(chunks), | |
|
720 | width=width, | |
|
721 | git=diffopts.git): | |
|
722 | write(chunk, label=label) | |
|
723 | else: | |
|
724 | for chunk, label in patch.diffui(repo, node1, node2, match, | |
|
725 | changes, diffopts): | |
|
726 | write(chunk, label=label) | |
|
727 | ||
|
704 | 728 | class changeset_printer(object): |
|
705 | 729 | '''show changeset information when templating not requested.''' |
|
706 | 730 |
@@ -1172,23 +1172,9 b' def diff(ui, repo, *pats, **opts):' | |||
|
1172 | 1172 | if reverse: |
|
1173 | 1173 | node1, node2 = node2, node1 |
|
1174 | 1174 | |
|
1175 | if stat: | |
|
1176 | opts['unified'] = '0' | |
|
1177 | 1175 | diffopts = patch.diffopts(ui, opts) |
|
1178 | ||
|
1179 | 1176 | m = cmdutil.match(repo, pats, opts) |
|
1180 | if stat: | |
|
1181 | it = patch.diff(repo, node1, node2, match=m, opts=diffopts) | |
|
1182 | width = 80 | |
|
1183 | if not ui.plain(): | |
|
1184 | width = util.termwidth() | |
|
1185 | for chunk, label in patch.diffstatui(util.iterlines(it), width=width, | |
|
1186 | git=diffopts.git): | |
|
1187 | ui.write(chunk, label=label) | |
|
1188 | else: | |
|
1189 | it = patch.diffui(repo, node1, node2, match=m, opts=diffopts) | |
|
1190 | for chunk, label in it: | |
|
1191 | ui.write(chunk, label=label) | |
|
1177 | cmdutil.diffordiffstat(ui, repo, diffopts, node1, node2, m, stat=stat) | |
|
1192 | 1178 | |
|
1193 | 1179 | def export(ui, repo, *changesets, **opts): |
|
1194 | 1180 | """dump the header and diffs for one or more changesets |
General Comments 0
You need to be logged in to leave comments.
Login now