[PATCH 5 of 5] linkrev: also adjust linkrev when bootstrapping annotate (issue4305)

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri Jan 9 13:29:17 CST 2015



On 01/09/2015 11:26 AM, Durham Goode wrote:
>
> On 12/30/14 1:37 PM, Pierre-Yves David wrote:
>> # HG changeset patch
>> # User Pierre-Yves David <pierre-yves.david at fb.com>
>> # Date 1419420408 28800
>> #      Wed Dec 24 03:26:48 2014 -0800
>> # Node ID cb55b8b90b09dd280d5ab2338da1388b44428c77
>> # Parent  3c1794146af6ada845c1b62bfd061edc020d9be7
>> linkrev: also adjust linkrev when bootstrapping annotate (issue4305)
>>
>> The annotate logic now use the new 'introrev' method to bootstrap its
>> traversal.
>> This catch issues from linkrev-shadowing of the changeset introducing the
>> version of a file in source changeset.
>>
>> More test have been added to display pathological cases.
>>
>> diff --git a/mercurial/context.py b/mercurial/context.py
>> --- a/mercurial/context.py
>> +++ b/mercurial/context.py
>> @@ -875,14 +875,15 @@ class basefilectx(object):
>>                       p._filelog = getlog(p.path())
>>               return pl
>>           # use linkrev to find the first changeset where self appeared
>> -        if self.rev() != self.linkrev():
>> -            base = self.filectx(self.filenode())
>> -        else:
>> -            base = self
>> +        base = self
>> +        introrev = self.introrev()
>> +        if self.rev() != introrev:
>> +            base = filectx(self._repo, self._path,
>> filelog=self.filelog(),
>> +                           fileid=self.filenode(), changeid=introrev)
> Directly instantiating a filectx here breaks remotefilelog. It would
> also break future uses that try to run annotate over a memfilectx. I'm
> about to send a patch to make this use self.filectx() and just pass the
> introrev into that.

Good catch, looking forward for your patch.


-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list