Patchwork [1,of,4,STABLE] filectx: factor out creation of parent fctx

login
register
mail settings
Submitter Yuya Nishihara
Date April 18, 2015, 11:28 a.m.
Message ID <0ff963ddcf2be7959865.1429356491@mimosa>
Download mbox | patch
Permalink /patch/8735/
State Accepted
Headers show

Comments

Yuya Nishihara - April 18, 2015, 11:28 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1429332384 -32400
#      Sat Apr 18 13:46:24 2015 +0900
# Branch stable
# Node ID 0ff963ddcf2be79598659cc75f5992dc3cd0950f
# Parent  a2dcf460e141fa5979d3b29cce76b958d5b68b94
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.

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -826,21 +826,18 @@  class basefilectx(object):
 
         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