Cleanup of indentation, spacing, newlines, strings and line length
authorThomas Arendsen Hein <thomas@intevation.de>
Thu, 12 Jan 2006 07:57:58 +0100
changeset 1615 83238c1db6de
parent 1614 0952d164030e
child 1616 f0f9e84849e7
Cleanup of indentation, spacing, newlines, strings and line length
mercurial/commands.py
mercurial/localrepo.py
--- a/mercurial/commands.py	Thu Jan 12 06:29:06 2006 +0100
+++ b/mercurial/commands.py	Thu Jan 12 07:57:58 2006 +0100
@@ -170,8 +170,10 @@
             num = int(val)
             if str(num) != val:
                 raise ValueError
-            if num < 0: num += revcount
-            if num < 0: num = 0
+            if num < 0:
+                num += revcount
+            if num < 0:
+                num = 0
             elif num >= revcount:
                 raise ValueError
         except ValueError:
@@ -191,12 +193,14 @@
             end = fix(end, revcount - 1)
             step = start > end and -1 or 1
             for rev in xrange(start, end+step, step):
-                if rev in seen: continue
+                if rev in seen:
+                    continue
                 seen[rev] = 1
                 yield str(rev)
         else:
             rev = fix(spec, None)
-            if rev in seen: continue
+            if rev in seen:
+                continue
             seen[rev] = 1
             yield str(rev)
 
@@ -439,7 +443,7 @@
             if e[0].__doc__:
                 d = e[0].__doc__.splitlines(0)[0].rstrip()
             h[f] = d
-            cmds[f]=c.lstrip("^")
+            cmds[f] = c.lstrip("^")
 
         fns = h.keys()
         fns.sort()
@@ -447,7 +451,7 @@
         for f in fns:
             if ui.verbose:
                 commands = cmds[f].replace("|",", ")
-                ui.write(" %s:\n      %s\n"%(commands,h[f]))
+                ui.write(" %s:\n      %s\n"%(commands, h[f]))
             else:
                 ui.write(' %-*s   %s\n' % (m, f, h[f]))
 
@@ -490,7 +494,8 @@
     names = []
     for src, abs, rel, exact in walk(repo, pats, opts):
         if exact:
-            if ui.verbose: ui.status(_('adding %s\n') % rel)
+            if ui.verbose:
+                ui.status(_('adding %s\n') % rel)
             names.append(abs)
         elif repo.dirstate.state(abs) == '?':
             ui.status(_('adding %s\n') % rel)
@@ -540,11 +545,11 @@
 
     dcache = {}
     def getdate(rev):
-    	datestr = dcache.get(rev)
+        datestr = dcache.get(rev)
         if datestr is None:
             cl = repo.changelog.read(repo.changelog.node(rev))
             datestr = dcache[rev] = util.datestr(cl[2])
-	return datestr
+        return datestr
 
     if not pats:
         raise util.Abort(_('at least one file name or pattern required'))
@@ -723,7 +728,8 @@
             try:
                 util.copyfiles(src, dst)
             except OSError, inst:
-                if inst.errno != errno.ENOENT: raise
+                if inst.errno != errno.ENOENT:
+                    raise
 
         repo = hg.repository(ui, dest)
 
@@ -799,7 +805,8 @@
                    'a': _('has been marked for add')}
         reason = reasons.get(repo.dirstate.state(abs))
         if reason:
-            if exact: ui.warn(_('%s: not copying - file %s\n') % (rel, reason))
+            if exact:
+                ui.warn(_('%s: not copying - file %s\n') % (rel, reason))
         else:
             return True
 
@@ -1276,13 +1283,17 @@
                 change = ((l in states) and '-') or '+'
                 r = prev[fn]
             cols = [fn, str(rev)]
