D1371: global: remove redundant parenthesis

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Sun Nov 12 02:55:56 UTC 2017


indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  My code editor was spewing several warnings for redundant
  parenthesis. It supports easily fixing them. So I just did it
  globally.
  
  What redundant parenthesis are left are in 3rd party code or
  are needed around string literals so our style checker doesn't
  complain about the lack of _().

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1371

AFFECTED FILES
  contrib/check-config.py
  contrib/import-checker.py
  contrib/perf.py
  contrib/revsetbenchmarks.py
  doc/check-seclevel.py
  doc/docchecker
  doc/gendoc.py
  doc/hgmanpage.py
  hgext/bugzilla.py
  hgext/churn.py
  hgext/convert/convcmd.py
  hgext/convert/cvs.py
  hgext/convert/git.py
  hgext/convert/monotone.py
  hgext/convert/p4.py
  hgext/convert/subversion.py
  hgext/factotum.py
  hgext/hgk.py
  hgext/keyword.py
  hgext/largefiles/basestore.py
  hgext/largefiles/lfcommands.py
  hgext/largefiles/lfutil.py
  hgext/largefiles/overrides.py
  hgext/mq.py
  hgext/patchbomb.py
  hgext/show.py
  hgext/transplant.py
  hgext/uncommit.py
  hgext/win32mbcs.py
  mercurial/bookmarks.py
  mercurial/bundlerepo.py
  mercurial/byterange.py
  mercurial/changegroup.py
  mercurial/chgserver.py
  mercurial/cmdutil.py
  mercurial/commands.py
  mercurial/config.py
  mercurial/context.py
  mercurial/crecord.py
  mercurial/debugcommands.py
  mercurial/destutil.py
  mercurial/dirstate.py
  mercurial/discovery.py
  mercurial/dispatch.py
  mercurial/exchange.py
  mercurial/extensions.py
  mercurial/filelog.py
  mercurial/filemerge.py
  mercurial/fileset.py
  mercurial/hbisect.py
  mercurial/hg.py
  mercurial/hgweb/webutil.py
  mercurial/localrepo.py
  mercurial/mail.py
  mercurial/manifest.py
  mercurial/match.py
  mercurial/merge.py
  mercurial/minirst.py
  mercurial/obsolete.py
  mercurial/parser.py
  mercurial/patch.py
  mercurial/posix.py
  mercurial/progress.py
  mercurial/pure/base85.py
  mercurial/pure/mpatch.py
  mercurial/pure/parsers.py
  mercurial/revlog.py
  mercurial/revsetlang.py
  mercurial/setdiscovery.py
  mercurial/sshpeer.py
  mercurial/statprof.py
  mercurial/subrepo.py
  mercurial/tags.py
  mercurial/templater.py
  mercurial/transaction.py
  mercurial/txnutil.py
  mercurial/ui.py
  mercurial/url.py
  mercurial/util.py
  tests/check-perf-code.py
  tests/flagprocessorext.py
  tests/hghave.py
  tests/run-tests.py

CHANGE DETAILS

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -550,7 +550,7 @@
     if options.showchannels:
         options.nodiff = True
 
-    return (options, args)
+    return options, args
 
 def rename(src, dst):
     """Like os.rename(), trade atomicity and opened files friendliness
@@ -947,7 +947,7 @@
 
     def _portmap(self, i):
         offset = b'' if i == 0 else b'%d' % i
-        return (br':%d\b' % (self._startport + i), b':$HGPORT%s' % offset)
+        return br':%d\b' % (self._startport + i), b':$HGPORT%s' % offset
 
     def _getreplacements(self):
         """Obtain a mapping of text replacements to apply to test output.
@@ -1108,7 +1108,7 @@
             proc = subprocess.Popen(cmd, shell=True, cwd=self._testtmp,
                                     env=env)
             ret = proc.wait()
-            return (ret, None)
+            return ret, None
 
         proc = Popen4(cmd, self._testtmp, self._timeout, env)
         def cleanup():
diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -243,8 +243,8 @@
 def gethgversion():
     m = matchoutput('hg --version --quiet 2>&1', br'(\d+)\.(\d+)')
     if not m:
-        return (0, 0)
-    return (int(m.group(1)), int(m.group(2)))
+        return 0, 0
+    return int(m.group(1)), int(m.group(2))
 
 @checkvers("hg", "Mercurial >= %s",
             list([(1.0 * x) / 10 for x in range(9, 99)]))
@@ -281,8 +281,8 @@
 def getgitversion():
     m = matchoutput('git --version 2>&1', br'git version (\d+)\.(\d+)')
     if not m:
-        return (0, 0)
-    return (int(m.group(1)), int(m.group(2)))
+        return 0, 0
+    return int(m.group(1)), int(m.group(2))
 
 @checkvers("git", "git client (with ext::sh support) version >= %s", (1.9,))
 def has_git_range(v):
@@ -301,8 +301,8 @@
 def getsvnversion():
     m = matchoutput('svn --version --quiet 2>&1', br'^(\d+)\.(\d+)')
     if not m:
-        return (0, 0)
-    return (int(m.group(1)), int(m.group(2)))
+        return 0, 0
+    return int(m.group(1)), int(m.group(2))
 
 @checkvers("svn", "subversion client and admin tools >= %s", (1.3, 1.5))
 def has_svn_range(v):
@@ -607,7 +607,7 @@
 @check("demandimport", "demandimport enabled")
 def has_demandimport():
     # chg disables demandimport intentionally for performance wins.
-    return ((not has_chg()) and os.environ.get('HGDEMANDIMPORT') != 'disable')
+    return (not has_chg()) and os.environ.get('HGDEMANDIMPORT') != 'disable'
 
 @check("py3k", "running with Python 3.x")
 def has_py3k():
diff --git a/tests/flagprocessorext.py b/tests/flagprocessorext.py
--- a/tests/flagprocessorext.py
+++ b/tests/flagprocessorext.py
@@ -29,19 +29,19 @@
     return False
 
 def noopdonothing(self, text):
-    return (text, True)
+    return text, True
 
 def b64encode(self, text):
-    return (base64.b64encode(text), False)
+    return base64.b64encode(text), False
 
 def b64decode(self, text):
-    return (base64.b64decode(text), True)
+    return base64.b64decode(text), True
 
 def gzipcompress(self, text):
-    return (zlib.compress(text), False)
+    return zlib.compress(text), False
 
 def gzipdecompress(self, text):
-    return (zlib.decompress(text), True)
+    return zlib.decompress(text), True
 
 def supportedoutgoingversions(orig, repo):
     versions = orig(repo)
diff --git a/tests/check-perf-code.py b/tests/check-perf-code.py
--- a/tests/check-perf-code.py
+++ b/tests/check-perf-code.py
@@ -23,9 +23,9 @@
 ]
 
 def modulewhitelist(names):
-    replacement = [('.py', ''), ('.c', ''), # trim suffix
-                   ('mercurial%s' % (os.sep), ''), # trim "mercurial/" path
-                  ]
+    replacement = [('.py', ''), ('.c', ''),  # trim suffix
+                   ('mercurial%s' % os.sep, ''),  # trim "mercurial/" path
+                   ]
     ignored = {'__init__'}
     modules = {}
 
diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -517,11 +517,11 @@
         vints.append(None)
 
     if n == 2:
-        return (vints[0], vints[1])
+        return vints[0], vints[1]
     if n == 3:
-        return (vints[0], vints[1], vints[2])
+        return vints[0], vints[1], vints[2]
     if n == 4:
