Mercurial > hg
changeset 21079:b02ab6486a78
match: make it more clear what _roots do and that it ends up in match()._files
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Thu, 03 Oct 2013 18:01:21 +0200 |
parents | 50107a4b32e7 |
children | 04540a8499a3 |
files | mercurial/match.py |
diffstat | 1 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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