Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/revset.py @ 12085:6f833fc3ccab
Consistently import foo as foomod when foo to avoid shadowing
This is in the style of 5f091fc1bab7.
author | Martin Geisler <mg@aragost.com> |
---|---|
date | Mon, 30 Aug 2010 14:38:24 +0200 |
parents | df52ff0980fe |
children | 11db6fa2961e |
comparison
equal
deleted
inserted
replaced
12084:ff7c1118a83a | 12085:6f833fc3ccab |
---|---|
5 # This software may be used and distributed according to the terms of the | 5 # This software may be used and distributed according to the terms of the |
6 # GNU General Public License version 2 or any later version. | 6 # GNU General Public License version 2 or any later version. |
7 | 7 |
8 import re | 8 import re |
9 import parser, util, error, discovery | 9 import parser, util, error, discovery |
10 import match as _match | 10 import match as matchmod |
11 from i18n import _ | 11 from i18n import _ |
12 | 12 |
13 elements = { | 13 elements = { |
14 "(": (20, ("group", 1, ")"), ("func", 1, ")")), | 14 "(": (20, ("group", 1, ")"), ("func", 1, ")")), |
15 "-": (19, ("negate", 19), ("minus", 19)), | 15 "-": (19, ("negate", 19), ("minus", 19)), |
290 n = getstring(x, _("author wants a string")).lower() | 290 n = getstring(x, _("author wants a string")).lower() |
291 return [r for r in subset if n in repo[r].user().lower()] | 291 return [r for r in subset if n in repo[r].user().lower()] |
292 | 292 |
293 def hasfile(repo, subset, x): | 293 def hasfile(repo, subset, x): |
294 pat = getstring(x, _("file wants a pattern")) | 294 pat = getstring(x, _("file wants a pattern")) |
295 m = _match.match(repo.root, repo.getcwd(), [pat]) | 295 m = matchmod.match(repo.root, repo.getcwd(), [pat]) |
296 s = [] | 296 s = [] |
297 for r in subset: | 297 for r in subset: |
298 for f in repo[r].files(): | 298 for f in repo[r].files(): |
299 if m(f): | 299 if m(f): |
300 s.append(r) | 300 s.append(r) |
301 continue | 301 continue |
302 return s | 302 return s |
303 | 303 |
304 def contains(repo, subset, x): | 304 def contains(repo, subset, x): |
305 pat = getstring(x, _("contains wants a pattern")) | 305 pat = getstring(x, _("contains wants a pattern")) |
306 m = _match.match(repo.root, repo.getcwd(), [pat]) | 306 m = matchmod.match(repo.root, repo.getcwd(), [pat]) |
307 s = [] | 307 s = [] |
308 if m.files() == [pat]: | 308 if m.files() == [pat]: |
309 for r in subset: | 309 for r in subset: |
310 if pat in repo[r]: | 310 if pat in repo[r]: |
311 s.append(r) | 311 s.append(r) |
317 s.append(r) | 317 s.append(r) |
318 continue | 318 continue |
319 return s | 319 return s |
320 | 320 |
321 def checkstatus(repo, subset, pat, field): | 321 def checkstatus(repo, subset, pat, field): |
322 m = _match.match(repo.root, repo.getcwd(), [pat]) | 322 m = matchmod.match(repo.root, repo.getcwd(), [pat]) |
323 s = [] | 323 s = [] |
324 fast = (m.files() == [pat]) | 324 fast = (m.files() == [pat]) |
325 for r in subset: | 325 for r in subset: |
326 c = repo[r] | 326 c = repo[r] |
327 if fast: | 327 if fast: |