--- a/mercurial/cmdutil.py Fri May 06 14:45:13 2011 +0200
+++ b/mercurial/cmdutil.py Fri May 06 11:50:58 2011 -0500
@@ -286,7 +286,7 @@
similarity = float(opts.get('similarity') or 0)
# we'd use status here, except handling of symlinks and ignore is tricky
added, unknown, deleted, removed = [], [], [], []
- audit_path = scmutil.path_auditor(repo.root)
+ audit_path = scmutil.pathauditor(repo.root)
m = match(repo, pats, opts)
for abs in repo.walk(m):
target = repo.wjoin(abs)
--- a/mercurial/commands.py Fri May 06 14:45:13 2011 +0200
+++ b/mercurial/commands.py Fri May 06 11:50:58 2011 -0500
@@ -99,7 +99,7 @@
if opts.get('follow'):
# --follow is deprecated and now just an alias for -f/--file
# to mimic the behavior of Mercurial before version 1.5
- opts['file'] = 1
+ opts['file'] = True
datefunc = ui.quiet and util.shortdate or util.datestr
getdate = util.cachefunc(lambda x: datefunc(x[0].date()))
@@ -116,7 +116,7 @@
if (not opts.get('user') and not opts.get('changeset')
and not opts.get('date') and not opts.get('file')):
- opts['number'] = 1
+ opts['number'] = True
linenumber = opts.get('line_number') is not None
if linenumber and (not opts.get('changeset')) and (not opts.get('number')):
@@ -3620,7 +3620,7 @@
fc = ctx[f]
repo.wwrite(f, fc.data(), fc.flags())
- audit_path = scmutil.path_auditor(repo.root)
+ audit_path = scmutil.pathauditor(repo.root)
for f in remove[0]:
if repo.dirstate[f] == 'a':
repo.dirstate.forget(f)
--- a/mercurial/hbisect.py Fri May 06 14:45:13 2011 +0200
+++ b/mercurial/hbisect.py Fri May 06 11:50:58 2011 -0500
@@ -54,10 +54,10 @@
return badrev, None
return badrev, ancestors
- good = 0
+ good = False
badrev, ancestors = buildancestors(state['bad'], state['good'])
if not ancestors: # looking for bad to good transition?
- good = 1
+ good = True
badrev, ancestors = buildancestors(state['good'], state['bad'])
bad = changelog.node(badrev)
if not ancestors: # now we're confused
--- a/mercurial/localrepo.py Fri May 06 14:45:13 2011 +0200
+++ b/mercurial/localrepo.py Fri May 06 11:50:58 2011 -0500
@@ -30,7 +30,7 @@
self.root = os.path.realpath(util.expandpath(path))
self.path = os.path.join(self.root, ".hg")
self.origroot = path
- self.auditor = scmutil.path_auditor(self.root, self._checknested)
+ self.auditor = scmutil.pathauditor(self.root, self._checknested)
self.opener = scmutil.opener(self.path)
self.wopener = scmutil.opener(self.root)
self.baseui = baseui
--- a/mercurial/merge.py Fri May 06 14:45:13 2011 +0200
+++ b/mercurial/merge.py Fri May 06 11:50:58 2011 -0500
@@ -302,7 +302,7 @@
repo.ui.debug("removing %s\n" % f)
os.unlink(repo.wjoin(f))
- audit_path = scmutil.path_auditor(repo.root)
+ audit_path = scmutil.pathauditor(repo.root)
numupdates = len(action)
for i, a in enumerate(action):
--- a/mercurial/patch.py Fri May 06 14:45:13 2011 +0200
+++ b/mercurial/patch.py Fri May 06 11:50:58 2011 -0500
@@ -406,7 +406,7 @@
self.ui.warn(_("unable to find '%s' for patching\n") % self.fname)
self.hash = {}
- self.dirty = 0
+ self.dirty = False
self.offset = 0
self.skew = 0
self.rej = []
@@ -539,7 +539,7 @@
else:
self.lines[:] = h.new()
self.offset += len(h.new())
- self.dirty = 1
+ self.dirty = True
return 0
horig = h
@@ -567,7 +567,7 @@
else:
self.lines[start : start + h.lena] = h.new()
self.offset += h.lenb - h.lena
- self.dirty = 1
+ self.dirty = True
return 0
# ok, we couldn't match the hunk. Lets look for offsets and fuzz it
@@ -592,7 +592,7 @@
self.lines[l : l + len(old)] = newlines
self.offset += len(newlines) - len(old)
self.skew = l - orig_start
- self.dirty = 1
+ self.dirty = True
offset = l - orig_start - fuzzlen
if fuzzlen:
msg = _("Hunk #%d succeeded at %d "
@@ -1132,8 +1132,8 @@
first_hunk, strip)
current_file = patcher(ui, current_file, opener,
missing=missing, eolmode=eolmode)
- except PatchError, err:
- ui.warn(str(err) + '\n')
+ except PatchError, inst:
+ ui.warn(str(inst) + '\n')
current_file = None
rejects += 1
continue
--- a/mercurial/revlog.py Fri May 06 14:45:13 2011 +0200
+++ b/mercurial/revlog.py Fri May 06 11:50:58 2011 -0500
@@ -506,7 +506,7 @@
# Turn heads into a dictionary so we can remove 'fake' heads.
# Also, later we will be using it to filter out the heads we can't
# find from roots.
- heads = dict.fromkeys(heads, 0)
+ heads = dict.fromkeys(heads, False)
# Start at the top and keep marking parents until we're done.
nodestotag = set(heads)
# Remember where the top was so we can use it as a limit later.
@@ -596,16 +596,16 @@
# We're trying to figure out which heads are reachable
# from roots.
# Mark this head as having been reached
- heads[n] = 1
+ heads[n] = True
elif ancestors is None:
# Otherwise, we're trying to discover the heads.
# Assume this is a head because if it isn't, the next step
# will eventually remove it.
- heads[n] = 1
+ heads[n] = True
# But, obviously its parents aren't.
for p in self.parents(n):
heads.pop(p, None)
- heads = [n for n in heads.iterkeys() if heads[n] != 0]
+ heads = [n for n, flag in heads.iteritems() if flag]
roots = list(roots)
assert orderedout
assert roots
--- a/mercurial/scmutil.py Fri May 06 14:45:13 2011 +0200
+++ b/mercurial/scmutil.py Fri May 06 11:50:58 2011 -0500
@@ -57,7 +57,7 @@
self._ui.warn(_("warning: %s\n") % msg)
map[fl] = f
-class path_auditor(object):
+class pathauditor(object):
'''ensure that a filesystem path contains no banned components.
the following properties of a path are checked:
@@ -169,7 +169,7 @@
def __init__(self, base, audit=True):
self.base = base
if audit:
- self.auditor = path_auditor(base)
+ self.auditor = pathauditor(base)
else:
self.auditor = util.always
self.createmode = None
@@ -276,7 +276,7 @@
name = os.path.join(root, cwd, name)
name = os.path.normpath(name)
if auditor is None:
- auditor = path_auditor(root)
+ auditor = pathauditor(root)
if name != rootsep and name.startswith(rootsep):
name = name[len(rootsep):]
auditor(name)
--- a/mercurial/subrepo.py Fri May 06 14:45:13 2011 +0200
+++ b/mercurial/subrepo.py Fri May 06 11:50:58 2011 -0500
@@ -235,7 +235,7 @@
import hg as h
hg = h
- scmutil.path_auditor(ctx._repo.root)(path)
+ scmutil.pathauditor(ctx._repo.root)(path)
state = ctx.substate.get(path, nullstate)
if state[2] not in types:
raise util.Abort(_('unknown subrepo type %s') % state[2])