Cleanup of whitespace, indentation and line continuation.
--- a/hgext/graphlog.py Mon Jun 18 21:30:27 2007 -0500
+++ b/hgext/graphlog.py Tue Jun 19 08:06:37 2007 +0200
@@ -185,10 +185,9 @@
# | / / | | | # <--- padding line
# o | | | / /
# o | |
- add_padding_line = \
- len(log_strings) > 2 and \
- n_columns_diff == -1 and \
- [x for (x, y) in edges if x + 1 < y]
+ add_padding_line = (len(log_strings) > 2 and
+ n_columns_diff == -1 and
+ [x for (x, y) in edges if x + 1 < y])
# fix_nodeline_tail says whether to rewrite
#
--- a/hgext/patchbomb.py Mon Jun 18 21:30:27 2007 -0500
+++ b/hgext/patchbomb.py Tue Jun 19 08:06:37 2007 +0200
@@ -316,8 +316,8 @@
return msgs
def getbundlemsgs(bundle):
- subj = opts['subject'] or \
- prompt('Subject:', default='A bundle for your repository')
+ subj = (opts['subject']
+ or prompt('Subject:', default='A bundle for your repository'))
ui.write(_('\nWrite the introductory message for the bundle.\n\n'))
body = ui.edit('', sender)
--- a/mercurial/cmdutil.py Mon Jun 18 21:30:27 2007 -0500
+++ b/mercurial/cmdutil.py Tue Jun 19 08:06:37 2007 +0200
@@ -122,7 +122,7 @@
ui.warn(_("(did you forget to compile extensions?)\n"))
elif m in "zlib".split():
ui.warn(_("(is your Python install correct?)\n"))
-
+
except util.Abort, inst:
ui.warn(_("abort: %s\n") % inst)
except SystemExit, inst:
@@ -332,7 +332,7 @@
ret = runcommand(ui, options, cmd, d)
# run post-hook, passing command result
hook.hook(ui, repo, "post-%s" % cmd, False, args=" ".join(fullargs),
- result = ret)
+ result = ret)
return ret
def runcommand(ui, options, cmd, cmdfunc):
--- a/mercurial/dirstate.py Mon Jun 18 21:30:27 2007 -0500
+++ b/mercurial/dirstate.py Tue Jun 19 08:06:37 2007 +0200
@@ -32,8 +32,8 @@
return self._copymap
elif name == '_branch':
try:
- self._branch = self._opener("branch").read().strip()\
- or "default"
+ self._branch = (self._opener("branch").read().strip()
+ or "default")
except IOError:
self._branch = "default"
return self._branch
@@ -303,7 +303,7 @@
elif stat.S_ISSOCK(st.st_mode): kind = _('socket')
elif stat.S_ISDIR(st.st_mode): kind = _('directory')
self._ui.warn(_('%s: unsupported file type (type is %s)\n')
- % (self.pathto(f), kind))
+ % (self.pathto(f), kind))
return False
def walk(self, files=None, match=util.always, badmatch=None):
@@ -410,8 +410,8 @@
break
if not found:
if inst.errno != errno.ENOENT or not badmatch:
- self._ui.warn('%s: %s\n' % (self.pathto(ff),
- inst.strerror))
+ self._ui.warn('%s: %s\n' %
+ (self.pathto(ff), inst.strerror))
elif badmatch and badmatch(ff) and imatch(nf):
yield 'b', ff, None
continue
--- a/mercurial/extensions.py Mon Jun 18 21:30:27 2007 -0500
+++ b/mercurial/extensions.py Tue Jun 19 08:06:37 2007 +0200
@@ -66,7 +66,7 @@
result = ui.configitems("extensions")
for i, (name, path) in enumerate(result):
if path:
- path = os.path.expanduser(path)
+ path = os.path.expanduser(path)
try:
load(ui, name, path)
except (util.SignalInterrupt, KeyboardInterrupt):
--- a/mercurial/hgweb/request.py Mon Jun 18 21:30:27 2007 -0500
+++ b/mercurial/hgweb/request.py Tue Jun 19 08:06:37 2007 +0200
@@ -20,7 +20,7 @@
def __init__(self, destination, wsgienv, start_response):
version = wsgienv['wsgi.version']
if (version < (1, 0)) or (version >= (2, 0)):
- raise RuntimeError("Unknown and unsupported WSGI version %d.%d" \
+ raise RuntimeError("Unknown and unsupported WSGI version %d.%d"
% version)
self.inp = wsgienv['wsgi.input']
self.server_write = None
--- a/mercurial/hgweb/server.py Mon Jun 18 21:30:27 2007 -0500
+++ b/mercurial/hgweb/server.py Tue Jun 19 08:06:37 2007 +0200
@@ -92,7 +92,7 @@
length = self.headers.getheader('content-length')
if length:
env['CONTENT_LENGTH'] = length
- for header in [h for h in self.headers.keys() \
+ for header in [h for h in self.headers.keys()
if h not in ('content-type', 'content-length')]:
hkey = 'HTTP_' + header.replace('-', '_').upper()
hval = self.headers.getheader(header)
@@ -148,8 +148,8 @@
code = int(code)
self.saved_status = http_status
bad_headers = ('connection', 'transfer-encoding')
- self.saved_headers = [ h for h in headers \
- if h[0].lower() not in bad_headers ]
+ self.saved_headers = [h for h in headers
+ if h[0].lower() not in bad_headers]
return self._write
def _write(self, data):
--- a/mercurial/httprepo.py Mon Jun 18 21:30:27 2007 -0500
+++ b/mercurial/httprepo.py Tue Jun 19 08:06:37 2007 +0200
@@ -271,11 +271,11 @@
proto = resp.headers['content-type']
# accept old "text/plain" and "application/hg-changegroup" for now
- if not proto.startswith('application/mercurial-') and \
- not proto.startswith('text/plain') and \
- not proto.startswith('application/hg-changegroup'):
- raise hg.RepoError(_("'%s' does not appear to be an hg repository") %
- self._url)
+ if not (proto.startswith('application/mercurial-') or
+ proto.startswith('text/plain') or
+ proto.startswith('application/hg-changegroup')):
+ raise hg.RepoError(_("'%s' does not appear to be an hg repository")
+ % self._url)
if proto.startswith('application/mercurial-'):
try:
--- a/mercurial/localrepo.py Mon Jun 18 21:30:27 2007 -0500
+++ b/mercurial/localrepo.py Tue Jun 19 08:06:37 2007 +0200
@@ -205,7 +205,7 @@
h.append(n)
filetags[key] = (bin_n, h)
- for k,nh in filetags.items():
+ for k, nh in filetags.items():
if k not in globaltags:
globaltags[k] = nh
continue
@@ -215,8 +215,8 @@
# otherwise we win because we're tip-most
an, ah = nh
bn, bh = globaltags[k]
- if bn != an and an in bh and \
- (bn not in ah or len(bh) > len(ah)):
+ if (bn != an and an in bh and
+ (bn not in ah or len(bh) > len(ah))):
an = bn
ah.extend([n for n in bh if n not in ah])
globaltags[k] = an, ah
@@ -671,8 +671,8 @@
if use_dirstate:
oldname = c1[5].get("branch") # stored in UTF-8
- if not commit and not remove and not force and p2 == nullid and \
- branchname == oldname:
+ if (not commit and not remove and not force and p2 == nullid
+ and branchname == oldname):
self.ui.status(_("nothing changed\n"))
return None
@@ -915,9 +915,9 @@
getnode = lambda fn: mf1.get(fn, nullid)
for fn in mf2keys:
if mf1.has_key(fn):
- if mf1.flags(fn) != mf2.flags(fn) or \
- (mf1[fn] != mf2[fn] and (mf2[fn] != "" or
- fcmp(fn, getnode))):
+ if (mf1.flags(fn) != mf2.flags(fn) or
+ (mf1[fn] != mf2[fn] and
+ (mf2[fn] != "" or fcmp(fn, getnode)))):
modified.append(fn)
elif list_clean:
clean.append(fn)
--- a/mercurial/manifest.py Mon Jun 18 21:30:27 2007 -0500
+++ b/mercurial/manifest.py Tue Jun 19 08:06:37 2007 +0200
@@ -132,7 +132,7 @@
addlist[start:end] = array.array('c', x[i][2])
else:
del addlist[start:end]
- return "".join([struct.pack(">lll", d[0], d[1], len(d[2])) + d[2] \
+ return "".join([struct.pack(">lll", d[0], d[1], len(d[2])) + d[2]
for d in x ])
def checkforbidden(f):
@@ -141,8 +141,7 @@
# if we're using the listcache, make sure it is valid and
# parented by the same node we're diffing against
- if not changed or not self.listcache or not p1 or \
- self.mapcache[0] != p1:
+ if not (changed and self.listcache and p1 and self.mapcache[0] == p1):
files = map.keys()
files.sort()
@@ -151,7 +150,8 @@
# if this is changed to support newlines in filenames,
# be sure to check the templates/ dir again (especially *-raw.tmpl)
- text = ["%s\000%s%s\n" % (f, hex(map[f]), map.flags(f)) for f in files]
+ text = ["%s\000%s%s\n" % (f, hex(map[f]), map.flags(f))
+ for f in files]
self.listcache = array.array('c', "".join(text))
cachedelta = None
else:
@@ -208,8 +208,8 @@
cachedelta = None
self.listcache = addlist
- n = self.addrevision(buffer(self.listcache), transaction, link, p1, \
- p2, cachedelta)
+ n = self.addrevision(buffer(self.listcache), transaction, link,
+ p1, p2, cachedelta)
self.mapcache = (n, map)
return n
--- a/mercurial/merge.py Mon Jun 18 21:30:27 2007 -0500
+++ b/mercurial/merge.py Tue Jun 19 08:06:37 2007 +0200
@@ -65,7 +65,7 @@
for f in wctx.unknown():
if f in man:
if mctx.filectx(f).cmp(wctx.filectx(f).data()):
- raise util.Abort(_("untracked local file '%s' differs"\
+ raise util.Abort(_("untracked local file '%s' differs"
" from remote version") % f)
def checkcollision(mctx):
--- a/mercurial/ui.py Mon Jun 18 21:30:27 2007 -0500
+++ b/mercurial/ui.py Tue Jun 19 08:06:37 2007 +0200
@@ -166,15 +166,14 @@
try:
fp = open(filename)
except IOError, inst:
- raise util.Abort(_("unable to open %s: %s") % (filename,
- getattr(inst, "strerror", inst)))
+ raise util.Abort(_("unable to open %s: %s") %
+ (filename, getattr(inst, "strerror", inst)))
try:
cdata.readfp(fp, filename)
finally:
fp.close()
except ConfigParser.ParsingError, inst:
- raise util.Abort(_("failed to parse %s\n%s") % (filename,
- inst))
+ raise util.Abort(_("failed to parse %s\n%s") % (filename, inst))
for section in sections:
if not cdata.has_section(section):
--- a/tests/run-tests.py Mon Jun 18 21:30:27 2007 -0500
+++ b/tests/run-tests.py Tue Jun 19 08:06:37 2007 +0200
@@ -150,10 +150,10 @@
os.rename(os.path.join(BINDIR, "hg"), os.path.join(BINDIR, "_hg.py"))
f = open(os.path.join(BINDIR, 'hg'), 'w')
f.write('#!' + sys.executable + '\n')
- f.write('import sys, os; os.execv(sys.executable, [sys.executable, '+ \
- '"%s", "-x", "%s"] + sys.argv[1:])\n' % (
- os.path.join(TESTDIR, 'coverage.py'),
- os.path.join(BINDIR, '_hg.py')))
+ f.write('import sys, os; os.execv(sys.executable, [sys.executable, '
+ '"%s", "-x", "%s"] + sys.argv[1:])\n' %
+ (os.path.join(TESTDIR, 'coverage.py'),
+ os.path.join(BINDIR, '_hg.py')))
f.close()
os.chmod(os.path.join(BINDIR, 'hg'), 0700)
python = '"%s" "%s" -x' % (sys.executable,
--- a/tests/test-simplemerge.py Mon Jun 18 21:30:27 2007 -0500
+++ b/tests/test-simplemerge.py Tue Jun 19 08:06:37 2007 +0200
@@ -214,15 +214,14 @@
mid_marker='--',
end_marker='>>')
self.assertEquals(''.join(ml),
-'''\
-aaa
-bbb
-<< a
-222
---
-333
->> b
-''')
+ 'aaa\n'
+ 'bbb\n'
+ '<< a\n'
+ '222\n'
+ '--\n'
+ '333\n'
+ '>> b\n'
+ )
def test_insert_agreement(self):
m3 = Merge3(['aaa\n', 'bbb\n'],