Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/context.py @ 8380:a00a4db76a15
context: replace pseudo-set by real set
author | Simon Heimberg <simohe@besonet.ch> |
---|---|
date | Thu, 14 May 2009 10:59:55 +0200 |
parents | b87a50b7125c |
children | ca7dc47eecc6 |
comparison
equal
deleted
inserted
replaced
8379:10fd7fb65110 | 8380:a00a4db76a15 |
---|---|
153 """ | 153 """ |
154 n = self._repo.changelog.ancestor(self._node, c2._node) | 154 n = self._repo.changelog.ancestor(self._node, c2._node) |
155 return changectx(self._repo, n) | 155 return changectx(self._repo, n) |
156 | 156 |
157 def walk(self, match): | 157 def walk(self, match): |
158 fdict = dict.fromkeys(match.files()) | 158 fset = set(match.files()) |
159 # for dirstate.walk, files=['.'] means "walk the whole tree". | 159 # for dirstate.walk, files=['.'] means "walk the whole tree". |
160 # follow that here, too | 160 # follow that here, too |
161 fdict.pop('.', None) | 161 fset.discard('.') |
162 for fn in self: | 162 for fn in self: |
163 for ffn in fdict: | 163 for ffn in fset: |
164 # match if the file is the exact name or a directory | 164 # match if the file is the exact name or a directory |
165 if ffn == fn or fn.startswith("%s/" % ffn): | 165 if ffn == fn or fn.startswith("%s/" % ffn): |
166 del fdict[ffn] | 166 fset.remove(ffn) |
167 break | 167 break |
168 if match(fn): | 168 if match(fn): |
169 yield fn | 169 yield fn |
170 for fn in sorted(fdict): | 170 for fn in sorted(fset): |
171 if match.bad(fn, 'No such file in rev ' + str(self)) and match(fn): | 171 if match.bad(fn, 'No such file in rev ' + str(self)) and match(fn): |
172 yield fn | 172 yield fn |
173 | 173 |
174 class filectx(object): | 174 class filectx(object): |
175 """A filecontext object makes access to data related to a particular | 175 """A filecontext object makes access to data related to a particular |