[PATCH] record: count lines changed as the number of lines added or removed per hunk

Matt Mackall mpm at selenic.com
Thu Jul 22 10:58:33 CDT 2010


On Thu, 2010-07-22 at 18:51 +0300, timeless wrote:
> I'm doing a lot of recording for transifex and hg qrecord tells me:
> 
> diff --git a/transifex/templates/projects/component_lang_detail.html
> b/transifex/templates/projects/component_lang_detail.html
> 1 hunks, 2 lines changed
> -  <h3>{{ language.name }} {% trans "translation files" %}</h3>
> +  <h3>{{ language.name }} {% trans "Translation Files" %}</h3>
> 
> but anyone can see that there's only one line that's changed, it has
> an old version and a new version, but it's collectively only one line.
> 
> I claim that the following simple patch which accounts for the number
> of additions or removals per hunk correctly matches the concept of
> "number of lines changed".

It's not quite that simple. Consider:

 1
 2
+3
 4
 5
-6
 7

That's clearly two lines changed. Aside from addition, there's no simple
formula on added and removed counts to get to a reasonable definition of
changed lines.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list