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

Durham Goode durham at fb.com
Fri Jan 9 19:26:55 UTC 2015


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.


More information about the Mercurial-devel mailing list