Code duplication in Mercurial

Alexander Plavin me at aplavin.ru
Sat Jul 13 18:45:56 CDT 2013


2013/7/14 Martin Schröder <martin.schroeder at nerdluecht.de>:
> Maybe it would be helpful to publish the output of CloneDigger so that
> not everyone needs to run it.

Sure: http://aplavin.ru/hg-clonedigger-report.html - output for the
full Mercurial codebase.

>
> And maybe you can submit patches deduplicating code?

As my summer project is improving hgweb, I'm not going to deal with
duplication soon (maybe only at the parts of code which I edit), as
it's quite out of scope. So, probably no deduplicating from me until
October :)

>
>> For the sake of interest today I ran CloneDigger
>> (http://clonedigger.sourceforge.net/) on the hg codebase, and it found
>> a lot of places with duplicate code there (it counted about 200
>> duplicates). Some places have exact the same code, while some differ
>> in variable names, or something like this. For example, there are same
>> pieces of code in mercurial/hgweb/webcommand.py which are related to
>> dealing with number of shown revisions (of course, it's just one
>> example). Probably, some of the duplicates are worth moving into
>> separate functions (also, there are almost equal different functions,
>> which can me merged into one with extra argument). Now I'm writing it
>> here just to point at this, as the code duplication can make it more
>> difficult to change something in code correctly.
>>
>> P.S.: CloneDigger took more than 10 minutes and 1.5 Gb of memory to run.
>> _______________________________________________
>> Mercurial-devel mailing list
>> Mercurial-devel at selenic.com
>> http://selenic.com/mailman/listinfo/mercurial-devel
>>
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list