-            if opts['line_number']: cols.append(str(l.linenum))
-            if opts['all']: cols.append(change)
-            if opts['user']: cols.append(trimuser(ui, getchange(rev)[1], rev,
+            if opts['line_number']:
+                cols.append(str(l.linenum))
+            if opts['all']:
+                cols.append(change)
+            if opts['user']:
+                cols.append(trimuser(ui, getchange(rev)[1], rev,
                                                   ucache))
             if opts['files_with_matches']:
                 c = (fn, rev)
-                if c in filerevmatches: continue
+                if c in filerevmatches:
+                    continue
                 filerevmatches[c] = 1
             else:
                 cols.append(l.line)
@@ -1304,7 +1315,8 @@
             mf = repo.manifest.read(change[0])
             matches[rev] = {}
             for fn in fns:
-                if fn in skip: continue
+                if fn in skip:
+                    continue
                 fstate.setdefault(fn, {})
                 try:
                     grepbody(fn, rev, getfile(fn).read(mf[fn]))
@@ -1314,7 +1326,8 @@
             states = matches[rev].items()
             states.sort()
             for fn, m in states:
-                if fn in skip: continue
+                if fn in skip:
+                    continue
                 if incrementing or not opts['all'] or fstate[fn]:
                     pos, neg = display(fn, rev, m, fstate[fn])
                     count += pos + neg
@@ -1327,7 +1340,8 @@
         fstate = fstate.items()
         fstate.sort()
         for fn, state in fstate:
-            if fn in skip: continue
+            if fn in skip:
+                continue
             display(fn, rev, {}, state)
     return (count == 0 and 1) or 0
 
@@ -1422,7 +1436,8 @@
             line = line.rstrip()
             if (not message and not hgpatch and
                    mailre.match(line) and not opts['force']):
-                if len(line) > 35: line = line[:32] + '...'
+                if len(line) > 35:
+                    line = line[:32] + '...'
                 raise util.Abort(_('first line looks like a '
                                    'mail header: ') + line)
             if diffre.match(line):
@@ -1565,9 +1580,9 @@
             parents = [p for p in repo.changelog.parents(changenode)
                        if p != nullid]
             if opts['no_merges'] and len(parents) == 2:
-                 continue
+                continue
             if opts['only_merges'] and len(parents) != 2:
-                 continue
+                continue
 
             br = None
             if opts['keyword']:
@@ -1814,16 +1829,21 @@
     def okaytoremove(abs, rel, exact):
         c, a, d, u = repo.changes(files = [abs])
         reason = None
-        if c: reason = _('is modified')
-        elif a: reason = _('has been marked for add')
-        elif u: reason = _('is not managed')
+        if c:
+            reason = _('is modified')
+        elif a:
+            reason = _('has been marked for add')
+        elif u:
+            reason = _('is not managed')
         if reason:
-            if exact: ui.warn(_('not removing %s: file %s\n') % (rel, reason))
+            if exact:
+                ui.warn(_('not removing %s: file %s\n') % (rel, reason))
         else:
             return True
     for src, abs, rel, exact in walk(repo, (pat,) + pats, opts):
         if okaytoremove(abs, rel, exact):
-            if ui.verbose or not exact: ui.status(_('removing %s\n') % rel)
+            if ui.verbose or not exact:
+                ui.status(_('removing %s\n') % rel)
             names.append(abs)
     repo.remove(names, unlink=True)
 
@@ -1847,7 +1867,8 @@
     errs, copied = docopy(ui, repo, pats, opts)
     names = []
     for abs, rel, exact in copied:
-        if ui.verbose or not exact: ui.status(_('removing %s\n') % rel)
+        if ui.verbose or not exact:
+            ui.status(_('removing %s\n') % rel)
         names.append(abs)
     repo.remove(names, unlink=True)
     return errs
@@ -2198,12 +2219,12 @@
         (add,
          [('I', 'include', [], _('include names matching the given patterns')),
           ('X', 'exclude', [], _('exclude names matching the given patterns'))],
-         "hg add [OPTION]... [FILE]..."),
+         _('hg add [OPTION]... [FILE]...')),
     "addremove":
         (addremove,
          [('I', 'include', [], _('include names matching the given patterns')),
           ('X', 'exclude', [], _('exclude names matching the given patterns'))],
-         "hg addremove [OPTION]... [FILE]..."),
+         _('hg addremove [OPTION]... [FILE]...')),
     "^annotate":
         (annotate,
          [('r', 'rev', '', _('annotate the specified revision')),
@@ -2223,17 +2244,17 @@
         (cat,
          [('I', 'include', [], _('include names matching the given patterns')),
           ('X', 'exclude', [], _('exclude names matching the given patterns')),
-          ('o', 'output', "", _('print output to file with formatted name')),
+          ('o', 'output', '', _('print output to file with formatted name')),
           ('r', 'rev', '', _('print the given revision'))],
          _('hg cat [OPTION]... FILE...')),
     "^clone":
         (clone,
          [('U', 'noupdate', None, _('do not update the new working directory')),
-          ('e', 'ssh', "", _('specify ssh command to use')),
+          ('e', 'ssh', '', _('specify ssh command to use')),
           ('', 'pull', None, _('use pull protocol to copy metadata')),
           ('r', 'rev', [],
            _('a changeset you would like to have after cloning')),
-          ('', 'remotecmd', "",
+          ('', 'remotecmd', '',
            _('specify hg command to run on the remote side'))],
          _('hg clone [OPTION]... SOURCE [DEST]')),
     "^commit|ci":
@@ -2241,21 +2262,19 @@
          [('A', 'addremove', None, _('run addremove during commit')),
           ('I', 'include', [], _('include names matching the given patterns')),
           ('X', 'exclude', [], _('exclude names matching the given patterns')),
-          ('m', 'message', "", _('use <text> as commit message')),
-          ('l', 'logfile', "", _('read the commit message from <file>')),
-          ('d', 'date', "", _('record datecode as commit date')),
-          ('u', 'user', "", _('record user as commiter'))],
+          ('m', 'message', '', _('use <text> as commit message')),
+          ('l', 'logfile', '', _('read the commit message from <file>')),
+          ('d', 'date', '', _('record datecode as commit date')),
+          ('u', 'user', '', _('record user as commiter'))],
          _('hg commit [OPTION]... [FILE]...')),
-    "copy|cp": (copy,
-             [('I', 'include', [],
-               _('include names matching the given patterns')),
-              ('X', 'exclude', [],
-               _('exclude names matching the given patterns')),
-              ('A', 'after', None,
-               _('record a copy that has already occurred')),
-              ('f', 'force', None,
-               _('forcibly copy over an existing managed file'))],
-             _('hg copy [OPTION]... [SOURCE]... DEST')),
+    "copy|cp":
+        (copy,
+         [('I', 'include', [], _('include names matching the given patterns')),
+          ('X', 'exclude', [], _('exclude names matching the given patterns')),
+          ('A', 'after', None, _('record a copy that has already occurred')),
+          ('f', 'force', None,
+           _('forcibly copy over an existing managed file'))],
+         _('hg copy [OPTION]... [SOURCE]... DEST')),
     "debugancestor": (debugancestor, [], _('debugancestor INDEX REV1 REV2')),
     "debugcheckstate": (debugcheckstate, [], _('debugcheckstate')),
     "debugconfig": (debugconfig, [], _('debugconfig')),
@@ -2279,15 +2298,15 @@
          _('hg diff [-a] [-I] [-X] [-r REV1 [-r REV2]] [FILE]...')),
     "^export":
         (export,
-         [('o', 'output', "", _('print output to file with formatted name')),
+         [('o', 'output', '', _('print output to file with formatted name')),
           ('a', 'text', None, _('treat all files as text')),
           ('', 'switch-parent', None, _('diff against the second parent'))],
-         "hg export [-a] [-o OUTFILE] REV..."),
+         _('hg export [-a] [-o OUTFILE] REV...')),
     "forget":
         (forget,
          [('I', 'include', [], _('include names matching the given patterns')),
           ('X', 'exclude', [], _('exclude names matching the given patterns'))],
-         "hg forget [OPTION]... FILE..."),
+         _('hg forget [OPTION]... FILE...')),
     "grep":
         (grep,
          [('0', 'print0', None, _('end fields with NUL')),
@@ -2300,11 +2319,11 @@
           ('n', 'line-number', None, _('print matching line numbers')),
           ('r', 'rev', [], _('search in given revision range')),
           ('u', 'user', None, _('print user who committed change'))],
-         "hg grep [OPTION]... PATTERN [FILE]..."),
+         _('hg grep [OPTION]... PATTERN [FILE]...')),
     "heads":
         (heads,
          [('b', 'branches', None, _('find branch info')),
-          ('r', 'rev', "", _('show only heads which are descendants of rev'))],
+          ('r', 'rev', '', _('show only heads which are descendants of rev'))],
          _('hg heads [-b] [-r <rev>]')),
     "help": (help_, [], _('hg help [COMMAND]')),
     "identify|id": (identify, [], _('hg identify')),