-        return (vints[0], vints[1], vints[2], extra)
+        return vints[0], vints[1], vints[2], extra
 
 # used by parsedate
 defaultdateformats = (
@@ -1693,7 +1693,7 @@
         S[n].mtime", even if size of a file isn't changed.
         """
         try:
-            return (self.stat.st_ctime == old.stat.st_ctime)
+            return self.stat.st_ctime == old.stat.st_ctime
         except AttributeError:
             return False
 
@@ -2418,7 +2418,7 @@
             for i in xrange(len(ucstr)):
                 l += colwidth(ucstr[i])
                 if space_left < l:
-                    return (ucstr[:i], ucstr[i:])
+                    return ucstr[:i], ucstr[i:]
             return ucstr, ''
 
         # overriding of base class
@@ -2968,7 +2968,7 @@
         finally:
             self.user, self.passwd = user, passwd
         if not self.user:
-            return (s, None)
+            return s, None
         # authinfo[1] is passed to urllib2 password manager, and its
         # URIs must not contain credentials. The host is passed in the
         # URIs list because Python < 2.4.3 uses only that to search for
diff --git a/mercurial/url.py b/mercurial/url.py
--- a/mercurial/url.py
+++ b/mercurial/url.py
@@ -58,7 +58,7 @@
         user, passwd = authinfo
         if user and passwd:
             self._writedebug(user, passwd)
-            return (user, passwd)
+            return user, passwd
 
         if not user or not passwd:
             res = httpconnectionmod.readauthforuri(self.ui, authuri, user)
@@ -86,7 +86,7 @@
 
         self.passwddb.add_password(realm, authuri, user, passwd)
         self._writedebug(user, passwd)
-        return (user, passwd)
+        return user, passwd
 
     def _writedebug(self, user, passwd):
         msg = _('http auth: user %s, password %s\n')
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -1317,7 +1317,7 @@
         def choicetuple(s):
             ampidx = s.index('&')
             return s[ampidx + 1:ampidx + 2].lower(), s.replace('&', '', 1)
-        return (msg, [choicetuple(s) for s in choices])
+        return msg, [choicetuple(s) for s in choices]
 
     def promptchoice(self, prompt, default=0):
         """Prompt user with a message, read response, and ensure it matches
diff --git a/mercurial/txnutil.py b/mercurial/txnutil.py
--- a/mercurial/txnutil.py
+++ b/mercurial/txnutil.py
@@ -29,8 +29,8 @@
     '''
     if mayhavepending(root):
         try:
-            return (vfs('%s.pending' % filename, **kwargs), True)
+            return vfs('%s.pending' % filename, **kwargs), True
         except IOError as inst:
             if inst.errno != errno.ENOENT:
                 raise
-    return (vfs(filename, **kwargs), False)
+    return vfs(filename, **kwargs), False
diff --git a/mercurial/transaction.py b/mercurial/transaction.py
--- a/mercurial/transaction.py
+++ b/mercurial/transaction.py
@@ -319,7 +319,7 @@
             # for generation at closing, check if it's before or after finalize
             postfinalize = group == gengrouppostfinalize
             if (group != gengroupall and
-                (id in postfinalizegenerators) != (postfinalize)):
+                (id in postfinalizegenerators) != postfinalize):
                 continue
 
             vfs = self._vfsmap[location]
diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -218,7 +218,7 @@
     assert len(tree) == 2
     xs = tuple(_unnesttemplatelist(x) for x in tree[1])
     if not xs:
-        return ('string', '')  # empty template ""
+        return 'string', ''  # empty template ""
     elif len(xs) == 1 and xs[0][0] == 'string':
         return xs[0]  # fast path for string with no template fragment "x"
     else:
@@ -400,7 +400,7 @@
 
 def buildtemplate(exp, context):
     ctmpl = [compileexp(e, context, methods) for e in exp[1:]]
-    return (runtemplate, ctmpl)
+    return runtemplate, ctmpl
 
 def runtemplate(context, mapping, template):
     for arg in template:
@@ -411,11 +411,11 @@
     if n in context._filters:
         filt = context._filters[n]
         arg = compileexp(exp[1], context, methods)
-        return (runfilter, (arg, filt))
+        return runfilter, (arg, filt)
     if n in funcs:
         f = funcs[n]
         args = _buildfuncargs(exp[1], context, methods, n, f._argspec)
-        return (f, args)
+        return f, args
     raise error.ParseError(_("unknown function '%s'") % n)
 
 def runfilter(context, mapping, data):
@@ -436,7 +436,7 @@
 def buildmap(exp, context):
     darg = compileexp(exp[1], context, methods)
     targ = gettemplate(exp[2], context)
-    return (runmap, (darg, targ))
+    return runmap, (darg, targ)
 
 def runmap(context, mapping, data):
     darg, targ = data
@@ -469,7 +469,7 @@
 def buildmember(exp, context):
     darg = compileexp(exp[1], context, methods)
     memb = getsymbol(exp[2])
-    return (runmember, (darg, memb))
+    return runmember, (darg, memb)
 
 def runmember(context, mapping, data):
     darg, memb = data
@@ -489,7 +489,7 @@
 
 def buildnegate(exp, context):
     arg = compileexp(exp[1], context, exprmethods)
-    return (runnegate, arg)
+    return runnegate, arg
 
 def runnegate(context, mapping, data):
     data = evalinteger(context, mapping, data,
@@ -499,7 +499,7 @@
 def buildarithmetic(exp, context, func):
     left = compileexp(exp[1], context, exprmethods)
     right = compileexp(exp[2], context, exprmethods)
-    return (runarithmetic, (func, left, right))
+    return runarithmetic, (func, left, right)
 
 def runarithmetic(context, mapping, data):
     func, left, right = data
@@ -517,13 +517,13 @@
     if n in funcs:
         f = funcs[n]
         args = _buildfuncargs(exp[2], context, exprmethods, n, f._argspec)
-        return (f, args)
+        return f, args
     if n in context._filters:
         args = _buildfuncargs(exp[2], context, exprmethods, n, argspec=None)
         if len(args) != 1:
             raise error.ParseError(_("filter %s expects one argument") % n)
         f = context._filters[n]
-        return (runfilter, (args[0], f))
+        return runfilter, (args[0], f)
     raise error.ParseError(_("unknown function '%s'") % n)
 
 def _buildfuncargs(exp, context, curmethods, funcname, argspec):
@@ -911,7 +911,7 @@
                 raise error.ParseError(_("localdate expects a timezone"))
     else:
         tzoffset = util.makedate()[1]
-    return (date[0], tzoffset)
+    return date[0], tzoffset
 
 @templatefunc('max(iterable)')
 def max_(context, mapping, args, **kwargs):
diff --git a/mercurial/tags.py b/mercurial/tags.py
--- a/mercurial/tags.py
+++ b/mercurial/tags.py
@@ -419,7 +419,7 @@
             and cachehash == scmutil.filteredhash(repo, tiprev)):
         tags = _readtags(ui, repo, cachelines, cachefile.name)
         cachefile.close()
-        return (None, None, None, tags, False)
+        return None, None, None, tags, False
     if cachefile:
         cachefile.close()               # ignore rest of file
 
@@ -429,7 +429,7 @@
     # Case 2 (uncommon): empty repo; get out quickly and don't bother
     # writing an empty cache.
     if repoheads == [nullid]:
-        return ([], {}, valid, {}, False)
+        return [], {}, valid, {}, False
 
     # Case 3 (uncommon): cache file missing or empty.
 
@@ -447,7 +447,7 @@
     if not len(repo.file('.hgtags')):
         # No tags have ever been committed, so we can avoid a
         # potentially expensive search.
-        return ([], {}, valid, None, True)
+        return [], {}, valid, None, True
 
 
     # Now we have to lookup the .hgtags filenode for every new head.
@@ -458,7 +458,7 @@
 
     # Caller has to iterate over all heads, but can use the filenodes in
     # cachefnode to get to each .hgtags revision quickly.
-    return (repoheads, cachefnode, valid, None, True)
+    return repoheads, cachefnode, valid, None, True
 
 def _getfnodes(ui, repo, nodes):
     """return .hgtags fnodes for a list of changeset nodes
@@ -760,7 +760,7 @@
             lock = repo.wlock(wait=False)
         except error.LockError:
             repo.ui.log('tagscache', 'not writing .hg/cache/%s because '
-                        'lock cannot be acquired\n' % (_fnodescachefile))
+                        'lock cannot be acquired\n' % _fnodescachefile)
             return
 
         try:
diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -431,7 +431,7 @@
     check = ui.config('phases', 'checksubrepos')
     if check not in ('ignore', 'follow', 'abort'):
         raise error.Abort(_('invalid phases.checksubrepos configuration: %s')
-                         % (check))
+                          % check)
     if check == 'ignore':
         return commitphase
     maxphase = phases.public
@@ -629,7 +629,7 @@
         '''
 
     def forget(self, match, prefix):
-        return ([], [])
+        return [], []
 
     def removefiles(self, matcher, prefix, after, force, subrepos, warnings):
         """remove the matched files from the subrepository and the filesystem,
@@ -1217,7 +1217,7 @@
         m = re.search(br'^(\d+)\.(\d+)', output)
         if not m:
             raise error.Abort(_('cannot retrieve svn tool version'))
-        return (int(m.group(1)), int(m.group(2)))
+        return int(m.group(1)), int(m.group(2))
 
     def _wcrevs(self):
         # Get the working directory revision as well as the last
@@ -1232,7 +1232,7 @@
             commits = entries[0].getElementsByTagName('commit')
             if commits:
                 lastrev = str(commits[0].getAttribute('revision')) or '0'
-        return (lastrev, rev)
+        return lastrev, rev
 
     def _wcrev(self):
         return self._wcrevs()[0]
@@ -1435,11 +1435,11 @@
     def _gitversion(out):
         m = re.search(br'^git version (\d+)\.(\d+)\.(\d+)', out)
         if m:
-            return (int(m.group(1)), int(m.group(2)), int(m.group(3)))
+            return int(m.group(1)), int(m.group(2)), int(m.group(3))
 
         m = re.search(br'^git version (\d+)\.(\d+)', out)
         if m:
-            return (int(m.group(1)), int(m.group(2)), 0)
+            return int(m.group(1)), int(m.group(2)), 0
 
         return -1
 
diff --git a/mercurial/statprof.py b/mercurial/statprof.py
--- a/mercurial/statprof.py
+++ b/mercurial/statprof.py
@@ -539,7 +539,7 @@
                 stattuple = (stat.selfpercent(), stat.selfseconds(),
                              stat.site.lineno, source)
 
-                print('%33.0f%% %6.2f   line %s: %s' % (stattuple), file=fp)
+                print('%33.0f%% %6.2f   line %s: %s' % stattuple, file=fp)
 
 def display_about_method(data, fp, function=None, **kwargs):
     if function is None:
diff --git a/mercurial/sshpeer.py b/mercurial/sshpeer.py
--- a/mercurial/sshpeer.py
+++ b/mercurial/sshpeer.py
@@ -64,14 +64,14 @@
         (This will only wait for data if the setup is supported by `util.poll`)
         """
         if getattr(self._main, 'hasbuffer', False): # getattr for classic pipe
-            return (True, True) # main has data, assume side is worth poking at.
+            return True, True  # main has data, assume side is worth poking at.
         fds = [self._main.fileno(), self._side.fileno()]
         try:
             act = util.poll(fds)
         except NotImplementedError:
             # non supported yet case, assume all have data.
             act = fds
-        return (self._main.fileno() in act, self._side.fileno() in act)
+        return self._main.fileno() in act, self._side.fileno() in act
 
     def write(self, data):
         return self._call('write', data)
diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py
--- a/mercurial/setdiscovery.py
+++ b/mercurial/setdiscovery.py
@@ -168,12 +168,12 @@
     srvheads = dag.internalizeall(srvheadhashes, filterunknown=True)
     if len(srvheads) == len(srvheadhashes):
         ui.debug("all remote heads known locally\n")
-        return (srvheadhashes, False, srvheadhashes,)
+        return srvheadhashes, False, srvheadhashes,
 
     if sample and len(ownheads) <= initialsamplesize and all(yesno):
         ui.note(_("all local heads known remotely\n"))
         ownheadhashes = dag.externalizeall(ownheads)
-        return (ownheadhashes, True, srvheadhashes,)
+        return ownheadhashes, True, srvheadhashes,
 
     # full blown discovery
 
@@ -252,7 +252,7 @@
             raise error.Abort(_("repository is unrelated"))
         else:
             ui.warn(_("warning: repository is unrelated\n"))
-        return ({nullid}, True, srvheadhashes,)
+        return {nullid}, True, srvheadhashes,
 
     anyincoming = (srvheadhashes != [nullid])
     return dag.externalizeall(result), anyincoming, srvheadhashes
diff --git a/mercurial/revsetlang.py b/mercurial/revsetlang.py
--- a/mercurial/revsetlang.py
+++ b/mercurial/revsetlang.py
@@ -295,7 +295,7 @@
     elif op == 'or':
         # make number of arguments deterministic:
         # x + y + z -> (or x y z) -> (or (list x y z))
-        return (op, _fixops(('list',) + x[1:]))
+        return op, _fixops(('list',) + x[1:])
     elif op == 'subscript' and x[1][0] == 'relation':
         # x#y[z] ternary
         return _fixops(('relsubscript', x[1][1], x[1][2], x[2]))
@@ -323,27 +323,27 @@
     elif op in ('string', 'symbol'):
         return x
     elif op == 'rangeall':
-        return (op, None)
+        return op, None
     elif op in {'or', 'not', 'rangepre', 'rangepost', 'parentpost'}:
-        return (op, _analyze(x[1]))
+        return op, _analyze(x[1])
     elif op == 'group':
         return _analyze(x[1])
     elif op in {'and', 'dagrange', 'range', 'parent', 'ancestor', 'relation',
                 'subscript'}:
         ta = _analyze(x[1])
         tb = _analyze(x[2])
-        return (op, ta, tb)
+        return op, ta, tb
     elif op == 'relsubscript':
         ta = _analyze(x[1])
         tb = _analyze(x[2])
         tc = _analyze(x[3])
-        return (op, ta, tb, tc)
+        return op, ta, tb, tc
     elif op == 'list':
         return (op,) + tuple(_analyze(y) for y in x[1:])
     elif op == 'keyvalue':
-        return (op, x[1], _analyze(x[2]))
+        return op, x[1], _analyze(x[2])
     elif op == 'func':
-        return (op, x[1], _analyze(x[2]))
+        return op, x[1], _analyze(x[2])
     raise ValueError('invalid operator %r' % op)
 
 def analyze(x):
@@ -507,7 +507,7 @@
     if warn is not None:
         for name, alias in sorted(aliases.iteritems()):
             if alias.error and not alias.warned:
-                warn(_('warning: %s\n') % (alias.error))
+                warn(_('warning: %s\n') % alias.error)
                 alias.warned = True
     return tree
 
@@ -528,7 +528,7 @@
             else:
                 msg = _("\"##\" can't concatenate \"%s\" element") % (e[0])
                 raise error.ParseError(msg)
-        return ('string', ''.join(l))
+        return 'string', ''.join(l)
     else:
         return tuple(foldconcat(t) for t in tree)
 
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -114,13 +114,13 @@
       contents can be used for hash integrity checks.
     """
     if not flag & REVIDX_KNOWN_FLAGS:
-        msg = _("cannot register processor on unknown flag '%#x'.") % (flag)
+        msg = _("cannot register processor on unknown flag '%#x'.") % flag
         raise ProgrammingError(msg)
     if flag not in REVIDX_FLAGS_ORDER:
-        msg = _("flag '%#x' undefined in REVIDX_FLAGS_ORDER.") % (flag)
+        msg = _("flag '%#x' undefined in REVIDX_FLAGS_ORDER.") % flag
         raise ProgrammingError(msg)
     if flag in _flagprocessors:
-        msg = _("cannot register multiple processors on flag '%#x'.") % (flag)
+        msg = _("cannot register multiple processors on flag '%#x'.") % flag
         raise error.Abort(msg)
     _flagprocessors[flag] = processor
 
@@ -486,7 +486,7 @@
         try:
             d = self._io.parseindex(indexdata, self._inline)
         except (ValueError, IndexError):
-            raise RevlogError(_("index %s is corrupted") % (self.indexfile))
+            raise RevlogError(_("index %s is corrupted") % self.indexfile)
         self.index, nodemap, self._chunkcache = d
         if nodemap is not None:
             self.nodemap = self._nodecache = nodemap
@@ -911,7 +911,7 @@
             lowestrev = nullrev
         if (lowestrev == nullrev) and (heads is None):
             # We want _all_ the nodes!
-            return ([self.node(r) for r in self], [nullid], list(self.heads()))
+            return [self.node(r) for r in self], [nullid], list(self.heads())
         if heads is None:
             # All nodes are ancestors, so the latest ancestor is the last
             # node.
@@ -1032,7 +1032,7 @@
         assert orderedout
         assert roots
         assert heads
-        return (orderedout, roots, heads)
+        return orderedout, roots, heads
 
     def headrevs(self):
         try:
@@ -1584,7 +1584,7 @@
         if flags == 0:
             return text, True
         if not operation in ('read', 'write'):
-            raise ProgrammingError(_("invalid '%s' operation ") % (operation))
+            raise ProgrammingError(_("invalid '%s' operation ") % operation)
         # Check all flags are known.
         if flags & ~REVIDX_KNOWN_FLAGS:
             raise RevlogError(_("incompatible revision flag '%#x'") %
@@ -1603,7 +1603,7 @@
                 vhash = True
 
                 if flag not in _flagprocessors:
-                    message = _("missing processor for flag '%#x'") % (flag)
+                    message = _("missing processor for flag '%#x'") % flag
                     raise RevlogError(message)
 
                 processor = _flagprocessors[flag]
@@ -1856,10 +1856,10 @@
         """
         if node == nullid:
             raise RevlogError(_("%s: attempt to add null revision") %
-                              (self.indexfile))
+                              self.indexfile)
         if node == wdirid:
             raise RevlogError(_("%s: attempt to add wdir revision") %
-                              (self.indexfile))
+                              self.indexfile)
 
         btext = [rawtext]
         def buildtext():
