match: make it more clear what _roots do and that it ends up in match()._files
authorMads Kiilerich <madski@unity3d.com>
Thu, 03 Oct 2013 18:01:21 +0200
changeset 21079 b02ab6486a78
parent 21078 50107a4b32e7
child 21080 04540a8499a3
match: make it more clear what _roots do and that it ends up in match()._files
mercurial/match.py
--- a/mercurial/match.py	Tue Apr 15 23:29:19 2014 -0400
+++ b/mercurial/match.py	Thu Oct 03 18:01:21 2013 +0200
@@ -59,7 +59,7 @@
 
         self._root = root
         self._cwd = cwd
-        self._files = []
+        self._files = [] # exact files and roots of patterns
         self._anypats = bool(include or exclude)
         self._ctx = ctx
         self._always = False
@@ -337,6 +337,15 @@
     return pats
 
 def _roots(patterns):
+    '''return roots and exact explicitly listed files from patterns
+
+    >>> _roots([('glob', 'g/*'), ('glob', 'g'), ('glob', 'g*')])
+    ['g', 'g', '.']
+    >>> _roots([('relpath', 'r'), ('path', 'p/p'), ('path', '')])
+    ['r', 'p/p', '.']
+    >>> _roots([('relglob', 'rg*'), ('re', 're/'), ('relre', 'rr')])
+    ['.', '.', '.']
+    '''
     r = []
     for kind, name in patterns:
         if kind == 'glob': # find the non-glob prefix