Submitter | Pierre-Yves David |
---|---|
Date | Dec. 30, 2014, 9:37 p.m. |
Message ID | <cb55b8b90b09dd280d5a.1419975432@marginatus.alto.octopoid.net> |
Download | mbox | patch |
Permalink | /patch/7266/ |
State | Accepted |
Commit | 28a302e9225d05b35d61da6f70e7187ad3ce8d7c |
Headers | show |
Comments
On 12/30/2014 01:37 PM, Pierre-Yves David wrote: > # HG changeset patch > # User Pierre-Yves David <pierre-yves.david@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. after this series I've two more patches to fix the `hg log FILENAME` case. hgweb related case will then remains but I did not wrote code for it yet (nor specifically plan to for now).
On 12/30/14 1:37 PM, Pierre-Yves David wrote: > # HG changeset patch > # User Pierre-Yves David <pierre-yves.david@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.
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@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.
Patch
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) # This algorithm would prefer to be recursive, but Python is a # bit recursion-hostile. Instead we do an iterative # depth-first search. diff --git a/tests/test-annotate.t b/tests/test-annotate.t --- a/tests/test-annotate.t +++ b/tests/test-annotate.t @@ -508,6 +508,12 @@ Annotate should list ancestor of startin $ hg annotate a 0: A 3: B 4: C +Even when the starting revision is the linkrev-shadowed one: + + $ hg annotate a -r 3 + 0: A + 3: B + $ cd ..