changeset 21477:466964bdf4c1

workingctx: add _poststatus method to call _filtersuspectsymlink With this patch, we are one step closer to removing 'if ... else' logic in localrepo.status for testing if the context is the working directory or not. Future patches will replace those blocks of code with a call to the context's _poststatus hook so that each context object will do the right thing depending on the situation.
author Sean Farley <sean.michael.farley@gmail.com>
date Tue, 22 Apr 2014 12:59:22 -0500
parents 168283c8dedf
children 3b647aed4394
files mercurial/context.py
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Tue Apr 22 12:51:58 2014 -0500
+++ b/mercurial/context.py	Tue Apr 22 12:59:22 2014 -0500
@@ -1294,6 +1294,16 @@
         """
         return self._dirstatestatus(match, listignored, listclean, listunknown)
 
+    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])
+        return s
+
     def _dirstatestatus(self, match=None, ignored=False, clean=False,
                         unknown=False):
         '''Gets the status from the dirstate -- internal use only.'''