@@ -2315,10 +2334,10 @@
            _('meaning as the corresponding patch option')),
           ('f', 'force', None,
            _('skip check for outstanding uncommitted changes')),
-          ('b', 'base', "", _('base path'))],
-         "hg import [-f] [-p NUM] [-b BASE] PATCH..."),
+          ('b', 'base', '', _('base path'))],
+         _('hg import [-f] [-p NUM] [-b BASE] PATCH...')),
     "incoming|in": (incoming,
-         [('M', 'no-merges', None, _("do not show merges")),
+         [('M', 'no-merges', None, _('do not show merges')),
           ('p', 'patch', None, _('show patch')),
           ('n', 'newest-first', None, _('show newest record first'))],
          _('hg incoming [-p] [-n] [-M] [SOURCE]')),
@@ -2340,13 +2359,13 @@
           ('b', 'branch', None, _('show branches')),
           ('k', 'keyword', [], _('search for a keyword')),
           ('r', 'rev', [], _('show the specified revision or range')),
-          ('M', 'no-merges', None, _("do not show merges")),
-          ('m', 'only-merges', None, _("show only merges")),
+          ('M', 'no-merges', None, _('do not show merges')),
+          ('m', 'only-merges', None, _('show only merges')),
           ('p', 'patch', None, _('show patch'))],
          _('hg log [-I] [-X] [-r REV]... [-p] [FILE]')),
     "manifest": (manifest, [], _('hg manifest [REV]')),
     "outgoing|out": (outgoing,
-         [('M', 'no-merges', None, _("do not show merges")),
+         [('M', 'no-merges', None, _('do not show merges')),
           ('p', 'patch', None, _('show patch')),
           ('n', 'newest-first', None, _('show newest record first'))],
          _('hg outgoing [-p] [-n] [-M] [DEST]')),
@@ -2356,64 +2375,61 @@
         (pull,
          [('u', 'update', None,
            _('update the working directory to tip after pull')),
-          ('e', 'ssh', "", _('specify ssh command to use')),
+          ('e', 'ssh', '', _('specify ssh command to use')),
           ('r', 'rev', [], _('a specific revision you would like to pull')),
-          ('', 'remotecmd', "",
+          ('', 'remotecmd', '',
            _('specify hg command to run on the remote side'))],
          _('hg pull [-u] [-e FILE] [-r rev] [--remotecmd FILE] [SOURCE]')),
     "^push":
         (push,
          [('f', 'force', None, _('force push')),
-          ('e', 'ssh', "", _('specify ssh command to use')),
-          ('', 'remotecmd', "",
+          ('e', 'ssh', '', _('specify ssh command to use')),
+          ('', 'remotecmd', '',
            _('specify hg command to run on the remote side'))],
          _('hg push [-f] [-e FILE] [--remotecmd FILE] [DEST]')),
     "rawcommit":
         (rawcommit,
          [('p', 'parent', [], _('parent')),
-          ('d', 'date', "", _('date code')),
-          ('u', 'user', "", _('user')),
-          ('F', 'files', "", _('file list')),
-          ('m', 'message', "", _('commit message')),
-          ('l', 'logfile', "", _('commit message file'))],
+          ('d', 'date', '', _('date code')),
+          ('u', 'user', '', _('user')),
+          ('F', 'files', '', _('file list')),
+          ('m', 'message', '', _('commit message')),
+          ('l', 'logfile', '', _('commit message file'))],
          _('hg rawcommit [OPTION]... [FILE]...')),
-    "recover": (recover, [], _("hg recover")),
-    "^remove|rm": (remove,
-                   [('I', 'include', [],
-                     _('include names matching the given patterns')),
-                    ('X', 'exclude', [],
-                     _('exclude names matching the given patterns'))],
-                   _("hg remove [OPTION]... FILE...")),
-    "rename|mv": (rename,
-                  [('I', 'include', [],
-                    _('include names matching the given patterns')),
-                   ('X', 'exclude', [],
-                    _('exclude names matching the given patterns')),
-                   ('A', 'after', None,
-                    _('record a rename that has already occurred')),
-                   ('f', 'force', None,
-                    _('forcibly copy over an existing managed file'))],
-                  _('hg rename [OPTION]... [SOURCE]... DEST')),
+    "recover": (recover, [], _('hg recover')),
+    "^remove|rm":
+        (remove,
+         [('I', 'include', [], _('include names matching the given patterns')),
+          ('X', 'exclude', [], _('exclude names matching the given patterns'))],
+         _('hg remove [OPTION]... FILE...')),
+    "rename|mv":
+        (rename,
+         [('I', 'include', [], _('include names matching the given patterns')),
+          ('X', 'exclude', [], _('exclude names matching the given patterns')),
+          ('A', 'after', None, _('record a rename that has already occurred')),
+          ('f', 'force', None,
+           _('forcibly copy over an existing managed file'))],
+         _('hg rename [OPTION]... [SOURCE]... DEST')),
     "^revert":
         (revert,
          [('I', 'include', [], _('include names matching the given patterns')),
           ('X', 'exclude', [], _('exclude names matching the given patterns')),
-          ("r", "rev", "", _("revision to revert to"))],
-         _("hg revert [-n] [-r REV] [NAME]...")),
-    "root": (root, [], _("hg root")),
+          ('r', 'rev', '', _('revision to revert to'))],
+         _('hg revert [-n] [-r REV] [NAME]...')),
+    "root": (root, [], _('hg root')),
     "^serve":
         (serve,
          [('A', 'accesslog', '', _('name of access log file to write to')),
           ('E', 'errorlog', '', _('name of error log file to write to')),
           ('p', 'port', 0, _('port to use (default: 8000)')),
           ('a', 'address', '', _('address to use')),
-          ('n', 'name', "",
+          ('n', 'name', '',
            _('name to show in web pages (default: working dir)')),
           ('', 'stdio', None, _('for remote clients')),
-          ('t', 'templates', "", _('web templates to use')),
-          ('', 'style', "", _('template style to use')),
+          ('t', 'templates', '', _('web templates to use')),
+          ('', 'style', '', _('template style to use')),
           ('6', 'ipv6', None, _('use IPv6 in addition to IPv4'))],
-         _("hg serve [OPTION]...")),
+         _('hg serve [OPTION]...')),
     "^status|st":
         (status,
          [('m', 'modified', None, _('show only modified files')),
@@ -2425,14 +2441,14 @@
            _('end filenames with NUL, for use with xargs')),
           ('I', 'include', [], _('include names matching the given patterns')),
           ('X', 'exclude', [], _('exclude names matching the given patterns'))],
