# HG changeset patch # User Thomas Arendsen Hein # Date 1182233197 -7200 # Node ID ff7253a0d1da5fdf6540d6db9c8d794840ea9bce # Parent 8d46056960ab555053fd1f2e6536711277609941 Cleanup of whitespace, indentation and line continuation. diff --git a/hgext/graphlog.py b/hgext/graphlog.py --- a/hgext/graphlog.py +++ b/hgext/graphlog.py @@ -185,10 +185,9 @@ def graphlog(ui, repo, *args, **opts): # | / / | | | # <--- 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 # diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py --- a/hgext/patchbomb.py +++ b/hgext/patchbomb.py @@ -316,8 +316,8 @@ def patchbomb(ui, repo, *revs, **opts): 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) diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -122,7 +122,7 @@ def runcatch(ui, args): 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 @@ def dispatch(ui, args): 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): diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -32,8 +32,8 @@ class dirstate(object): 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 @@ class dirstate(object): 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 @@ class dirstate(object): 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 diff --git a/mercurial/extensions.py b/mercurial/extensions.py --- a/mercurial/extensions.py +++ b/mercurial/extensions.py @@ -66,7 +66,7 @@ def loadall(ui): 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): diff --git a/mercurial/hgweb/request.py b/mercurial/hgweb/request.py --- a/mercurial/hgweb/request.py +++ b/mercurial/hgweb/request.py @@ -20,7 +20,7 @@ class _wsgirequest(object): 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 diff --git a/mercurial/hgweb/server.py b/mercurial/hgweb/server.py --- a/mercurial/hgweb/server.py +++ b/mercurial/hgweb/server.py @@ -92,7 +92,7 @@ class _hgwebhandler(object, BaseHTTPServ 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 @@ class _hgwebhandler(object, BaseHTTPServ 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): diff --git a/mercurial/httprepo.py b/mercurial/httprepo.py --- a/mercurial/httprepo.py +++ b/mercurial/httprepo.py @@ -271,11 +271,11 @@ class httprepository(remoterepository): 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: diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -205,7 +205,7 @@ class localrepository(repo.repository): 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 @@ class localrepository(repo.repository): # 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 @@ class localrepository(repo.repository): 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 @@ class localrepository(repo.repository): 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) diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -132,7 +132,7 @@ class manifest(revlog): 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 @@ class manifest(revlog): # 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 @@ class manifest(revlog): # 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 @@ class manifest(revlog): 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 diff --git a/mercurial/merge.py b/mercurial/merge.py --- a/mercurial/merge.py +++ b/mercurial/merge.py @@ -65,7 +65,7 @@ def checkunknown(wctx, mctx): 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): diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -166,15 +166,14 @@ class ui(object): 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): diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -150,10 +150,10 @@ def install_hg(): 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, diff --git a/tests/test-simplemerge.py b/tests/test-simplemerge.py --- a/tests/test-simplemerge.py +++ b/tests/test-simplemerge.py @@ -214,15 +214,14 @@ class TestMerge3(TestCase): 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'],