[PATCH] templatekw.showdiffstat: use ctx.diff() instead of calling patch

Matt Mackall mpm at selenic.com
Tue Dec 7 14:47:29 CST 2010


On Tue, 2010-12-07 at 15:51 +0100, Alexander Solovyov wrote:
> # HG changeset patch
> # User Alexander Solovyov <alexander at solovyov.net>
> # Date 1291733428 -3600
> # Node ID bd15a88c962a3816b6aa424aeeadd629d8fc7a56
> # Parent  ea190e7ddffdbe601cbac12dcaa106450f48be45
> templatekw.showdiffstat: use ctx.diff() instead of calling patch

What's the point of this, please?

> diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
> --- a/mercurial/templatekw.py
> +++ b/mercurial/templatekw.py
> @@ -162,9 +162,8 @@ def showdescription(repo, ctx, templ, **
>      return ctx.description().strip()
>  
>  def showdiffstat(repo, ctx, templ, **args):
> -    diff = patch.diff(repo, ctx.parents()[0].node(), ctx.node())
>      files, adds, removes = 0, 0, 0
> -    for i in patch.diffstatdata(util.iterlines(diff)):
> +    for i in patch.diffstatdata(util.iterlines(ctx.diff())):
>          files += 1
>          adds += i[1]
>          removes += i[2]
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list