# HG changeset patch # User Brendan Cully # Date 1160963026 25200 # Node ID 1a437b0f49021673b7b10f514883c312683990bc # Parent 372999405787ac16203c6aa8c148404323f83466 Fix annotate where linkrev != rev without exporting linkrev diff -r 372999405787 -r 1a437b0f4902 mercurial/context.py --- a/mercurial/context.py Sun Oct 15 18:25:07 2006 -0700 +++ b/mercurial/context.py Sun Oct 15 18:43:46 2006 -0700 @@ -254,10 +254,16 @@ return [ getctx(p, n) for p, n in pl if n != -1 ] + # use linkrev to find the first changeset where self appeared + if self.rev() != self._filelog.linkrev(self._filenode): + base = self.filectx(self.filerev()) + else: + base = self + # find all ancestors - needed = {self: 1} - visit = [self] - files = [self._path] + needed = {base: 1} + visit = [base] + files = [base._path] while visit: f = visit.pop(0) for p in parents(f):