Mercurial > public > mercurial-scm > hg
comparison mercurial/context.py @ 23984:2896f53509a7 stable
filectx: use _descendantrev in parents()
This lets us be lazy about linkrev adjustments when tracing history.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sun, 01 Feb 2015 16:33:45 -0600 |
parents | ff070a53ee74 |
children | a9b61dbdb827 dd01834a696f |
comparison
equal
deleted
inserted
replaced
23983:ff070a53ee74 | 23984:2896f53509a7 |
---|---|
833 for path, fnode, l in pl: | 833 for path, fnode, l in pl: |
834 if '_changeid' in vars(self) or '_changectx' in vars(self): | 834 if '_changeid' in vars(self) or '_changectx' in vars(self): |
835 # If self is associated with a changeset (probably explicitly | 835 # If self is associated with a changeset (probably explicitly |
836 # fed), ensure the created filectx is associated with a | 836 # fed), ensure the created filectx is associated with a |
837 # changeset that is an ancestor of self.changectx. | 837 # changeset that is an ancestor of self.changectx. |
838 rev = self._adjustlinkrev(path, l, fnode, self.rev()) | 838 # This lets us later use _adjustlinkrev to get a correct link. |
839 fctx = filectx(self._repo, path, fileid=fnode, filelog=l, | 839 fctx = filectx(self._repo, path, fileid=fnode, filelog=l) |
840 changeid=rev) | 840 fctx._descendantrev = self.rev() |
841 fctx._ancestrycontext = getattr(self, '_ancestrycontext', None) | 841 fctx._ancestrycontext = getattr(self, '_ancestrycontext', None) |
842 | 842 elif '_descendantrev' in vars(self): |
843 # Otherwise propagate _descendantrev if we have one associated. | |
844 fctx = filectx(self._repo, path, fileid=fnode, filelog=l) | |
845 fctx._descendantrev = self._descendantrev | |
846 fctx._ancestrycontext = getattr(self, '_ancestrycontext', None) | |
843 else: | 847 else: |
844 fctx = filectx(self._repo, path, fileid=fnode, filelog=l) | 848 fctx = filectx(self._repo, path, fileid=fnode, filelog=l) |
845 ret.append(fctx) | 849 ret.append(fctx) |
846 return ret | 850 return ret |
847 | 851 |