##// END OF EJS Templates
Consistently import foo as foomod when foo to avoid shadowing...
Martin Geisler -
r12085:6f833fc3 default
parent child Browse files
Show More
@@ -9,7 +9,7 b' from node import hex, nullid, nullrev, s'
9 from i18n import _
9 from i18n import _
10 import os, sys, errno, re, glob, tempfile
10 import os, sys, errno, re, glob, tempfile
11 import util, templater, patch, error, encoding, templatekw
11 import util, templater, patch, error, encoding, templatekw
12 import match as _match
12 import match as matchmod
13 import similar, revset
13 import similar, revset
14
14
15 revrangesep = ':'
15 revrangesep = ':'
@@ -247,7 +247,7 b' def expandpats(pats):'
247 return list(pats)
247 return list(pats)
248 ret = []
248 ret = []
249 for p in pats:
249 for p in pats:
250 kind, name = _match._patsplit(p, None)
250 kind, name = matchmod._patsplit(p, None)
251 if kind is None:
251 if kind is None:
252 try:
252 try:
253 globbed = glob.glob(name)
253 globbed = glob.glob(name)
@@ -262,7 +262,7 b' def expandpats(pats):'
262 def match(repo, pats=[], opts={}, globbed=False, default='relpath'):
262 def match(repo, pats=[], opts={}, globbed=False, default='relpath'):
263 if not globbed and default == 'relpath':
263 if not globbed and default == 'relpath':
264 pats = expandpats(pats or [])
264 pats = expandpats(pats or [])
265 m = _match.match(repo.root, repo.getcwd(), pats,
265 m = matchmod.match(repo.root, repo.getcwd(), pats,
266 opts.get('include'), opts.get('exclude'), default)
266 opts.get('include'), opts.get('exclude'), default)
267 def badfn(f, msg):
267 def badfn(f, msg):
268 repo.ui.warn("%s: %s\n" % (m.rel(f), msg))
268 repo.ui.warn("%s: %s\n" % (m.rel(f), msg))
@@ -270,10 +270,10 b' def match(repo, pats=[], opts={}, globbe'
270 return m
270 return m
271
271
272 def matchall(repo):
272 def matchall(repo):
273 return _match.always(repo.root, repo.getcwd())
273 return matchmod.always(repo.root, repo.getcwd())
274
274
275 def matchfiles(repo, files):
275 def matchfiles(repo, files):
276 return _match.exact(repo.root, repo.getcwd(), files)
276 return matchmod.exact(repo.root, repo.getcwd(), files)
277
277
278 def addremove(repo, pats=[], opts={}, dry_run=None, similarity=None):
278 def addremove(repo, pats=[], opts={}, dry_run=None, similarity=None):
279 if dry_run is None:
279 if dry_run is None:
@@ -464,7 +464,7 b' def copy(ui, repo, pats, opts, rename=Fa'
464 # srcs: list of (hgsep, hgsep, ossep, bool)
464 # srcs: list of (hgsep, hgsep, ossep, bool)
465 # return: function that takes hgsep and returns ossep
465 # return: function that takes hgsep and returns ossep
466 def targetpathafterfn(pat, dest, srcs):
466 def targetpathafterfn(pat, dest, srcs):
467 if _match.patkind(pat):
467 if matchmod.patkind(pat):
468 # a mercurial pattern
468 # a mercurial pattern
469 res = lambda p: os.path.join(dest,
469 res = lambda p: os.path.join(dest,
470 os.path.basename(util.localpath(p)))
470 os.path.basename(util.localpath(p)))
@@ -512,7 +512,7 b' def copy(ui, repo, pats, opts, rename=Fa'
512 dest = pats.pop()
512 dest = pats.pop()
513 destdirexists = os.path.isdir(dest) and not os.path.islink(dest)
513 destdirexists = os.path.isdir(dest) and not os.path.islink(dest)
514 if not destdirexists:
514 if not destdirexists:
515 if len(pats) > 1 or _match.patkind(pats[0]):
515 if len(pats) > 1 or matchmod.patkind(pats[0]):
516 raise util.Abort(_('with multiple sources, destination must be an '
516 raise util.Abort(_('with multiple sources, destination must be an '
517 'existing directory'))
517 'existing directory'))
518 if util.endswithsep(dest):
518 if util.endswithsep(dest):
@@ -7,7 +7,7 b''
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 = {
@@ -292,7 +292,7 b' def author(repo, subset, x):'
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():
@@ -303,7 +303,7 b' def hasfile(repo, subset, x):'
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:
@@ -319,7 +319,7 b' def contains(repo, subset, x):'
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:
@@ -10,7 +10,7 b' from i18n import _'
10 from node import bin, hex
10 from node import bin, hex
11 import changegroup as changegroupmod
11 import changegroup as changegroupmod
12 import repo, error, encoding, util, store
12 import repo, error, encoding, util, store
13 import pushkey as pushkey_
13 import pushkey as pushkeymod
14
14
15 # list of nodes encoding / decoding
15 # list of nodes encoding / decoding
16
16
@@ -202,7 +202,7 b' def hello(repo, proto):'
202 return "capabilities: %s\n" % (capabilities(repo, proto))
202 return "capabilities: %s\n" % (capabilities(repo, proto))
203
203
204 def listkeys(repo, proto, namespace):
204 def listkeys(repo, proto, namespace):
205 d = pushkey_.list(repo, namespace).items()
205 d = pushkeymod.list(repo, namespace).items()
206 t = '\n'.join(['%s\t%s' % (k.encode('string-escape'),
206 t = '\n'.join(['%s\t%s' % (k.encode('string-escape'),
207 v.encode('string-escape')) for k, v in d])
207 v.encode('string-escape')) for k, v in d])
208 return t
208 return t
@@ -217,7 +217,7 b' def lookup(repo, proto, key):'
217 return "%s %s\n" % (success, r)
217 return "%s %s\n" % (success, r)
218
218
219 def pushkey(repo, proto, namespace, key, old, new):
219 def pushkey(repo, proto, namespace, key, old, new):
220 r = pushkey_.push(repo, namespace, key, old, new)
220 r = pushkeymod.push(repo, namespace, key, old, new)
221 return '%s\n' % int(r)
221 return '%s\n' % int(r)
222
222
223 def _allowstream(ui):
223 def _allowstream(ui):
General Comments 0
You need to be logged in to leave comments. Login now