# HG changeset patch # User mpm@selenic.com # Date 1120070555 28800 # Node ID 03f27b1381f9e41aaed50e5e2678a9a0b26988b9 # Parent 874e577e332e6f516403f4bfe85f8f21cbc85719 Whitespace cleanups -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Whitespace cleanups manifest hash: ac954bc3a4f034c12638a259ecd65841f5b63c5c -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCwuubywK+sNU5EO8RAluIAJ98XQpNdZUpSmYKgDmrMRlbL76ZzQCfes0t rknNUN/PhtyA4bzL646dOz4= =UyCE -----END PGP SIGNATURE----- diff --git a/hg b/hg --- a/hg +++ b/hg @@ -11,4 +11,3 @@ from mercurial import commands commands.run() - diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -312,12 +312,12 @@ def clone(ui, source, dest = None, **opt update(ui, repo) success = True - + finally: if created and not success: import shutil shutil.rmtree(dest, True) - + def commit(ui, repo, *files, **opts): """commit the specified files or all outstanding changes""" text = opts['text'] diff --git a/mercurial/fancyopts.py b/mercurial/fancyopts.py --- a/mercurial/fancyopts.py +++ b/mercurial/fancyopts.py @@ -10,7 +10,7 @@ def fancyopts(args, options, state, synt map['-'+s] = map['--'+l]=l state[l] = d dt[l] = type(d) - if not d is None and not callable(d): s, l=s+':', l+'=' + if not d is None and not callable(d): s, l=s+':', l+'=' if s: short = short + s if l: long.append(l) diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -231,7 +231,7 @@ class dirstate: l = e[4] pos += 17 f = st[pos:pos + l] - if '\0' in f: + if '\0' in f: f, c = f.split('\0') self.copies[f] = c self.map[f] = e[:4] @@ -244,7 +244,7 @@ class dirstate: def copied(self, file): return self.copies.get(file, None) - + def update(self, files, state): ''' current states: n normal @@ -345,7 +345,7 @@ class localrepository: self.ui = ui if create: - os.mkdir(self.path) + os.mkdir(self.path) os.mkdir(self.join("data")) self.opener = opener(self.path) @@ -478,7 +478,7 @@ class localrepository: except IOError: ds = "" self.opener("undo.dirstate", "w").write(ds) - + return transaction.transaction(self.opener, self.join("journal"), self.join("undo")) @@ -668,7 +668,7 @@ class localrepository: for dir, subdirs, files in os.walk(path): d = dir[len(self.root)+1:] if ".hg" in subdirs: subdirs.remove(".hg") - + for f in files: fn = util.pconvert(os.path.join(d, f)) try: s = os.stat(os.path.join(self.root, fn)) @@ -714,10 +714,10 @@ class localrepository: del mf1[fn] else: added.append(fn) - + deleted = mf1.keys() deleted.sort() - + return (changed, added, deleted) def add(self, list): @@ -846,7 +846,7 @@ class localrepository: rep = {} reqcnt = 0 - + unknown = remote.branches(unknown) while unknown: r = [] @@ -891,7 +891,7 @@ class localrepository: (short(b[0]), short(b[1]))) if b[0] not in m and b[0] not in seen: unknown.append(b) - + while search: n = search.pop(0) reqcnt += 1 @@ -969,7 +969,7 @@ class localrepository: break d, self.buf = self.buf[:l], self.buf[l:] return d - + def getchunk(): d = source.read(4) if not d: return "" @@ -1270,7 +1270,7 @@ class localrepository: self.ui.warn("duplicate changeset at revision %d\n" % i) errors += 1 seen[n] = 1 - + for p in self.changelog.parents(n): if p not in self.changelog.nodemap: self.ui.warn("changeset %s has unknown parent %s\n" % @@ -1293,7 +1293,7 @@ class localrepository: self.ui.warn("duplicate manifest at revision %d\n" % i) errors += 1 seen[n] = 1 - + for p in self.manifest.parents(n): if p not in self.manifest.nodemap: self.ui.warn("manifest %s has unknown parent %s\n" % @@ -1408,7 +1408,7 @@ class remoterepository: no = os.environ.get("no_proxy") if no: no_list = no_list + no.split(",") - + no_proxy = 0 for h in no_list: if (path.startswith("http://" + h + "/") or diff --git a/mercurial/hgweb.py b/mercurial/hgweb.py --- a/mercurial/hgweb.py +++ b/mercurial/hgweb.py @@ -76,7 +76,7 @@ def template(tmpl, filters = {}, **map): if fl: for f in fl.split("|")[1:]: v = filters[f](v) - + yield v tmpl = tmpl[m.end(0):] else: @@ -89,7 +89,7 @@ class templater: self.map = {} self.base = os.path.dirname(mapfile) self.filters = filters - + for l in file(mapfile): m = re.match(r'(\S+)\s*=\s*"(.*)"$', l) if m: @@ -107,7 +107,7 @@ class templater: except KeyError: tmpl = self.cache[t] = file(self.map[t]).read() return template(tmpl, self.filters, **map) - + class hgweb: maxchanges = 10 maxfiles = 10 @@ -158,7 +158,7 @@ class hgweb: def diff(self, node1, node2, files): def filterfiles(list, files): l = [ x for x in list if x in files ] - + for f in files: if f[-1] != os.sep: f += os.sep l += [ x for x in list if x.startswith(f) ] @@ -172,7 +172,7 @@ class hgweb: file = f, filenode = hex(fn or nullid)) parity[0] = 1 - parity[0] - + def prettyprintlines(diff): for l in diff.splitlines(1): if l.startswith('+'): @@ -234,7 +234,7 @@ class hgweb: if pos - f >= 0: l.insert(0, ("-" + r, pos - f)) yield self.t("naventry", rev = 0, label="(0)") - + for label, rev in l: yield self.t("naventry", label = label, rev = rev) @@ -293,7 +293,7 @@ class hgweb: p1, p2 = cl.parents(n) p1rev, p2rev = cl.rev(p1), cl.rev(p2) t = float(changes[2].split(' ')[0]) - + files = [] mf = self.repo.manifest.read(changes[0]) for f in changes[3]: @@ -330,7 +330,7 @@ class hgweb: def entries(): l = [] parity = (count - 1) & 1 - + for i in range(count): n = fl.node(i) @@ -423,7 +423,7 @@ class hgweb: cnode = ncache[r] except KeyError: cnode = ncache[r] = self.repo.changelog.node(r) - + try: name = bcache[r] except KeyError: @@ -474,7 +474,7 @@ class hgweb: mff=self.repo.manifest.readflags(bin(mnode)) files = {} - + p = path[1:] l = len(p) @@ -501,7 +501,7 @@ class hgweb: manifest = mnode, filenode = hex(fnode), parity = parity, - basename = f, + basename = f, permissions = mff[full]) else: yield self.t("manifestdirentry", @@ -550,7 +550,7 @@ class hgweb: p1 = cl.parents(n)[0] cs = cl.read(n) mf = self.repo.manifest.read(cs[0]) - + def diff(): yield self.diff(p1, n, file) @@ -565,7 +565,7 @@ class hgweb: p1 = hex(p1), p1rev = self.repo.changelog.rev(p1), diff = diff) - + # add tags to things # tags -> list of changesets corresponding to tags # find tag, changeset, file @@ -579,7 +579,7 @@ class hgweb: b = os.path.basename("map-" + args['style'][0]) p = os.path.join(self.templates, b) if os.path.isfile(p): m = p - + self.t = templater(m, self.filters) if not args.has_key('cmd') or args['cmd'][0] == 'changelog': @@ -591,7 +591,7 @@ class hgweb: except KeyError: pass write(self.changelog(hi)) - + elif args['cmd'][0] == 'changeset': write(self.changeset(args['node'][0])) @@ -674,7 +674,7 @@ def server(path, name, templates, addres if p: query = self.path[p + 1:] query = query.replace('+', ' ') - + env = {} env['GATEWAY_INTERFACE'] = 'CGI/1.1' env['REQUEST_METHOD'] = self.command diff --git a/mercurial/lock.py b/mercurial/lock.py --- a/mercurial/lock.py +++ b/mercurial/lock.py @@ -31,7 +31,7 @@ class lock: time.sleep(1) continue raise inst - + def trylock(self): pid = os.getpid() try: diff --git a/mercurial/mdiff.py b/mercurial/mdiff.py --- a/mercurial/mdiff.py +++ b/mercurial/mdiff.py @@ -47,7 +47,7 @@ def sortdiff(a, b): la = lb = 0 lena = len(a) lenb = len(b) - + while 1: am, bm, = la, lb @@ -65,14 +65,14 @@ def sortdiff(a, b): if lb >= lenb: break - + # skip mismatched lines from a while la < lena and lb < lenb and b[lb] > a[la]: la += 1 if la >= lena: break - + yield (lena, lenb, 0) def diff(a, b, sorted=0): @@ -100,7 +100,7 @@ def diff(a, b, sorted=0): bin.append(struct.pack(">lll", p[la], p[am], len(s)) + s) la = am + size lb = bm + size - + return "".join(bin) def patchtext(bin): diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -64,14 +64,14 @@ class lazyparser: end = self.l self.revlog.index = self.index self.revlog.nodemap = self.map - + while i < end: d = self.data[i * self.s: (i + 1) * self.s] e = struct.unpack(indexformat, d) self.index[i] = e self.map[e[6]] = i i += 1 - + class lazyindex: def __init__(self, parser): self.p = parser @@ -84,7 +84,7 @@ class lazyindex: return self.p.index[pos] or self.load(pos) def append(self, e): self.p.index.append(e) - + class lazymap: def __init__(self, parser): self.p = parser @@ -150,7 +150,6 @@ class revlog: self.nodemap = dict(m) self.nodemap[nullid] = -1 - def tip(self): return self.node(len(self.index) - 1) def count(self): return len(self.index) @@ -189,7 +188,7 @@ class revlog: elif pn == nullid: continue return c - + def lookup(self, id): try: rev = int(id) @@ -205,7 +204,7 @@ class revlog: if len(c) > 1: raise KeyError("Ambiguous identifier") if len(c) < 1: raise KeyError("No match found") return c[0] - + return None def diff(self, a, b): @@ -263,7 +262,7 @@ class revlog: % (self.datafile, rev)) self.cache = (node, rev, text) - return text + return text def addrevision(self, text, transaction, link, p1=None, p2=None): if text is None: text = "" @@ -300,7 +299,7 @@ class revlog: offset = self.end(t) e = (offset, len(data), base, link, p1, p2, node) - + self.index.append(e) self.nodemap[node] = n entry = struct.pack(indexformat, *e) @@ -320,7 +319,7 @@ class revlog: n = self.node(i) p1, p2 = self.parents(n) dist[n] = max(dist[p1], dist[p2]) + 1 - + # traverse ancestors in order of decreasing distance from root def ancestors(node): # we store negative distances because heap returns smallest member @@ -441,7 +440,7 @@ class revlog: ta = construct(ta, base, a) else: ta = "" - + base = self.base(b) if a > base: base = a @@ -471,7 +470,7 @@ class revlog: r = self.count() t = r - 1 node = nullid - + base = prev = -1 start = end = 0 if r: diff --git a/mercurial/transaction.py b/mercurial/transaction.py --- a/mercurial/transaction.py +++ b/mercurial/transaction.py @@ -65,7 +65,7 @@ class transaction: self.entries = [] print "rollback completed" - + def rollback(opener, file): for l in open(file).readlines(): f, o = l.split('\0') diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -84,4 +84,3 @@ class ui: t = re.sub("(?m)^HG:.*\n", "", t) return t - diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -21,7 +21,7 @@ def explain_exit(code): val = os.STOPSIG(code) return "stopped by signal %d" % val, val raise ValueError("invalid exit code") - + def system(cmd, errprefix = "abort"): """execute a shell command that must succeed""" rc = os.system(cmd) @@ -46,7 +46,7 @@ if os.name == 'nt': def set_exec(f, mode): pass - + def pconvert(path): return path.replace("\\", "/")