This revision was automatically updated to reflect the committed changes.
Closed by commit rHG04be8aec44a8: match: make unionmatcher a proper matcher 
(authored by martinvonz).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D58?vs=129&id=146

REVISION DETAIL
  https://phab.mercurial-scm.org/D58

AFFECTED FILES
  mercurial/match.py

CHANGE DETAILS

Index: mercurial/match.py
===================================================================
--- mercurial/match.py
+++ mercurial/match.py
@@ -648,16 +648,34 @@
                 (self._path, self._matcher))
 
 class unionmatcher(basematcher):
-    """A matcher that is the union of several matchers."""
+    """A matcher that is the union of several matchers.
+
+    The non-matching-attributes (root, cwd, bad, explicitdir, traversedir) are
+    taken from the first matcher.
+    """
+
     def __init__(self, matchers):
+        m1 = matchers[0]
+        super(unionmatcher, self).__init__(m1._root, m1._cwd)
+        self.explicitdir = m1.explicitdir
+        self.traversedir = m1.traversedir
         self._matchers = matchers
 
     def matchfn(self, f):
         for match in self._matchers:
             if match(f):
                 return True
         return False
 
+    def visitdir(self, dir):
+        r = False
+        for m in self._matchers:
+            v = m.visitdir(dir)
+            if v == 'all':
+                return v
+            r |= v
+        return r
+
     def __repr__(self):
         return ('<unionmatcher matchers=%r>' % self._matchers)
 


EMAIL PREFERENCES
  https://phab.mercurial-scm.org/settings/panel/emailpreferences/

To: martinvonz, dsp, #hg-reviewers, durin42
Cc: durham, dsp, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to