Mercurial > hg
comparison mercurial/match.py @ 6596:7fe4610cf920
match: add always, never, and exact methods
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 12 May 2008 11:37:08 -0500 |
parents | f242d3684f83 |
children | 98b6e6f0e49b |
comparison
equal
deleted
inserted
replaced
6595:99a92acafdb9 | 6596:7fe4610cf920 |
---|---|
32 return util.pathto(self._root, self._cwd, f) | 32 return util.pathto(self._root, self._cwd, f) |
33 def files(self): | 33 def files(self): |
34 return self._files | 34 return self._files |
35 def anypats(self): | 35 def anypats(self): |
36 return self._anypats | 36 return self._anypats |
37 | |
38 def always(root, cwd): | |
39 return match(root, cwd, [], None, None, 'relpath') | |
40 | |
41 def never(root, cwd): | |
42 m = match(root, cwd, [], None, None, 'relpath') | |
43 m._matchfn = lambda f: False | |
44 return m | |
45 | |
46 def exact(root, cwd, files): | |
47 m = always(root, cwd) | |
48 m._files = files | |
49 m._fmap = dict.fromkeys(files) | |
50 m._matchfn = m._fmap.has_key | |
51 return m |