[PATCH] lets be able to show diffstat along with diff
Yuya Nishihara
yuya at tcha.org
Thu Aug 12 12:00:14 CDT 2010
Alecs King wrote:
> # HG changeset patch
> # User Alecs King <alecsk at gmail.com>
> # Date 1281537111 -28800
> # Branch my
> # Node ID 9b7fcca2a40b7664e0c56dd6b3e1c4fe96b8435f
> # Parent e83e77181fc02931bf22eb360f73333ca384c9df
> lets be able to show diffstat along with diff
> --- a/mercurial/cmdutil.py
> +++ b/mercurial/cmdutil.py
> @@ -653,15 +653,16 @@ def export(repo, revs, template='hg-%h.p
> for seqno, rev in enumerate(revs):
> single(rev, seqno + 1, fp)
>
> -def diffordiffstat(ui, repo, diffopts, node1, node2, match,
> - changes=None, stat=False, fp=None):
> - '''show diff or diffstat.'''
> +def showdiff(ui, repo, diffopts, node1, node2, match,
> + changes=None, diff=False, stat=False, fp=None):
> + '''show diffstat and/or diff.'''
> if fp is None:
> write = ui.write
> else:
> def write(s, **kw):
> fp.write(s)
>
> + context = diffopts.context
> if stat:
> diffopts.context = 0
> width = 80
It may be more readable `diffopts.copy(context=0)` only for stat
than backup diffopts.context for later use.
> @@ -672,7 +673,10 @@ def diffordiffstat(ui, repo, diffopts, n
> width=width,
> git=diffopts.git):
> write(chunk, label=label)
> - else:
> + if diff:
> + if stat:
> + write('\n')
> + diffopts.context = context
> for chunk, label in patch.diffui(repo, node1, node2, match,
> changes, diffopts):
> write(chunk, label=label)
Yuya,
More information about the Mercurial-devel
mailing list