@@ -2252,7 +2252,7 @@
                 raise
             di = 0
 
-        return (dd, di)
+        return dd, di
 
     def files(self):
         res = [self.indexfile]
diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py
--- a/mercurial/pure/parsers.py
+++ b/mercurial/pure/parsers.py
@@ -57,7 +57,7 @@
     def __getitem__(self, i):
         i = self._fix_index(i)
         if i == len(self) - 1:
-            return (0, 0, 0, -1, -1, -1, -1, nullid)
+            return 0, 0, 0, -1, -1, -1, -1, nullid
         if i >= self._lgt:
             return self._extra[i - self._lgt]
         index = self._calculate_index(i)
diff --git a/mercurial/pure/mpatch.py b/mercurial/pure/mpatch.py
--- a/mercurial/pure/mpatch.py
+++ b/mercurial/pure/mpatch.py
@@ -51,7 +51,7 @@
     for l, p in reversed(list):
         _move(m, buf, p, l)
         buf += l
-    return (buf - start, start)
+    return buf - start, start
 
 def patches(a, bins):
     if not bins:
diff --git a/mercurial/pure/base85.py b/mercurial/pure/base85.py
--- a/mercurial/pure/base85.py
+++ b/mercurial/pure/base85.py
@@ -25,7 +25,7 @@
     if r:
         text += '\0' * (4 - r)
     longs = len(text) >> 2
