filectx: factor out creation of parent fctx stable
authorYuya Nishihara <yuya@tcha.org>
Sat, 18 Apr 2015 13:46:24 +0900
branchstable
changeset 24815 023f97267784
parent 24814 60e4258b2052
child 24816 8eec040cb65e
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.
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