changeset 24815:023f97267784 stable

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.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 18 Apr 2015 13:46:24 +0900
parents 60e4258b2052
children 8eec040cb65e
files mercurial/context.py
diffstat 1 files changed, 1 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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