-    words = struct.unpack('>%dL' % (longs), text)
+    words = struct.unpack('>%dL' % longs, text)
 
     out = ''.join(_b85chars[(word // 52200625) % 85] +
                   _b85chars2[(word // 7225) % 7225] +
diff --git a/mercurial/progress.py b/mercurial/progress.py
--- a/mercurial/progress.py
+++ b/mercurial/progress.py
@@ -27,7 +27,7 @@
     This will properly display seconds, minutes, hours, days if needed"""
     if seconds < 60:
         # i18n: format XX seconds as "XXs"
-        return _("%02ds") % (seconds)
+        return _("%02ds") % seconds
     minutes = seconds // 60
     if minutes < 60:
         seconds -= minutes * 60
diff --git a/mercurial/posix.py b/mercurial/posix.py
--- a/mercurial/posix.py
+++ b/mercurial/posix.py
@@ -102,7 +102,7 @@
 
 def isexec(f):
     """check whether a file is executable"""
-    return (os.lstat(f).st_mode & 0o100 != 0)
+    return os.lstat(f).st_mode & 0o100 != 0
 
 def setflags(f, l, x):
     st = os.lstat(f)
diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -456,16 +456,16 @@
 
     def getfile(self, fname):
         if self.opener.islink(fname):
-            return (self.opener.readlink(fname), (True, False))
+            return self.opener.readlink(fname), (True, False)
 
         isexec = False
         try:
             isexec = self.opener.lstat(fname).st_mode & 0o100 != 0
         except OSError as e:
             if e.errno != errno.ENOENT:
                 raise
         try:
-            return (self.opener.read(fname), (False, isexec))
+            return self.opener.read(fname), (False, isexec)
         except IOError as e:
             if e.errno != errno.ENOENT:
                 raise
@@ -1941,28 +1941,28 @@
     while i < len(binchunk):
         cmd = ord(binchunk[i])
         i += 1
-        if (cmd & 0x80):
+        if cmd & 0x80:
             offset = 0
             size = 0
-            if (cmd & 0x01):
+            if cmd & 0x01:
                 offset = ord(binchunk[i])
                 i += 1
-            if (cmd & 0x02):
+            if cmd & 0x02:
                 offset |= ord(binchunk[i]) << 8
                 i += 1
-            if (cmd & 0x04):
+            if cmd & 0x04:
                 offset |= ord(binchunk[i]) << 16
                 i += 1
-            if (cmd & 0x08):
+            if cmd & 0x08:
                 offset |= ord(binchunk[i]) << 24
                 i += 1
-            if (cmd & 0x10):
+            if cmd & 0x10:
                 size = ord(binchunk[i])
                 i += 1
-            if (cmd & 0x20):
+            if cmd & 0x20:
                 size |= ord(binchunk[i]) << 8
                 i += 1
-            if (cmd & 0x40):
+            if cmd & 0x40:
                 size |= ord(binchunk[i]) << 16
                 i += 1
             if size == 0:
diff --git a/mercurial/parser.py b/mercurial/parser.py
--- a/mercurial/parser.py
+++ b/mercurial/parser.py
@@ -507,28 +507,28 @@
         try:
             tree = cls._parse(decl)
         except error.ParseError as inst:
-            return (decl, None, parseerrordetail(inst))
+            return decl, None, parseerrordetail(inst)
 
         if tree[0] == cls._symbolnode:
             # "name = ...." style
             name = tree[1]
             if name.startswith('$'):
-                return (decl, None, _("invalid symbol '%s'") % name)
-            return (name, None, None)
+                return decl, None, _("invalid symbol '%s'") % name
+            return name, None, None
 
         func = cls._trygetfunc(tree)
         if func:
             # "name(arg, ....) = ...." style
             name, args = func
             if name.startswith('$'):
-                return (decl, None, _("invalid function '%s'") % name)
+                return decl, None, _("invalid function '%s'") % name
             if any(t[0] != cls._symbolnode for t in args):
-                return (decl, None, _("invalid argument list"))
+                return decl, None, _("invalid argument list")
             if len(args) != len(set(args)):
-                return (name, None, _("argument names collide with each other"))
-            return (name, [t[1] for t in args], None)
+                return name, None, _("argument names collide with each other")
+            return name, [t[1] for t in args], None
 
-        return (decl, None, _("invalid format"))
+        return decl, None, _("invalid format")
 
     @classmethod
     def _relabelargs(cls, tree, args):
@@ -545,7 +545,7 @@
             op = '_aliasarg'
         elif sym.startswith('$'):
             raise error.ParseError(_("invalid symbol '%s'") % sym)
-        return (op, sym)
+        return op, sym
 
     @classmethod
     def _builddefn(cls, defn, args):
diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -141,7 +141,7 @@
     exchangevalue = _getoptionvalue(repo, exchangeopt)
 
     # createmarkers must be enabled if other options are enabled
-    if ((unstabluevalue or exchangevalue) and not createmarkersvalue):
+    if (unstabluevalue or exchangevalue) and not createmarkersvalue:
         raise error.Abort(_("'createmarkers' obsolete option must be enabled "
                             "if other obsolete options are enabled"))
 
@@ -812,7 +812,7 @@
     currentlen = _maxpayload * 2  # ensure we create a new part
     for marker in markers:
         nextdata = _fm0encodeonemarker(marker)
-        if (len(nextdata) + currentlen > _maxpayload):
+        if len(nextdata) + currentlen > _maxpayload:
             currentpart = []
             currentlen = 0
             parts.append(currentpart)
diff --git a/mercurial/minirst.py b/mercurial/minirst.py
--- a/mercurial/minirst.py
+++ b/mercurial/minirst.py
@@ -234,8 +234,8 @@
                 noshortop = '   '
 
             opt = "%s%s" %   (shortoption and "-%s " % shortoption or '',
-                            ("%s--%s %s") % (noshortop, longoption,
-                                             longoptionarg))
+                            "%s--%s %s" % (noshortop, longoption,
+                                           longoptionarg))
             opt = opt.rstrip()
             blocks[j]['optstr'] = opt
             optstrwidth = max(optstrwidth, encoding.colwidth(opt))
@@ -457,7 +457,7 @@
     colwidth = encoding.colwidth(block['optstr'])
     usablewidth = width - 1
     hanging = block['optstrwidth']
-    initindent = '%s%s  ' % (block['optstr'], ' ' * ((hanging - colwidth)))
+    initindent = '%s%s  ' % (block['optstr'], ' ' * (hanging - colwidth))
     hangindent = ' ' * (encoding.colwidth(initindent) + 1)
     return ' %s\n' % (util.wrap(desc, usablewidth,
                                            initindent=initindent,
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -1008,7 +1008,7 @@
     # - ma is the same as m1 or m2, which we're just going to diff again later
     # - The caller specifically asks for a full diff, which is useful during bid
     #   merge.
-    if (pa not in ([wctx, p2] + wctx.parents()) and not forcefulldiff):
+    if pa not in ([wctx, p2] + wctx.parents()) and not forcefulldiff:
         # Identify which files are relevant to the merge, so we can limit the
         # total m1-vs-m2 diff to just those files. This has significant
         # performance benefits in large repositories.
diff --git a/mercurial/match.py b/mercurial/match.py
--- a/mercurial/match.py
+++ b/mercurial/match.py
@@ -401,7 +401,7 @@
         return self._prefix
 
     def __repr__(self):
-        return ('<patternmatcher patterns=%r>' % self._pats)
+        return '<patternmatcher patterns=%r>' % self._pats
 
 class includematcher(basematcher):
 
@@ -428,7 +428,7 @@
                     for parentdir in util.finddirs(dir)))
 
     def __repr__(self):
-        return ('<includematcher includes=%r>' % self._pats)
+        return '<includematcher includes=%r>' % self._pats
 
 class exactmatcher(basematcher):
     '''Matches the input files exactly. They are interpreted as paths, not
@@ -456,7 +456,7 @@
         return True
 
     def __repr__(self):
-        return ('<exactmatcher files=%r>' % self._files)
+        return '<exactmatcher files=%r>' % self._files
 
 class differencematcher(basematcher):
     '''Composes two matchers by matching if the first matches and the second
@@ -506,7 +506,7 @@
         return self._m1.isexact()
 
     def __repr__(self):
-        return ('<differencematcher m1=%r, m2=%r>' % (self._m1, self._m2))
+        return '<differencematcher m1=%r, m2=%r>' % (self._m1, self._m2)
 
 def intersectmatchers(m1, m2):
     '''Composes two matchers by matching if both of them match.
@@ -572,7 +572,7 @@
         return self._m1.isexact() or self._m2.isexact()
 
     def __repr__(self):
-        return ('<intersectionmatcher m1=%r, m2=%r>' % (self._m1, self._m2))
+        return '<intersectionmatcher m1=%r, m2=%r>' % (self._m1, self._m2)
 
 class subdirmatcher(basematcher):
     """Adapt a matcher to work on a subdirectory only.
@@ -685,7 +685,7 @@
         return r
 
     def __repr__(self):
-        return ('<unionmatcher matchers=%r>' % self._matchers)
+        return '<unionmatcher matchers=%r>' % self._matchers
 
 def patkind(pattern, default=None):
     '''If pattern is 'kind:pat' with a known kind, return kind.'''
diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -152,7 +152,7 @@
                             zeropos + 1, 40)
         flags = self.lm._getflags(data, self.pos, zeropos)
         self.pos += 1
-        return (data[pos:zeropos], hashval, flags)
+        return data[pos:zeropos], hashval, flags
 
     __next__ = next
 
@@ -239,13 +239,13 @@
             candidate = self._getkey(nextpos)
             r = _cmp(key, candidate)
             if r == 0:
-                return (midpoint, True)
+                return midpoint, True
             else:
                 if r < 0:
                     last = midpoint - 1
                 else:
                     first = midpoint + 1
-        return (first, False)
+        return first, False
 
     def __contains__(self, key):
         return self.bsearch(key) != -1
@@ -267,13 +267,13 @@
             raise KeyError
         data, pos = self._get(needle)
         if pos == -1:
-            return (data[1], data[2])
+            return data[1], data[2]
         zeropos = data.find('\x00', pos)
         assert 0 <= needle <= len(self.positions)
         assert len(self.extrainfo) == len(self.positions)
         hashval = unhexlify(data, self.extrainfo[needle], zeropos + 1, 40)
         flags = self._getflags(data, needle, zeropos)
-        return (hashval, flags)
+        return hashval, flags
 
     def __delitem__(self, key):
         needle, found = self.bsearch2(key)
@@ -663,7 +663,7 @@
             i += 1
         return i
     if not s:
-        return (lo, lo)
+        return lo, lo
     lenm = len(m)
     if not hi:
         hi = lenm
@@ -685,9 +685,9 @@
     if s == found:
         # we know that after the null there are 40 bytes of sha1
         end = advance(end + 40, '\n')
-        return (lo, end + 1)
+        return lo, end + 1
     else:
-        return (lo, lo)
+        return lo, lo
 
 def _checkforbidden(l):
     """Check filenames for illegal characters."""
diff --git a/mercurial/mail.py b/mercurial/mail.py
--- a/mercurial/mail.py
+++ b/mercurial/mail.py
@@ -48,7 +48,7 @@
             self.ehlo_resp = None
             self.esmtp_features = {}
             self.does_esmtp = 0
-        return (resp, reply)
+        return resp, reply
 
 class SMTPS(smtplib.SMTP):
     '''Derived class to verify the peer certificate for SMTPS.
@@ -116,7 +116,7 @@
         password = ui.getpass()
     if username and password:
         ui.note(_('(authenticating to mail server as %s)\n') %
-                  (username))
+                username)
         try:
             s.login(username, password)
         except smtplib.SMTPException as inst:
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -908,7 +908,7 @@
         tags['tip'] = self.changelog.tip()
         tagtypes = dict([(encoding.tolocal(name), value)
                          for (name, value) in tagtypes.iteritems()])
-        return (tags, tagtypes)
+        return tags, tagtypes
 
     def tagtype(self, tagname):
         '''
diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -102,7 +102,7 @@
         """
         if not self:
             # empty repo
-            return ({'before': (), 'after': ()},)
+            return {'before': (), 'after': ()},
 
         targets = []
         for f in _navseq(1, pagelen):
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -50,7 +50,7 @@
 
 def _local(path):
     path = util.expandpath(util.urllocalpath(path))
-    return (os.path.isfile(path) and bundlerepo or localrepo)
+    return os.path.isfile(path) and bundlerepo or localrepo
 
 def addbranchrevs(lrepo, other, branches, revs):
     peer = other.peer() # a courtesy to callers using a localrepo for other
diff --git a/mercurial/hbisect.py b/mercurial/hbisect.py
--- a/mercurial/hbisect.py
+++ b/mercurial/hbisect.py
@@ -98,7 +98,7 @@
     tot = len(candidates)
     unskipped = [c for c in candidates if (c not in skip) and (c != badrev)]
     if tot == 1 or not unskipped:
-        return ([changelog.node(c) for c in candidates], 0, good)
+        return [changelog.node(c) for c in candidates], 0, good
     perfect = tot // 2
 
     # find the best node to test
@@ -137,7 +137,7 @@
     assert best_rev is not None
     best_node = changelog.node(best_rev)
 
-    return ([best_node], tot, good)
+    return [best_node], tot, good
 
 def extendrange(repo, state, nodes, good):
     # bisect is incomplete when it ends on a merge node and
diff --git a/mercurial/fileset.py b/mercurial/fileset.py
--- a/mercurial/fileset.py
+++ b/mercurial/fileset.py
@@ -503,7 +503,7 @@
         fast = not matchmod.patkind(pat)
         if fast:
             def m(s):
-                return (s == pat)
+                return s == pat
         else:
             m = matchmod.match(ctx.repo().root, '', [pat], ctx=ctx)
         return [sub for sub in sstate if m(sub)]
diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -158,25 +158,25 @@
             return ":prompt", None
         else:
             if toolpath:
-                return (force, util.shellquote(toolpath))
+                return force, util.shellquote(toolpath)
             else:
                 # mimic HGMERGE if given tool not found
-                return (force, force)
+                return force, force
 
     # HGMERGE takes next precedence
     hgmerge = encoding.environ.get("HGMERGE")
     if hgmerge:
         if changedelete and not supportscd(hgmerge):
             return ":prompt", None
         else:
-            return (hgmerge, hgmerge)
+            return hgmerge, hgmerge
 
     # then patterns
     for pat, tool in ui.configitems("merge-patterns"):
         mf = match.match(repo.root, '', [pat])
         if mf(path) and check(tool, pat, symlink, False, changedelete):
             toolpath = _findtool(ui, tool)
-            return (tool, util.shellquote(toolpath))
+            return tool, util.shellquote(toolpath)
 
     # then merge tools
     tools = {}
@@ -195,13 +195,13 @@
         # external tools defined in uimerge won't be able to handle
         # change/delete conflicts
         if uimerge not in names and not changedelete:
-            return (uimerge, uimerge)
+            return uimerge, uimerge
         tools.insert(0, (None, uimerge)) # highest priority
     tools.append((None, "hgmerge")) # the old default, if found
     for p, t in tools:
         if check(t, None, symlink, binary, changedelete):
             toolpath = _findtool(ui, t)
-            return (t, util.shellquote(toolpath))
+            return t, util.shellquote(toolpath)
 
     # internal merge or prompt as last resort
     if symlink or binary or changedelete:
diff --git a/mercurial/filelog.py b/mercurial/filelog.py
--- a/mercurial/filelog.py
+++ b/mercurial/filelog.py
@@ -62,7 +62,7 @@
         t = self.revision(node)
         m = parsemeta(t)[0]
         if m and "copy" in m:
-            return (m["copy"], revlog.bin(m["copyrev"]))
+            return m["copy"], revlog.bin(m["copyrev"])
         return False
 
     def size(self, rev):
diff --git a/mercurial/extensions.py b/mercurial/extensions.py
--- a/mercurial/extensions.py
+++ b/mercurial/extensions.py
@@ -671,7 +671,7 @@
                 break
         else:
             cmd = aliases[0]
-        return (cmd, name, mod)
+        return cmd, name, mod
 
     ext = None
     # first, search for an extension with the same name as the command
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -1405,7 +1405,7 @@
     ui = pullop.repo.ui
     legacyphase = 'phases' in ui.configlist('devel', 'legacy.exchange')
     hasbinaryphase = 'heads' in pullop.remotebundle2caps.get('phases', ())
-    if (not legacyphase and hasbinaryphase):
+    if not legacyphase and hasbinaryphase:
         kwargs['phases'] = True
         pullop.stepsdone.add('phases')
 
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -124,7 +124,7 @@
     if len(inst.args) > 1:
         write(_("hg: parse error at %s: %s\n") %
                          (inst.args[1], inst.args[0]))
-        if (inst.args[0][0] == ' '):
+        if inst.args[0][0] == ' ':
             write(_("unexpected leading whitespace\n"))
     else:
         write(_("hg: parse error: %s\n") % inst.args[0])
@@ -619,7 +619,7 @@
         options[n] = cmdoptions[n]
         del cmdoptions[n]
 
-    return (cmd, cmd and entry[0] or None, args, options, cmdoptions)
+    return cmd, cmd and entry[0] or None, args, options, cmdoptions
 
 def _parseconfig(ui, config):
     """parse the --config options from the command line"""
diff --git a/mercurial/discovery.py b/mercurial/discovery.py
--- a/mercurial/discovery.py
+++ b/mercurial/discovery.py
@@ -56,12 +56,12 @@
                 allknown = False
                 break
         if allknown:
-            return (heads, False, heads)
+            return heads, False, heads
 
     res = setdiscovery.findcommonheads(repo.ui, repo, remote,
                                        abortwhenunrelated=not force)
     common, anyinc, srvheads = res
-    return (list(common), anyinc, heads or list(srvheads))
+    return list(common), anyinc, heads or list(srvheads)
 
 class outgoing(object):
     '''Represents the set of nodes present in a local repo but not in a
@@ -384,7 +384,7 @@
                 dhs = list(newhs)
                 if errormsg is None:
                     errormsg = (_("push creates new branch '%s' "
-                                  "with multiple heads") % (branch))
+                                  "with multiple heads") % branch)
                     hint = _("merge or"
                              " see 'hg help push' for details about"
                              " pushing new heads")
@@ -469,7 +469,7 @@
     while localcandidate:
         nh = localcandidate.pop()
         # run this check early to skip the evaluation of the whole branch
-        if (torev(nh) in futurecommon or ispublic(torev(nh))):
+        if torev(nh) in futurecommon or ispublic(torev(nh)):
             newhs.add(nh)
             continue
 
diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -731,9 +731,9 @@
                 m = matchmod.match(self._root, '', [], [pattern],
                                    warn=self._ui.warn)
                 if m(f):
-                    return (i, lineno, line)
+                    return i, lineno, line
             visited.add(i)
-        return (None, -1, "")
+        return None, -1, ""
 
     def _walkexplicit(self, match, subrepos):
         '''Get stat data about the files explicitly specified by match.
diff --git a/mercurial/destutil.py b/mercurial/destutil.py
--- a/mercurial/destutil.py
+++ b/mercurial/destutil.py
@@ -388,14 +388,14 @@
         if repo['.'].closesbranch():
             ui.warn(_('no open descendant heads on branch "%s", '
                         'updating to a closed head\n') %
-                      (currentbranch))
+                    currentbranch)
             if otherheads:
                 ui.warn(_("(committing will reopen the head, "
                             "use 'hg heads .' to see %i other heads)\n") %
                           (len(otherheads)))
             else:
                 ui.warn(_('(committing will reopen branch "%s")\n') %
-                          (currentbranch))
+                        currentbranch)
         elif otherheads:
             curhead = repo['.']
             ui.status(_('updated to "%s: %s"\n') % (curhead,
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -1321,9 +1321,9 @@
     def key(r):
         idx = order.find(r[0])
         if idx == -1:
-            return (1, r[1])
+            return 1, r[1]
         else:
-            return (0, idx)
+            return 0, idx
     v1records.sort(key=key)
     v2records.sort(key=key)
 
@@ -1881,7 +1881,7 @@
 
     def pcfmt(value, total):
         if total:
-            return (value, 100 * float(value) / total)
+            return value, 100 * float(value) / total
         else:
             return value, 100.0
 
diff --git a/mercurial/crecord.py b/mercurial/crecord.py
--- a/mercurial/crecord.py
+++ b/mercurial/crecord.py
@@ -279,7 +279,7 @@
         numlinesinhunk = len(self.hunk.changedlines)
         indexofthisline = self.hunk.changedlines.index(self)
 
-        if (indexofthisline < numlinesinhunk - 1):
+        if indexofthisline < numlinesinhunk - 1:
             nextline = self.hunk.changedlines[indexofthisline + 1]
             return nextline
         else:
@@ -330,7 +330,7 @@
         numhunksinheader = len(self.header.hunks)
         indexofthishunk = self.header.hunks.index(self)
 
-        if (indexofthishunk < numhunksinheader - 1):
+        if indexofthishunk < numhunksinheader - 1:
             nexthunk = self.header.hunks[indexofthishunk + 1]
             return nexthunk
         else:
@@ -512,7 +512,7 @@
                 else:
                     fixoffset += hnk.removed - hnk.added
 
-    return (appliedhunklist, ret)
+    return appliedhunklist, ret
 
 def chunkselector(ui, headerlist, operation=None):
     """
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -996,7 +996,7 @@
                          for i in xrange(1, lines(text) + 1)], text)
         else:
             def decorate(text, rev):
-                return ([annotateline(fctx=rev)] * lines(text), text)
+                return [annotateline(fctx=rev)] * lines(text), text
 
         getlog = util.lrucachefunc(lambda x: self._repo.file(x))
 
@@ -1904,11 +1904,11 @@
     def date(self):
         t, tz = self._changectx.date()
         try:
-            return (self._repo.wvfs.lstat(self._path).st_mtime, tz)
+            return self._repo.wvfs.lstat(self._path).st_mtime, tz
         except OSError as err:
             if err.errno != errno.ENOENT:
                 raise
-            return (t, tz)
+            return t, tz
 
     def exists(self):
         return self._repo.wvfs.exists(self._path)
diff --git a/mercurial/config.py b/mercurial/config.py
--- a/mercurial/config.py
+++ b/mercurial/config.py
@@ -66,9 +66,9 @@
         try:
             value = self._data[section][item]
             source = self.source(section, item)
-            return (section, item, value, source)
+            return section, item, value, source
         except KeyError:
-            return (section, item)
+            return section, item
 
     def source(self, section, item):
         return self._source.get((section, item), "")
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3005,7 +3005,7 @@
 
         if update:
             cmdutil.checkunfinished(repo)
-            if (exact or not opts.get('force')):
+            if exact or not opts.get('force'):
                 cmdutil.bailifchanged(repo)
 
         if not opts.get('no_commit'):
@@ -5145,7 +5145,7 @@
             return dest, dbranch, None, None
         else:
             dother = sother
-        if (source != dest or (sbranch is not None and sbranch != dbranch)):
+        if source != dest or (sbranch is not None and sbranch != dbranch):
             common = None
         else:
             common = commoninc
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -641,7 +641,7 @@
         if state in skip:
             continue
         if statedetectionpredicate(repo):
-            return (state, statedetectionpredicate, msgfn)
+            return state, statedetectionpredicate, msgfn
 
 def morestatus(repo, fm):
     statetuple = _getrepostate(repo)
@@ -1255,7 +1255,7 @@
     prefix = opts["prefix"]
     sim = float(opts.get('similarity') or 0)
     if not tmpname:
-        return (None, None, False)
+        return None, None, False
 
     rejects = False
 
@@ -1385,7 +1385,7 @@
         if n:
             # i18n: refers to a short changeset id
             msg = _('created %s') % short(n)
-        return (msg, n, rejects)
+        return msg, n, rejects
     finally:
         os.unlink(tmpname)
 
@@ -2891,7 +2891,7 @@
 
     for subpath in sorted(ctx.substate):
         submatch = matchmod.subdirmatcher(subpath, m)
-        if (subrepos or m.exact(subpath) or any(submatch.files())):
+        if subrepos or m.exact(subpath) or any(submatch.files()):
             sub = ctx.sub(subpath)
             try:
                 recurse = m.exact(subpath) or subrepos
@@ -3688,7 +3688,7 @@
                         # .orig files (issue4793)
                         if dobackup == backupinteractive:
                             tobackup.add(abs)
-                        elif (backup <= dobackup or wctx[abs].cmp(ctx[abs])):
+                        elif backup <= dobackup or wctx[abs].cmp(ctx[abs]):
                             bakname = scmutil.origpath(ui, repo, rel)
                             ui.note(_('saving current version of %s as %s\n') %
                                     (rel, bakname))
diff --git a/mercurial/chgserver.py b/mercurial/chgserver.py
--- a/mercurial/chgserver.py
+++ b/mercurial/chgserver.py
@@ -160,7 +160,7 @@
     def trystat(path):
         try:
             st = os.stat(path)
-            return (st.st_mtime, st.st_size)
+            return st.st_mtime, st.st_size
         except OSError:
             # could be ENOENT, EPERM etc. not fatal in any case
             pass
@@ -237,7 +237,7 @@
     rpath = dispatch._earlygetopt(["-R", "--repository", "--repo"], args)
     path, newlui = dispatch._getlocal(newui, rpath, wd=cwd)
 
-    return (newui, newlui)
+    return newui, newlui
 
 class channeledsystem(object):
     """Propagate ui.system() request in the following format:
diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -188,7 +188,7 @@
         header = struct.unpack(self.deltaheader, headerdata)
         delta = readexactly(self._stream, l - self.deltaheadersize)
         node, p1, p2, deltabase, cs, flags = self._deltaheader(header, prevnode)
-        return (node, p1, p2, cs, deltabase, delta, flags)
+        return node, p1, p2, cs, deltabase, delta, flags
 
     def getchunks(self):
         """returns all the chunks contains in the bundle
diff --git a/mercurial/byterange.py b/mercurial/byterange.py
--- a/mercurial/byterange.py
+++ b/mercurial/byterange.py
@@ -129,7 +129,7 @@
         this object was created with a range tuple of (500,899),
         tell() will return 0 when at byte position 500 of the file.
         """
-        return (self.realpos - self.firstbyte)
+        return self.realpos - self.firstbyte
 
     def seek(self, offset, whence=0):
         """Seek within the byte range.
@@ -174,7 +174,7 @@
         """
         if self.lastbyte:
             if size > -1:
-                if ((self.realpos + size) >= self.lastbyte):
+                if (self.realpos + size) >= self.lastbyte:
                     size = (self.lastbyte - self.realpos)
             else:
                 size = (self.lastbyte - self.realpos)
@@ -375,7 +375,7 @@
                     # workaround for REST not supported error
                     fp, retrlen = self.retrfile(file, type)
                     fp = RangeableFileObject(fp, (rest,''))
-                    return (fp, retrlen)
+                    return fp, retrlen
                 elif not str(reason).startswith('550'):
                     raise IOError('ftp error', reason)
         if not conn:
@@ -469,4 +469,4 @@
     # check that the range is valid
     if lb < fb:
         raise RangeError('Invalid byte range: %s-%s' % (fb, lb))
-    return (fb, lb)
+    return fb, lb
diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -567,4 +567,4 @@
             os.unlink(bundle)
         other.close()
 
-    return (localrepo, csets, cleanup)
+    return localrepo, csets, cleanup
diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -316,7 +316,7 @@
     mark = repo._activebookmark
     marks = repo._bookmarks
     parents = [p.node() for p in repo[None].parents()]
-    return (mark in marks and marks[mark] in parents)
+    return mark in marks and marks[mark] in parents
 
 def divergent2delete(repo, deletefrom, bm):
     """find divergent versions of bm on nodes in deletefrom.
@@ -367,7 +367,7 @@
         elif activemark:
             ui.status(_("updating to active bookmark %s\n") % activemark)
             checkout = activemark
-    return (checkout, movemarkfrom)
+    return checkout, movemarkfrom
 
 def update(repo, parents, node):
     deletefrom = parents
@@ -566,37 +566,37 @@
     for b, scid, dcid in addsrc:
         if scid in repo: # add remote bookmarks for changes we already have
             changed.append((b, scid, status,
-                            _("adding remote bookmark %s\n") % (b)))
+                            _("adding remote bookmark %s\n") % b))
         elif b in explicit:
             explicit.remove(b)
             ui.warn(_("remote bookmark %s points to locally missing %s\n")
                     % (b, hex(scid)[:12]))
 
     for b, scid, dcid in advsrc:
         changed.append((b, scid, status,
-                        _("updating bookmark %s\n") % (b)))
+                        _("updating bookmark %s\n") % b))
     # remove normal movement from explicit set
     explicit.difference_update(d[0] for d in changed)
 
     for b, scid, dcid in diverge:
         if b in explicit:
             explicit.discard(b)
             changed.append((b, scid, status,
-                            _("importing bookmark %s\n") % (b)))
+                            _("importing bookmark %s\n") % b))
         else:
             db = _diverge(ui, b, path, localmarks, scid)
             if db:
                 changed.append((db, scid, warn,
                                 _("divergent bookmark %s stored as %s\n") %
                                 (b, db)))
             else:
                 warn(_("warning: failed to assign numbered name "
-                       "to divergent bookmark %s\n") % (b))
+                       "to divergent bookmark %s\n") % b)
     for b, scid, dcid in adddst + advdst:
         if b in explicit:
             explicit.discard(b)
             changed.append((b, scid, status,
-                            _("importing bookmark %s\n") % (b)))
+                            _("importing bookmark %s\n") % b))
     for b, scid, dcid in differ:
         if b in explicit:
             explicit.remove(b)
