# HG changeset patch # User Yuya Nishihara # Date 1429332384 -32400 # Node ID 023f97267784d8b1b4ae8bdadf67f530606cee29 # Parent 60e4258b2052ed8405b39a78dd169dea631d4e54 filectx: factor out creation of parent fctx This series tries to fix wrong ancestry information on annotating working directory. This change should slightly improves the readability of the next patch. diff -r 60e4258b2052 -r 023f97267784 mercurial/context.py --- a/mercurial/context.py Sun Apr 19 11:37:29 2015 +0100 +++ b/mercurial/context.py Sat Apr 18 13:46:24 2015 +0900 @@ -826,21 +826,18 @@ ret = [] for path, fnode, l in pl: + fctx = filectx(self._repo, path, fileid=fnode, filelog=l) if '_changeid' in vars(self) or '_changectx' in vars(self): # If self is associated with a changeset (probably explicitly # fed), ensure the created filectx is associated with a # changeset that is an ancestor of self.changectx. # This lets us later use _adjustlinkrev to get a correct link. - fctx = filectx(self._repo, path, fileid=fnode, filelog=l) fctx._descendantrev = self.rev() fctx._ancestrycontext = getattr(self, '_ancestrycontext', None) elif '_descendantrev' in vars(self): # Otherwise propagate _descendantrev if we have one associated. - fctx = filectx(self._repo, path, fileid=fnode, filelog=l) fctx._descendantrev = self._descendantrev fctx._ancestrycontext = getattr(self, '_ancestrycontext', None) - else: - fctx = filectx(self._repo, path, fileid=fnode, filelog=l) ret.append(fctx) return ret