[PATCH 6 of 7] context.status: inline _poststatus()

Martin von Zweigbergk martinvonz at google.com
Sun Nov 2 22:13:50 UTC 2014


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1414106396 25200
#      Thu Oct 23 16:19:56 2014 -0700
# Branch stable
# Node ID 38535ef5532437be7eb415ace3122034d7a0fbf2
# Parent  bce37800cf84e5b689e3c4bc0417b0e7ab1767a0
context.status: inline _poststatus()

By inlining _poststatus() into _buildstatus(), it becomes clearer that
it is only called for the workingctx.

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -93,14 +93,6 @@
         """
         return match or matchmod.always(self._repo.root, self._repo.getcwd())
 
-    def _poststatus(self, other, s, match, listignored, listclean, listunknown):
-        """provide a hook to allow child objects to postprocess status results
-
-        For example, this allows other contexts, such as workingctx, to filter
-        suspect symlinks in the case of FAT32 and NTFS filesytems.
-        """
-        return s
-
     def _buildstatus(self, other, s, match, listignored, listclean,
                      listunknown):
         """build a status with respect to another context"""
@@ -306,8 +298,6 @@
         r = [[], [], [], [], [], [], []]
         r = ctx2._buildstatus(ctx1, r, match, listignored, listclean,
                               listunknown)
-        r = ctx2._poststatus(ctx1, r, match, listignored, listclean,
-                             listunknown)
 
         if reversed:
             # reverse added and removed
@@ -1401,17 +1391,6 @@
                 del mf[f]
         return mf
 
-    def _poststatus(self, other, s, match, listignored, listclean, listunknown):
-        """override the parent hook with a filter for suspect symlinks
-
-        We use this poststatus hook to filter out symlinks that might have
-        accidentally ended up with the entire contents of the file they are
-        susposed to be linking to.
-        """
-        s[0] = self._filtersuspectsymlink(s[0])
-        self._status = scmutil.status(*s)
-        return s
-
     def _dirstatestatus(self, match=None, ignored=False, clean=False,
                         unknown=False):
         '''Gets the status from the dirstate -- internal use only.'''
@@ -1449,6 +1428,11 @@
             s = super(workingctx, self)._buildstatus(other, s, match,
                                                      listignored, listclean,
                                                      listunknown)
+        # Filter out symlinks that, in the case of FAT32 and NTFS filesytems,
+        # might have accidentally ended up with the entire contents of the file
+        # they are susposed to be linking to.
+        s[0] = self._filtersuspectsymlink(s[0])
+        self._status = scmutil.status(*s)
         return s
 
     def _matchstatus(self, other, match):



More information about the Mercurial-devel mailing list