@@ -706,7 +706,7 @@
     remotemarks = unhexlifybookmarks(other.listkeys('bookmarks'))
     r = comparebookmarks(repo, remotemarks, repo._bookmarks)
     addsrc, adddst, advsrc, advdst, diverge, differ, invalid, same = r
-    return (len(addsrc), len(adddst))
+    return len(addsrc), len(adddst)
 
 def validdest(repo, old, new):
     """Is the new bookmark destination a valid update from the old one"""
diff --git a/hgext/win32mbcs.py b/hgext/win32mbcs.py
--- a/hgext/win32mbcs.py
+++ b/hgext/win32mbcs.py
@@ -124,7 +124,7 @@
         return enc(func(*dec(args), **dec(kwds)))
     except UnicodeError:
         raise error.Abort(_("[win32mbcs] filename conversion failed with"
-                         " %s encoding\n") % (_encoding))
+                         " %s encoding\n") % _encoding)
 
 def wrapper(func, args, kwds):
     return basewrapper(func, unicode, encode, decode, args, kwds)
diff --git a/hgext/uncommit.py b/hgext/uncommit.py
--- a/hgext/uncommit.py
+++ b/hgext/uncommit.py
@@ -137,7 +137,7 @@
                   for dst, src in oldcopies.iteritems())
     # Adjust the dirstate copies
     for dst, src in copies.iteritems():
