[PATCH 18 of 19] workingctx: customize _matchstatus for parentworking case

Sean Farley sean.michael.farley at gmail.com
Thu May 15 16:16:36 CDT 2014


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1398346348 18000
#      Thu Apr 24 08:32:28 2014 -0500
# Node ID a7bf5d5ab5a5671c5362389d52a2e3dd438be49c
# Parent  0770226fad0f8961a755cb516c9e0604c7a4209a
workingctx: customize _matchstatus for parentworking case

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1318,10 +1318,26 @@ class workingctx(committablectx):
             s = super(workingctx, self)._generatestatus(other, s, match,
                                                         listignored, listclean,
                                                         listunknown)
         return s
 
+    def _matchstatus(self, other, s, match, listignored, listclean,
+                     listunknown):
+        """return different match.bad if other isn't parent"""
+        match = super(workingctx, self)._matchstatus(other, s, match,
+                                                     listignored, listclean,
+                                                     listunknown)
+        if other != self._repo['.']:
+            def bad(f, msg):
+                # 'f' may be a directory pattern from 'match.files()',
+                # so 'f not in ctx1' is not enough
+                if f not in other and f not in other.dirs():
+                    self._repo.ui.warn('%s: %s\n' %
+                                       (self._repo.dirstate.pathto(f), msg))
+            match.bad = bad
+        return match
+
     def status(self, ignored=False, clean=False, unknown=False, match=None):
         """Explicit status query
         Unless this method is used to query the working copy status, the
         _status property will implicitly read the status using its default
         arguments."""


More information about the Mercurial-devel mailing list