[Bug 3841] New: "hg annotate" against merged revision shows wrong revision
mercurial-bugs at selenic.com
mercurial-bugs at selenic.com
Mon Feb 25 13:48:39 UTC 2013
http://bz.selenic.com/show_bug.cgi?id=3841
Priority: normal
Bug ID: 3841
CC: mercurial-devel at selenic.com
Assignee: bugzilla at selenic.com
Summary: "hg annotate" against merged revision shows wrong
revision
Severity: bug
Classification: Unclassified
OS: All
Reporter: foozy at lares.dti.ne.jp
Hardware: All
Status: UNCONFIRMED
Version: 2.5.1
Component: Mercurial
Product: Mercurial
Below graph is a part of filelog tree of "mercurial/commands.py" in
the repository of Mercurial itself.
A .. B ....... D -- E ... F -- G
\ / /
\ / /
..... C -----------
A: df78d8ccac4c
B: 574869103985
C: 938dd667ca21
D: 1c0c413cccdd
E: c6b912f8b5b2
F: 1e84f1014f33
G: 8db4d406b3d3
"def clone(....)" line in "mercurial/commands.py" is modified at rev
"A", and no other revision between "A" to "G" modifies that line: "G"
doesn't, too.
Then, "hg annotate" should show rev "A" for "def clone(....)" line as
source revision against every revisions between "A" to "G", but it
shows not "A" but "C" against "G".
I found the cause of this issue in the "hist" cache management in
"filectx.annotate()".
For consistent annotation, "hist[C]" should be kept until building
"hist[G]" up, in this case. But in filelog tree above, "G" merges "F"
and its ancestor "C", and this causes:
- "hist[C]" is purged just after building "hist[E]" up unexpectedly,
- "hist[C]" is re-built up just before building "hist[G]" up, and
- "hist[C]" is built up incorrectly, because "pcache[C]" is empty at
that time: this causes mis-recognition as "all lines are new at C"
I already confirmed that changing "hist" or "pcache" purge policy can
fix this issue. For example:
====================
--- a/mercurial/context.py Sat Feb 09 17:54:01 2013 +0000
+++ b/mercurial/context.py Tue Feb 26 01:58:13 2013 +0900
@@ -719,7 +719,7 @@
needed[p] -= 1
hist[f] = curr
- pcache[f] = []
+ del pcache[f]
return zip(hist[base][0], hist[base][1].splitlines(True))
====================
But, such changes seem to decrease performance (by scanning same
revisions again and again) and/or resource efficiency (by keeping
useless entries).
Are there any other ideas ?
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Mercurial-devel
mailing list