-        if (src not in ctx or dst in ctx or ds[dst] != 'a'):
+        if src not in ctx or dst in ctx or ds[dst] != 'a':
             src = None
         ds.copy(src, dst)
 
diff --git a/hgext/transplant.py b/hgext/transplant.py
--- a/hgext/transplant.py
+++ b/hgext/transplant.py
@@ -277,7 +277,7 @@
         finally:
             os.unlink(headerfile)
 
-        return (user, date, msg)
+        return user, date, msg
 
     def applyone(self, repo, node, cl, patchfile, merge=False, log=False,
                  filter=None):
@@ -413,7 +413,7 @@
                 continue
             cur.append(revlog.bin(line))
 
-        return (nodes, merges)
+        return nodes, merges
 
     def saveseries(self, revmap, merges):
         if not revmap:
@@ -453,7 +453,7 @@
                 message.append(line)
         if None in (user, date):
             raise error.Abort(_("filter corrupted changeset (no user or date)"))
-        return (node, user, date, '\n'.join(message), parents)
+        return node, user, date, '\n'.join(message), parents
 
     def log(self, user, date, message, p1, p2, merge=False):
         '''journal changelog metadata for later recover'''
@@ -537,7 +537,7 @@
             merges = ()
             break
     displayer.close()
-    return (transplants, merges)
+    return transplants, merges
 
 @command('transplant',
     [('s', 'source', '', _('transplant changesets from REPO'), _('REPO')),
diff --git a/hgext/show.py b/hgext/show.py
--- a/hgext/show.py
+++ b/hgext/show.py
@@ -88,7 +88,7 @@
     # we are putting it here without the '(EXPERIMENTAL)' flag because it
     # is an important part of the 'hg show' user experience and the entire
     # 'hg show' experience is experimental.
-    ('T', 'template', '', ('display with template'), _('TEMPLATE')),
+    ('T', 'template', '', 'display with template', _('TEMPLATE')),
     ], _('VIEW'))
 def show(ui, repo, view=None, template=None):
     """show various repository information
diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py
--- a/hgext/patchbomb.py
+++ b/hgext/patchbomb.py
@@ -405,7 +405,7 @@
     msg = mail.mimeencode(ui, body, _charsets, opts.get('test'))
     msg['Subject'] = mail.headencode(ui, subj, _charsets,
                                      opts.get('test'))
-    return (msg, subj, diffstat)
+    return msg, subj, diffstat
 
 def _getpatchmsgs(repo, sender, revs, patchnames=None, **opts):
     """return a list of emails from a list of patches
diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -748,7 +748,7 @@
                               strict=True, merge=rev)
 
         if err == 0:
-            return (err, n)
+            return err, n
 
         if n is None:
             raise error.Abort(_("apply failed for patch %s") % patch)
@@ -779,7 +779,7 @@
         self.printdiff(repo, diffopts, head, n, fp=patchf)
         patchf.close()
         self.removeundo(repo)
-        return (0, n)
+        return 0, n
 
     def qparents(self, repo, rev=None):
         """return the mq handled parent or p1
@@ -822,39 +822,39 @@
             patch = mergeq.lookup(patch, strict=True)
             if not patch:
                 self.ui.warn(_("patch %s does not exist\n") % patch)
-                return (1, None)
+                return 1, None
             pushable, reason = self.pushable(patch)
             if not pushable:
                 self.explainpushable(patch, all_patches=True)
                 continue
             info = mergeq.isapplied(patch)
             if not info:
                 self.ui.warn(_("patch %s is not applied\n") % patch)
-                return (1, None)
+                return 1, None
             rev = info[1]
             err, head = self.mergeone(repo, mergeq, head, patch, rev, diffopts)
             if head:
                 self.applied.append(statusentry(head, patch))
                 self.applieddirty = True
             if err:
-                return (err, head)
+                return err, head
         self.savedirty()
-        return (0, head)
+        return 0, head
 
     def patch(self, repo, patchfile):
         '''Apply patchfile  to the working directory.
         patchfile: name of patch file'''
         files = set()
         try:
             fuzz = patchmod.patch(self.ui, repo, patchfile, strip=1,
                                   files=files, eolmode=None)
-            return (True, list(files), fuzz)
+            return True, list(files), fuzz
         except Exception as inst:
             self.ui.note(str(inst) + '\n')
             if not self.ui.verbose:
                 self.ui.warn(_("patch failed, unable to continue (try -v)\n"))
             self.ui.traceback()
-            return (False, list(files), False)
+            return False, list(files), False
 
     def apply(self, repo, series, list=False, update_status=True,
               strict=False, patchdir=None, merge=None, all_files=None,
@@ -989,7 +989,7 @@
                 self.ui.warn(_("fuzz found when applying patch, stopping\n"))
                 err = 3
                 break
-        return (err, n)
+        return err, n
 
     def _cleanup(self, patches, numrevs, keep=False):
         if not keep:
@@ -1294,7 +1294,7 @@
         """returns (index, rev, patch)"""
         for i, a in enumerate(self.applied):
             if a.name == patch:
-                return (i, a.node, a.name)
+                return i, a.node, a.name
         return None
 
     # if the exact patch name does not exist, we try a few
@@ -1954,7 +1954,7 @@
                         and not fl.startswith('.')):
                         msng_list.append(fl)
             for x in sorted(msng_list):
-                pfx = self.ui.verbose and ('D ') or ''
+                pfx = self.ui.verbose and 'D ' or ''
                 displayname(pfx, x, 'missing')
 
     def issaveline(self, l):
@@ -2911,8 +2911,8 @@
                 maxindex = index
                 maxname = f
     if maxname:
-        return (os.path.join(directory, maxname), maxindex)
-    return (None, None)
+        return os.path.join(directory, maxname), maxindex
+    return None, None
 
 def savename(path):
     (last, index) = lastsavename(path)
diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -737,7 +737,7 @@
             lfutil.updatestandin(repo, lfile, lfutil.standin(lfile))
         for lfile in s.deleted:
             fstandin = lfutil.standin(lfile)
-            if (repo.wvfs.exists(fstandin)):
+            if repo.wvfs.exists(fstandin):
                 repo.wvfs.unlink(fstandin)
 
         oldstandins = lfutil.getstandinsstate(repo)
@@ -1154,7 +1154,7 @@
                 lfhashes.add(lfhash)
             def showhashes(fn):
                 for lfhash in sorted(toupload[fn]):
-                    ui.debug('    %s\n' % (lfhash))
+                    ui.debug('    %s\n' % lfhash)
         else:
             toupload = set()
             def addfunc(fn, lfhash):
@@ -1178,9 +1178,9 @@
     largeopt = opts.get('large', False)
     if changes is None:
         if largeopt:
-            return (False, True) # only outgoing check is needed
+            return False, True  # only outgoing check is needed
         else:
-            return (False, False)
+            return False, False
     elif largeopt:
         url, branch, peer, outgoing = changes[1]
         if peer is None:
diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py
--- a/hgext/largefiles/lfutil.py
+++ b/hgext/largefiles/lfutil.py
@@ -217,11 +217,11 @@
     path = storepath(repo, hash, False)
 
     if instore(repo, hash):
-        return (path, True)
+        return path, True
     elif repo.shared() and instore(repo, hash, True):
         return storepath(repo, hash, True), True
 
-    return (path, False)
+    return path, False
 
 def copyfromcache(repo, hash, filename):
     '''Copy the specified largefile from the repo or system cache to
diff --git a/hgext/largefiles/lfcommands.py b/hgext/largefiles/lfcommands.py
--- a/hgext/largefiles/lfcommands.py
+++ b/hgext/largefiles/lfcommands.py
@@ -419,7 +419,7 @@
         ret = store.get(toget)
         return ret
 
-    return ([], [])
+    return [], []
 
 def downloadlfiles(ui, repo, rev=None):
     match = scmutil.match(repo[None], [repo.wjoin(lfutil.shortname)], {})
diff --git a/hgext/largefiles/basestore.py b/hgext/largefiles/basestore.py
--- a/hgext/largefiles/basestore.py
+++ b/hgext/largefiles/basestore.py
@@ -80,7 +80,7 @@
                 missing.append(filename)
 
         ui.progress(_('getting largefiles'), None)
-        return (success, missing)
+        return success, missing
 
     def _gethash(self, filename, hash):
         """Get file with the provided hash and store it in the local repo's
diff --git a/hgext/keyword.py b/hgext/keyword.py
--- a/hgext/keyword.py
+++ b/hgext/keyword.py
@@ -124,7 +124,7 @@
                 ' outgoing push tip verify convert email glog')
 
 # webcommands that do not act on keywords
-nokwwebcommands = ('annotate changeset rev filediff diff comparison')
+nokwwebcommands = 'annotate changeset rev filediff diff comparison'
 
 # hg commands that trigger expansion only when writing to working dir,
 # not when reading filelog, and unexpand when reading from working dir
diff --git a/hgext/hgk.py b/hgext/hgk.py
--- a/hgext/hgk.py
+++ b/hgext/hgk.py
@@ -76,7 +76,7 @@
     ('s', 'stdin', None, _('stdin')),
     ('C', 'copy', None, _('detect copies')),
     ('S', 'search', "", _('search'))],
-    ('[OPTION]... NODE1 NODE2 [FILE]...'),
+         '[OPTION]... NODE1 NODE2 [FILE]...',
     inferrepo=True)
 def difftree(ui, repo, node1=None, node2=None, *files, **opts):
     """diff trees from two commits"""
@@ -330,11 +330,11 @@
 # at a given commit without walking the whole repo.  TODO add the stop
 # parameter
 @command('debug-rev-list',
-    [('H', 'header', None, _('header')),
+         [('H', 'header', None, _('header')),
     ('t', 'topo-order', None, _('topo-order')),
     ('p', 'parents', None, _('parents')),
     ('n', 'max-count', 0, _('max-count'))],
-    ('[OPTION]... REV...'))
+         '[OPTION]... REV...')
 def revlist(ui, repo, *revs, **opts):
     """print revisions"""
     if opts['header']:
diff --git a/hgext/factotum.py b/hgext/factotum.py
--- a/hgext/factotum.py
+++ b/hgext/factotum.py
@@ -101,7 +101,7 @@
                             passwd = passwd[1:-1].replace("''", "'")
                         else:
                             raise error.Abort(_('malformed password string'))
