Consistently import foo as foomod when foo to avoid shadowing
This is in the style of
5f091fc1bab7.
--- a/mercurial/cmdutil.py Mon Aug 30 13:00:22 2010 +0200
+++ b/mercurial/cmdutil.py Mon Aug 30 14:38:24 2010 +0200
@@ -9,7 +9,7 @@
from i18n import _
import os, sys, errno, re, glob, tempfile
import util, templater, patch, error, encoding, templatekw
-import match as _match
+import match as matchmod
import similar, revset
revrangesep = ':'
@@ -247,7 +247,7 @@
return list(pats)
ret = []
for p in pats:
- kind, name = _match._patsplit(p, None)
+ kind, name = matchmod._patsplit(p, None)
if kind is None:
try:
globbed = glob.glob(name)
@@ -262,7 +262,7 @@
def match(repo, pats=[], opts={}, globbed=False, default='relpath'):
if not globbed and default == 'relpath':
pats = expandpats(pats or [])
- m = _match.match(repo.root, repo.getcwd(), pats,
+ m = matchmod.match(repo.root, repo.getcwd(), pats,
opts.get('include'), opts.get('exclude'), default)
def badfn(f, msg):
repo.ui.warn("%s: %s\n" % (m.rel(f), msg))
@@ -270,10 +270,10 @@
return m
def matchall(repo):
- return _match.always(repo.root, repo.getcwd())
+ return matchmod.always(repo.root, repo.getcwd())
def matchfiles(repo, files):
- return _match.exact(repo.root, repo.getcwd(), files)
+ return matchmod.exact(repo.root, repo.getcwd(), files)
def addremove(repo, pats=[], opts={}, dry_run=None, similarity=None):
if dry_run is None:
@@ -464,7 +464,7 @@
# srcs: list of (hgsep, hgsep, ossep, bool)
# return: function that takes hgsep and returns ossep
def targetpathafterfn(pat, dest, srcs):
- if _match.patkind(pat):
+ if matchmod.patkind(pat):
# a mercurial pattern
res = lambda p: os.path.join(dest,
os.path.basename(util.localpath(p)))
@@ -512,7 +512,7 @@
dest = pats.pop()
destdirexists = os.path.isdir(dest) and not os.path.islink(dest)
if not destdirexists:
- if len(pats) > 1 or _match.patkind(pats[0]):
+ if len(pats) > 1 or matchmod.patkind(pats[0]):
raise util.Abort(_('with multiple sources, destination must be an '
'existing directory'))
if util.endswithsep(dest):
--- a/mercurial/revset.py Mon Aug 30 13:00:22 2010 +0200
+++ b/mercurial/revset.py Mon Aug 30 14:38:24 2010 +0200
@@ -7,7 +7,7 @@
import re
import parser, util, error, discovery
-import match as _match
+import match as matchmod
from i18n import _
elements = {
@@ -292,7 +292,7 @@
def hasfile(repo, subset, x):
pat = getstring(x, _("file wants a pattern"))
- m = _match.match(repo.root, repo.getcwd(), [pat])
+ m = matchmod.match(repo.root, repo.getcwd(), [pat])
s = []
for r in subset:
for f in repo[r].files():
@@ -303,7 +303,7 @@
def contains(repo, subset, x):
pat = getstring(x, _("contains wants a pattern"))
- m = _match.match(repo.root, repo.getcwd(), [pat])
+ m = matchmod.match(repo.root, repo.getcwd(), [pat])
s = []
if m.files() == [pat]:
for r in subset:
@@ -319,7 +319,7 @@
return s
def checkstatus(repo, subset, pat, field):
- m = _match.match(repo.root, repo.getcwd(), [pat])
+ m = matchmod.match(repo.root, repo.getcwd(), [pat])
s = []
fast = (m.files() == [pat])
for r in subset:
--- a/mercurial/wireproto.py Mon Aug 30 13:00:22 2010 +0200
+++ b/mercurial/wireproto.py Mon Aug 30 14:38:24 2010 +0200
@@ -10,7 +10,7 @@
from node import bin, hex
import changegroup as changegroupmod
import repo, error, encoding, util, store
-import pushkey as pushkey_
+import pushkey as pushkeymod
# list of nodes encoding / decoding
@@ -202,7 +202,7 @@
return "capabilities: %s\n" % (capabilities(repo, proto))
def listkeys(repo, proto, namespace):
- d = pushkey_.list(repo, namespace).items()
+ d = pushkeymod.list(repo, namespace).items()
t = '\n'.join(['%s\t%s' % (k.encode('string-escape'),
v.encode('string-escape')) for k, v in d])
return t
@@ -217,7 +217,7 @@
return "%s %s\n" % (success, r)
def pushkey(repo, proto, namespace, key, old, new):
- r = pushkey_.push(repo, namespace, key, old, new)
+ r = pushkeymod.push(repo, namespace, key, old, new)
return '%s\n' % int(r)
def _allowstream(ui):