-         _("hg status [OPTION]... [FILE]...")),
+         _('hg status [OPTION]... [FILE]...')),
     "tag":
         (tag,
          [('l', 'local', None, _('make the tag local')),
-          ('m', 'message', "", _('message for tag commit log entry')),
-          ('d', 'date', "", _('record datecode as commit date')),
-          ('u', 'user', "", _('record user as commiter')),
-          ('r', 'rev', "", _('revision to tag'))],
+          ('m', 'message', '', _('message for tag commit log entry')),
+          ('d', 'date', '', _('record datecode as commit date')),
+          ('u', 'user', '', _('record user as commiter')),
+          ('r', 'rev', '', _('revision to tag'))],
          _('hg tag [OPTION]... NAME [REV]')),
     "tags": (tags, [], _('hg tags')),
     "tip": (tip, [], _('hg tip')),
@@ -2444,7 +2460,7 @@
     "undo": (undo, [], _('hg undo')),
     "^update|up|checkout|co":
         (update,
-         [('b', 'branch', "", _('checkout the head of a specific branch')),
+         [('b', 'branch', '', _('checkout the head of a specific branch')),
           ('m', 'merge', None, _('allow merging of branches')),
           ('C', 'clean', None, _('overwrite locally modified files')),
           ('f', 'force', None, _('force a merge with outstanding changes'))],
@@ -2454,19 +2470,19 @@
 }
 
 globalopts = [
-    ('R', 'repository', "", _("repository root directory")),
-    ('', 'cwd', '', _("change working directory")),
+    ('R', 'repository', '', _('repository root directory')),
+    ('', 'cwd', '', _('change working directory')),
     ('y', 'noninteractive', None,
-     _("do not prompt, assume 'yes' for any required answers")),
-    ('q', 'quiet', None, _("suppress output")),
-    ('v', 'verbose', None, _("enable additional output")),
-    ('', 'debug', None, _("enable debugging output")),
-    ('', 'debugger', None, _("start debugger")),
-    ('', 'traceback', None, _("print traceback on exception")),
-    ('', 'time', None, _("time how long the command takes")),
-    ('', 'profile', None, _("print command execution profile")),
-    ('', 'version', None, _("output version information and exit")),
-    ('h', 'help', None, _("display help and exit")),
+     _('do not prompt, assume \'yes\' for any required answers')),
+    ('q', 'quiet', None, _('suppress output')),
+    ('v', 'verbose', None, _('enable additional output')),
+    ('', 'debug', None, _('enable debugging output')),
+    ('', 'debugger', None, _('start debugger')),
+    ('', 'traceback', None, _('print traceback on exception')),
+    ('', 'time', None, _('time how long the command takes')),
+    ('', 'profile', None, _('print command execution profile')),
+    ('', 'version', None, _('output version information and exit')),
+    ('h', 'help', None, _('display help and exit')),
 ]
 
 norepo = ("clone init version help debugancestor debugconfig debugdata"
@@ -2649,7 +2665,8 @@
                 path = options["repository"] or ""
                 repo = hg.repository(ui=u, path=path)
                 for x in external:
-                    if hasattr(x, 'reposetup'): x.reposetup(u, repo)
+                    if hasattr(x, 'reposetup'):
+                        x.reposetup(u, repo)
                 d = lambda: func(u, repo, *args, **cmdoptions)
             else:
                 d = lambda: func(u, *args, **cmdoptions)
--- a/mercurial/localrepo.py	Thu Jan 12 06:29:06 2006 +0100
+++ b/mercurial/localrepo.py	Thu Jan 12 07:57:58 2006 +0100
@@ -19,7 +19,8 @@
             while not os.path.isdir(os.path.join(p, ".hg")):
                 oldp = p
                 p = os.path.dirname(p)
-                if p == oldp: raise repo.RepoError(_("no repo found"))
+                if p == oldp:
+                    raise repo.RepoError(_("no repo found"))
             path = p
         self.path = os.path.join(path, ".hg")
 
@@ -44,7 +45,8 @@
         self.dirstate = dirstate.dirstate(self.opener, ui, self.root)
         try:
             self.ui.readconfig(self.join("hgrc"))
-        except IOError: pass
+        except IOError:
+            pass
 
     def hook(self, name, **args):
         def runhook(name, cmd):
@@ -126,16 +128,16 @@
                 r = self.changelog.rev(n)
             except:
                 r = -2 # sort to the beginning of the list if unknown
-            l.append((r,t,n))
+            l.append((r, t, n))
         l.sort()
-        return [(t,n) for r,t,n in l]
+        return [(t, n) for r, t, n in l]
 
     def nodetags(self, node):
         '''return the tags associated with a node'''
         if not self.nodetagscache:
             self.nodetagscache = {}
-            for t,n in self.tags().items():
-                self.nodetagscache.setdefault(n,[]).append(t)
+            for t, n in self.tags().items():
+                self.nodetagscache.setdefault(n, []).append(t)
         return self.nodetagscache.get(node, [])
 
     def lookup(self, key):
@@ -160,7 +162,8 @@
         return os.path.join(self.root, f)
 
     def file(self, f):
-        if f[0] == '/': f = f[1:]
+        if f[0] == '/':
+            f = f[1:]
         return filelog.filelog(self.opener, f)
 
     def getcwd(self):
@@ -336,8 +339,8 @@
         if update_dirstate:
             self.dirstate.setparents(n, nullid)
 
-    def commit(self, files = None, text = "", user = None, date = None,
-               match = util.always, force=False):
+    def commit(self, files=None, text="", user=None, date=None,
+               match=util.always, force=False):
         commit = []
         remove = []
         changed = []
@@ -472,8 +475,7 @@
             for src, fn in self.dirstate.walk(files, match):
                 yield src, fn
 
-    def changes(self, node1 = None, node2 = None, files = [],
-                match = util.always):
+    def changes(self, node1=None, node2=None, files=[], match=util.always):
         mf2, u = None, []
 
         def fcmp(fn, mf):
@@ -522,7 +524,8 @@
             for f in a + c + l:
                 mf2[f] = ""
             for f in d:
-                if f in mf2: del mf2[f]
+                if f in mf2:
+                    del mf2[f]
         else:
             change = self.changelog.read(node2)
             mf2 = mfmatches(change[0])
@@ -556,7 +559,8 @@
             if not os.path.exists(p):
                 self.ui.warn(_("%s does not exist!\n") % f)
             elif not os.path.isfile(p):
-                self.ui.warn(_("%s not added: only files supported currently\n") % f)
+                self.ui.warn(_("%s not added: only files supported currently\n")
+                             % f)
             elif self.dirstate.state(f) in 'an':
                 self.ui.warn(_("%s already tracked!\n") % f)
             else:
@@ -576,7 +580,8 @@
                 try:
                     util.unlink(self.wjoin(f))
                 except OSError, inst:
-                    if inst.errno != errno.ENOENT: raise
+                    if inst.errno != errno.ENOENT:
+                        raise
         wlock = self.wlock()
         for f in list:
             p = self.wjoin(f)
@@ -731,7 +736,8 @@
         return out
 
     def branches(self, nodes):
-        if not nodes: nodes = [self.changelog.tip()]
+        if not nodes:
+            nodes = [self.changelog.tip()]
         b = []
         for n in nodes:
             t = n
@@ -803,7 +809,8 @@
                 if n[0] in seen:
                     continue
 
-                self.ui.debug(_("examining %s:%s\n") % (short(n[0]), short(n[1])))
+                self.ui.debug(_("examining %s:%s\n")
+                              % (short(n[0]), short(n[1])))
                 if n[0] == nullid:
                     break
                 if n in seenbranch:
@@ -839,7 +846,8 @@
                         self.ui.debug(_("received %s:%s\n") %
                                       (short(b[0]), short(b[1])))
                         if b[0] in m:
-                            self.ui.debug(_("found base node %s\n") % short(b[0]))
+                            self.ui.debug(_("found base node %s\n")
+                                          % short(b[0]))
                             base[b[0]] = 1
                         elif b[0] not in seen:
                             unknown.append(b)
@@ -912,7 +920,7 @@
         # this is the set of all roots we have to push
         return subset
 
-    def pull(self, remote, heads = None):
+    def pull(self, remote, heads=None):
         lock = self.lock()
 
         # if we have an empty repo, fetch everything
@@ -1283,9 +1291,11 @@
 
         def getchunk():
             d = source.read(4)
-            if not d: return ""
+            if not d:
+                return ""
             l = struct.unpack(">l", d)[0]
-            if l <= 4: return ""
+            if l <= 4:
+                return ""
             d = source.read(l - 4)
             if len(d) < l - 4:
                 raise repo.RepoError(_("premature EOF reading chunk"
@@ -1296,7 +1306,8 @@
         def getgroup():
             while 1:
                 c = getchunk()
-                if not c: break
+                if not c:
+                    break
                 yield c
 
         def csmap(x):
@@ -1306,7 +1317,8 @@
         def revmap(x):
             return self.changelog.rev(x)
 
-        if not source: return
+        if not source:
+            return
         changesets = files = revisions = 0
 
         tr = self.transaction()
@@ -1331,7 +1343,8 @@
         self.ui.status(_("adding file changes\n"))
         while 1:
             f = getchunk()
-            if not f: break
+            if not f:
+                break
             self.ui.debug(_("adding %s revisions\n") % f)
             fl = self.file(f)
             o = fl.count()
@@ -1352,7 +1365,7 @@
 
         if changesets > 0:
             if not self.hook("changegroup",
-                              node=hex(self.changelog.node(cor+1))):
+                             node=hex(self.changelog.node(cor+1))):
                 self.ui.warn(_("abort: changegroup hook returned failure!\n"))
                 return 1
 
@@ -1388,9 +1401,9 @@
         if not forcemerge and not force:
             for f in u:
                 if f in m2:
-                     t1 = self.wread(f)
-                     t2 = self.file(f).read(m2[f])
-                     if cmp(t1, t2) != 0:
+                    t1 = self.wread(f)
+                    t2 = self.file(f).read(m2[f])
+                    if cmp(t1, t2) != 0:
                         raise util.Abort(_("'%s' already exists in the working"
                                            " dir and differs from remote") % f)
 
@@ -1423,7 +1436,8 @@
             wlock = self.wlock()
 
         for f in d:
-            if f in mw: del mw[f]
+            if f in mw:
+                del mw[f]
 
             # If we're jumping between revisions (as opposed to merging),
             # and if neither the working directory nor the target rev has
@@ -1435,7 +1449,8 @@
 
         # Compare manifests
         for f, n in mw.iteritems():
-            if choose and not choose(f): continue
+            if choose and not choose(f):
+                continue
             if f in m2:
                 s = 0
 
@@ -1478,7 +1493,8 @@
                         a, b, c = mfa.get(f, 0), mfw[f], mf2[f]
                         mode = ((a^b) | (a^c)) ^ a
                         if mode != b:
-                            self.ui.debug(_(" updating permissions for %s\n") % f)
+                            self.ui.debug(_(" updating permissions for %s\n")
+                                          % f)
                             util.set_exec(self.wjoin(f), mode)
                 del m2[f]
             elif f in ma:
@@ -1508,15 +1524,18 @@
                     self.ui.debug(_("working dir created %s, keeping\n") % f)
 
         for f, n in m2.iteritems():
-            if choose and not choose(f): continue
-            if f[0] == "/": continue
+            if choose and not choose(f):
+                continue
+            if f[0] == "/":
+                continue
             if f in ma and n != ma[f]:
                 r = _("k")
                 if not force and (linear_path or allow):
                     r = self.ui.prompt(
                         (_("remote changed %s which local deleted\n") % f) +
                          _("(k)eep or (d)elete?"), _("[kd]"), _("k"))
-                if r == _("k"): get[f] = n
+                if r == _("k"):
+                    get[f] = n
             elif f not in ma:
                 self.ui.debug(_("remote created %s\n") % f)
                 get[f] = n
@@ -1546,7 +1565,8 @@
                 fl.sort()
                 for f in fl:
                     cf = ""
-                    if f in merge: cf = _(" (resolve)")
+                    if f in merge:
+                        cf = _(" (resolve)")
                     self.ui.status(" %s%s\n" % (f, cf))
                 self.ui.warn(_("aborting update spanning branches!\n"))
                 self.ui.status(_("(use update -m to merge across branches"
@@ -1558,7 +1578,8 @@
         files = get.keys()
         files.sort()
         for f in files:
-            if f[0] == "/": continue
+            if f[0] == "/":
+                continue
             self.ui.note(_("getting %s\n") % f)
             t = self.file(f).read(get[f])
             self.wwrite(f, t)
@@ -1721,7 +1742,7 @@
 
         self.ui.status(_("crosschecking files in changesets and manifests\n"))
 
-        for m,c in neededmanifests.items():
+        for m, c in neededmanifests.items():
             err(_("Changeset %s refers to unknown manifest %s") %
                 (short(m), short(c)))
         del neededmanifests
@@ -1738,14 +1759,15 @@
         ff = filenodes.keys()
         ff.sort()
         for f in ff:
-            if f == "/dev/null": continue
+            if f == "/dev/null":
+                continue
             files += 1
             fl = self.file(f)
             d = fl.checksize()
             if d:
                 err(_("%s file data short %d bytes") % (f, d))
 
-            nodes = { nullid: 1 }
+            nodes = {nullid: 1}
             seen = {}
             for i in range(fl.count()):
                 revisions += 1