# HG changeset patch # User Thomas Arendsen Hein # Date 1131977374 -3600 # Node ID 93a9298367e0c9285792b8395d92c9859d415d31 # Parent 5e47e42b14bad6d6a950aa3ee5d065fb60fa2c0f# Parent 8e80eefb3de63c3e8c9d6101370d0381ef753d48 Merge with Thomas Waldmann diff --git a/mercurial/bdiff.c b/mercurial/bdiff.c --- a/mercurial/bdiff.c +++ b/mercurial/bdiff.c @@ -147,7 +147,7 @@ static int equatelines(struct line *a, i break; a[i].e = j; /* use equivalence class for quick compare */ - if(h[j].len <= t) + if (h[j].len <= t) a[i].n = h[j].pos; /* point to head of match list */ else a[i].n = -1; /* too popular */ @@ -270,7 +270,7 @@ static PyObject *blocks(PyObject *self, if (!l.head || !rl) goto nomem; - for(h = l.base; h != l.head; h++) { + for (h = l.base; h != l.head; h++) { m = Py_BuildValue("iiii", h->a1, h->a2, h->b1, h->b2); PyList_SetItem(rl, pos, m); pos++; @@ -305,7 +305,7 @@ static PyObject *bdiff(PyObject *self, P goto nomem; /* calculate length of output */ - for(h = l.base; h != l.head; h++) { + for (h = l.base; h != l.head; h++) { if (h->a1 != la || h->b1 != lb) len += 12 + bl[h->b1].l - bl[lb].l; la = h->a2; @@ -320,7 +320,7 @@ static PyObject *bdiff(PyObject *self, P rb = PyString_AsString(result); la = lb = 0; - for(h = l.base; h != l.head; h++) { + for (h = l.base; h != l.head; h++) { if (h->a1 != la || h->b1 != lb) { len = bl[h->b1].l - bl[lb].l; *(uint32_t *)(encode) = htonl(al[la].l - al->l); @@ -353,3 +353,4 @@ PyMODINIT_FUNC initbdiff(void) { Py_InitModule3("bdiff", methods, mdiff_doc); } + diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -644,7 +644,7 @@ def cat(ui, repo, file1, *pats, **opts): n = mf[abs] except (hg.RepoError, KeyError): try: - n = r.lookup(rev) + n = r.lookup(rev) # XXX rev undefined! except KeyError, inst: raise util.Abort(_('cannot find file %s in rev %s'), rel, rev) else: @@ -1016,7 +1016,7 @@ def debugrename(ui, repo, file, rev=None change = repo.changelog.read(n) m = repo.manifest.read(change[0]) n = m[relpath(repo, [file])[0]] - except hg.RepoError, KeyError: + except (hg.RepoError, KeyError): n = r.lookup(rev) else: n = r.tip() @@ -2470,7 +2470,7 @@ def dispatch(args): external = [] for x in u.extensions(): - def on_exception(Exception, inst): + def on_exception(Exception, inst): # XXX Exception is a builtin name!? u.warn(_("*** failed to import extension %s\n") % x[1]) u.warn("%s\n" % inst) if "--traceback" in sys.argv[1:]: diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -213,7 +213,7 @@ class dirstate: unknown = [] for x in files: - if x is '.': + if x == '.': return self.map.copy() if x not in self.map: unknown.append(x) @@ -296,7 +296,6 @@ class dirstate: def walkhelper(self, files, statmatch, dc): # recursion free walker, faster than os.walk. def findfiles(s): - retfiles = [] work = [s] while work: top = work.pop() diff --git a/mercurial/fancyopts.py b/mercurial/fancyopts.py --- a/mercurial/fancyopts.py +++ b/mercurial/fancyopts.py @@ -1,10 +1,10 @@ import getopt def fancyopts(args, options, state): - long=[] - short='' - map={} - dt={} + long = [] + short = '' + map = {} + dt = {} for s, l, d, c in options: pl = l.replace('-', '_') diff --git a/mercurial/filelog.py b/mercurial/filelog.py --- a/mercurial/filelog.py +++ b/mercurial/filelog.py @@ -54,11 +54,11 @@ class filelog(revlog): mt = "" if meta: mt = [ "%s: %s\n" % (k, v) for k,v in meta.items() ] - text = "\1\n" + "".join(mt) + "\1\n" + text + text = "\1\n%s\1\n%s" % ("".join(mt), text) return self.addrevision(text, transaction, link, p1, p2) def renamed(self, node): - if 0 and self.parents(node)[0] != nullid: + if 0 and self.parents(node)[0] != nullid: # XXX return False m = self.readmeta(node) if m and m.has_key("copy"): diff --git a/mercurial/hgweb.py b/mercurial/hgweb.py --- a/mercurial/hgweb.py +++ b/mercurial/hgweb.py @@ -954,7 +954,7 @@ def create_server(repo): def server(path, name, templates, address, port, use_ipv6=False, accesslog=sys.stdout, errorlog=sys.stderr): httpd = create_server(path, name, templates, address, port, use_ipv6, - accesslog, errorlog) + accesslog, errorlog) # XXX wrong param count httpd.serve_forever() # This is a stopgap diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -5,7 +5,7 @@ # This software may be used and distributed according to the terms # of the GNU General Public License, incorporated herein by reference. -import sys, struct +import struct from revlog import * from i18n import gettext as _ from demandload import * diff --git a/mercurial/mdiff.py b/mercurial/mdiff.py --- a/mercurial/mdiff.py +++ b/mercurial/mdiff.py @@ -32,8 +32,8 @@ def unidiff(a, ad, b, bd, fn, r=None, te l = list(difflib.unified_diff(a, b, "a/" + fn, "b/" + fn)) if not l: return "" # difflib uses a space, rather than a tab - l[0] = l[0][:-2] + "\t" + ad + "\n" - l[1] = l[1][:-2] + "\t" + bd + "\n" + l[0] = "%s\t%s\n" % (l[0][:-2], ad) + l[1] = "%s\t%s\n" % (l[1][:-2], bd) for ln in xrange(len(l)): if l[ln][-1] != '\n': diff --git a/mercurial/node.py b/mercurial/node.py --- a/mercurial/node.py +++ b/mercurial/node.py @@ -7,7 +7,7 @@ This software may be used and distribute of the GNU General Public License, incorporated herein by reference. """ -import sha, binascii +import binascii nullid = "\0" * 20 diff --git a/mercurial/transaction.py b/mercurial/transaction.py --- a/mercurial/transaction.py +++ b/mercurial/transaction.py @@ -12,7 +12,6 @@ # of the GNU General Public License, incorporated herein by reference. import os -import util from i18n import gettext as _ class transaction: diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -158,9 +158,11 @@ def pathto(n1, n2): this returns a path in the form used by the local filesystem, not hg.''' if not n1: return localpath(n2) a, b = n1.split('/'), n2.split('/') - a.reverse(), b.reverse() + a.reverse() + b.reverse() while a and b and a[-1] == b[-1]: - a.pop(), b.pop() + a.pop() + b.pop() b.reverse() return os.sep.join((['..'] * len(a)) + b) @@ -253,7 +255,7 @@ def _matcher(canonroot, cwd, names, inc, try: pat = '(?:%s)' % regex(k, p, tail) matches.append(re.compile(pat).match) - except re.error, inst: + except re.error: raise Abort("invalid pattern: %s:%s" % (k, p)) def buildfn(text):