[issue2098] latesttagdistance: use a more branch-aware distance

Eric Eisner bugs at mercurial.selenic.com
Wed Mar 17 20:15:56 UTC 2010


New submission from Eric Eisner <ede at mit.edu>:

The current algorithm for computing distance in the latesttagdistance 
template gives unexpected results for branch merges. This template is meant 
to be a rough metric for how much the repository has changed since the 
latest tag, but it instead measures the shortest path in the DAG between 
changesets.

For example, when the default branch of hg merged the tag 1.4.2 from the 
stable branch there was still quite a lot of difference between the branches 
but the template doesn't show it:
$ hg log --template '{latesttag}+{latesttagdistance}\n' -rfcc15ba18c03
1.4.2+1

I propose to use a new distance metric, defined as the number of changes in 
the history that are not present in the history of the tagged commit. This 
number actually reflects how many commits have gone into separating the 
contents of the two repositories, regardless of branchiness. The distance 
metric is still not used to find which is the latest tag (the date is).

I made a quick patch that has the right behavior but is very slow.
$ hg log --template '{latesttag}+{latesttagdistance}\n' -rfcc15ba18c03
1.4.2+236

Thoughts?

----------
files: anc-distance-slow.patch
messages: 12062
nosy: ede
priority: bug
status: unread
title: latesttagdistance: use a more branch-aware distance

____________________________________________________
Mercurial issue tracker <bugs at mercurial.selenic.com>
<http://mercurial.selenic.com/bts/issue2098>
____________________________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: anc-distance-slow.patch
Type: text/x-patch
Size: 832 bytes
Desc: not available
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20100317/714cbe75/attachment.bin>


More information about the Mercurial-devel mailing list