-                    return (user, passwd)
+                    return user, passwd
         except (OSError, IOError):
             raise error.Abort(_('factotum not responding'))
         finally:
@@ -119,7 +119,7 @@
     user, passwd = self.passwddb.find_user_password(realm, authuri)
     if user and passwd:
         self._writedebug(user, passwd)
-        return (user, passwd)
+        return user, passwd
 
     prefix = ''
     res = httpconnection.readauthforuri(self.ui, authuri, user)
@@ -137,7 +137,7 @@
 
     self.add_password(realm, authuri, user, passwd)
     self._writedebug(user, passwd)
-    return (user, passwd)
+    return user, passwd
 
 def uisetup(ui):
     global _executable
diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py
--- a/hgext/convert/subversion.py
+++ b/hgext/convert/subversion.py
@@ -487,7 +487,7 @@
 
         files.sort()
         files = zip(files, [rev] * len(files))
-        return (files, copies)
+        return files, copies
 
     def getchanges(self, rev, full):
         # reuse cache from getchangedfiles
@@ -497,7 +497,7 @@
             (files, copies) = self._getchanges(rev, full)
             # caller caches the result, so free it here to release memory
             del self.paths[rev]
-        return (files, copies, set())
+        return files, copies, set()
 
     def getchangedfiles(self, rev, i):
         # called from filemap - cache computed values for reuse in getchanges
@@ -835,7 +835,7 @@
 
         self.ui.progress(_('scanning paths'), None)
         changed.update(removed)
-        return (list(changed), removed, copies)
+        return list(changed), removed, copies
 
     def _fetch_revisions(self, from_revnum, to_revnum):
         if from_revnum < to_revnum:
diff --git a/hgext/convert/p4.py b/hgext/convert/p4.py
--- a/hgext/convert/p4.py
+++ b/hgext/convert/p4.py
@@ -180,7 +180,7 @@
                 if filename:
                     files.append((filename, d["rev%d" % i]))
                     depotname[filename] = oldname
-                    if (d.get("action%d" % i) == "move/add"):
+                    if d.get("action%d" % i) == "move/add":
                         copiedfiles.append(filename)
                     localname[oldname] = filename
                 i += 1
diff --git a/hgext/convert/monotone.py b/hgext/convert/monotone.py
--- a/hgext/convert/monotone.py
+++ b/hgext/convert/monotone.py
@@ -146,7 +146,7 @@
             raise error.Abort(_("bad mtn packet - unable to read full packet "
                 "read %s of %s") % (len(read), length))
 
-        return (commandnbr, stream, length, read)
+        return commandnbr, stream, length, read
 
     def mtnstdioreadcommandoutput(self, command):
         retval = []
@@ -290,7 +290,7 @@
             for fromfile in renamed.values():
                 files[fromfile] = rev
 
-        return (files.items(), copies, set())
+        return files.items(), copies, set()
 
     def getfile(self, name, rev):
         if not self.mtnisfile(name, rev):
diff --git a/hgext/convert/git.py b/hgext/convert/git.py
--- a/hgext/convert/git.py
+++ b/hgext/convert/git.py
@@ -325,7 +325,7 @@
             else:
                 self.retrievegitmodules(version)
                 changes.append(('.hgsubstate', ''))
-        return (changes, copies, set())
+        return changes, copies, set()
 
     def getcommit(self, version):
         c = self.catfile(version, "commit") # read the commit hash
diff --git a/hgext/convert/cvs.py b/hgext/convert/cvs.py
--- a/hgext/convert/cvs.py
+++ b/hgext/convert/cvs.py
@@ -270,7 +270,7 @@
                 if line == "ok\n":
                     if mode is None:
                         raise error.Abort(_('malformed response from CVS'))
-                    return (data, "x" in mode and "x" or "")
+                    return data, "x" in mode and "x" or ""
                 elif line.startswith("E "):
                     self.ui.warn(_("cvs server: %s\n") % line[2:])
                 elif line.startswith("Remove"):
diff --git a/hgext/convert/convcmd.py b/hgext/convert/convcmd.py
--- a/hgext/convert/convcmd.py
+++ b/hgext/convert/convcmd.py
@@ -86,7 +86,7 @@
     branch = branchmap.get(branch or 'default', branch)
     # At some point we used "None" literal to denote the default branch,
     # attempt to use that for backward compatibility.
-    if (not branch):
+    if not branch:
         branch = branchmap.get('None', branch)
     return branch
 
diff --git a/hgext/churn.py b/hgext/churn.py
--- a/hgext/churn.py
+++ b/hgext/churn.py
@@ -42,7 +42,7 @@
             added += 1
         elif l.startswith("-") and not l.startswith("--- "):
             removed += 1
-    return (added, removed)
+    return added, removed
 
 def countrate(ui, repo, amap, *pats, **opts):
     """Calculate stats"""
diff --git a/hgext/bugzilla.py b/hgext/bugzilla.py
--- a/hgext/bugzilla.py
+++ b/hgext/bugzilla.py
@@ -569,7 +569,7 @@
             except KeyError:
                 raise error.Abort(_('cannot find bugzilla user id for %s or %s')
                                  % (user, defaultuser))
-        return (user, userid)
+        return user, userid
 
     def updatebug(self, bugid, newstate, text, committer):
         '''update bug state with comment text.
diff --git a/doc/hgmanpage.py b/doc/hgmanpage.py
--- a/doc/hgmanpage.py
+++ b/doc/hgmanpage.py
@@ -96,7 +96,7 @@
 
 class Writer(writers.Writer):
 
-    supported = ('manpage')
+    supported = 'manpage'
     """Formats this writer supports."""
 
     output = None
@@ -133,9 +133,9 @@
             self._coldefs.append('l')
     def _minimize_cell(self, cell_lines):
         """Remove leading and trailing blank and ``.sp`` lines"""
-        while (cell_lines and cell_lines[0] in ('\n', '.sp\n')):
+        while cell_lines and cell_lines[0] in ('\n', '.sp\n'):
             del cell_lines[0]
-        while (cell_lines and cell_lines[-1] in ('\n', '.sp\n')):
+        while cell_lines and cell_lines[-1] in ('\n', '.sp\n'):
             del cell_lines[-1]
     def as_list(self):
         text = ['.TS\n']
diff --git a/doc/gendoc.py b/doc/gendoc.py
--- a/doc/gendoc.py
+++ b/doc/gendoc.py
@@ -53,7 +53,7 @@
 
     desc = textwrap.dedent(desc)
 
-    return (shortdesc, desc)
+    return shortdesc, desc
 
 def get_opts(opts):
     for opt in opts:
diff --git a/doc/docchecker b/doc/docchecker
--- a/doc/docchecker
+++ b/doc/docchecker
@@ -45,8 +45,8 @@
             continue
 
         lead, line = match.group(1), match.group(2)
-        if (lead == llead):
-            if (lline != ''):
+        if lead == llead:
+            if lline != '':
                 lline += ' ' + line
             else:
                 lline = line
diff --git a/doc/check-seclevel.py b/doc/check-seclevel.py
--- a/doc/check-seclevel.py
+++ b/doc/check-seclevel.py
@@ -37,7 +37,7 @@
 initlevel_ext_cmd = 3
 
 def showavailables(ui, initlevel):
-    avail = ('    available marks and order of them in this help: %s\n') % (
+    avail = '    available marks and order of them in this help: %s\n' % (
         ', '.join(['%r' % (m * 4) for m in level2mark[initlevel + 1:]]))
     ui.warn(avail.encode('utf-8'))
 
diff --git a/contrib/revsetbenchmarks.py b/contrib/revsetbenchmarks.py
--- a/contrib/revsetbenchmarks.py
+++ b/contrib/revsetbenchmarks.py
@@ -123,7 +123,7 @@
     if main is not None:
         factor = other[field] / main[field]
     low, high = 1 - sensitivity, 1 + sensitivity
-    if (low < factor < high):
+    if low < factor < high:
         return None
     return factor
 
diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -97,9 +97,9 @@
 # since 1.9 (or a79fea6b3e77).
 revlogopts = getattr(cmdutil, "debugrevlogopts",
                      getattr(commands, "debugrevlogopts", [
-        ('c', 'changelog', False, ('open changelog')),
-        ('m', 'manifest', False, ('open manifest')),
-        ('', 'dir', False, ('open directory manifest')),
+        ('c', 'changelog', False, 'open changelog'),
+        ('m', 'manifest', False, 'open manifest'),
+        ('', 'dir', False, 'open directory manifest'),
         ]))
 
 cmdtable = {}
diff --git a/contrib/import-checker.py b/contrib/import-checker.py
--- a/contrib/import-checker.py
+++ b/contrib/import-checker.py
@@ -173,10 +173,10 @@
 
         for n in candidates:
             if n in localmods:
-                return (n, n, False)
+                return n, n, False
             dottedpath = n + '.__init__'
             if dottedpath in localmods:
-                return (n, dottedpath, True)
+                return n, dottedpath, True
         return False
     return fromlocal
 
@@ -435,7 +435,7 @@
 
     for node, newscope in walklocal(root):
         def msg(fmt, *args):
-            return (fmt % args, node.lineno)
+            return fmt % args, node.lineno
         if newscope:
             # Check for local imports in function
             for r in verify_modern_convention(module, node, localmods,
diff --git a/contrib/check-config.py b/contrib/check-config.py
--- a/contrib/check-config.py
+++ b/contrib/check-config.py
@@ -35,7 +35,7 @@
         (?:default=)?(?P<default>\S+?))?
     \)''', re.VERBOSE | re.MULTILINE)
 
-configpartialre = (r"""ui\.config""")
+configpartialre = r"""ui\.config"""
 
 ignorere = re.compile(r'''
     \#\s(?P<reason>internal|experimental|deprecated|developer|inconsistent)\s



To: indygreg, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list