# HG changeset patch # User Martin Geisler # Date 2010-08-30 12:38:24 # Node ID 6f833fc3ccabd204173bee24ed725269d8475932 # Parent ff7c1118a83adff592f6e20d4a5da55926fef323 Consistently import foo as foomod when foo to avoid shadowing This is in the style of 5f091fc1bab7. diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -9,7 +9,7 @@ from node import hex, nullid, nullrev, s 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 @@ def expandpats(pats): 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 expandpats(pats): 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 @@ def match(repo, pats=[], opts={}, globbe 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 @@ def copy(ui, repo, pats, opts, rename=Fa # 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 @@ def copy(ui, repo, pats, opts, rename=Fa 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): diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -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 author(repo, subset, x): 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 hasfile(repo, subset, x): 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 @@ def contains(repo, subset, x): 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: diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py --- a/mercurial/wireproto.py +++ b/mercurial/wireproto.py @@ -10,7 +10,7 @@ from i18n import _ 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 @@ def hello(repo, proto): 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 @@ def lookup(repo, proto, key): 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):