changeset 41759:aaad36b88298

cleanup: use () to wrap long lines instead of \ This is a little less brittle, and often helps indentation. In a surprising number of cases the entire cleanup was deleting the \, as the expression was *already* parenthesized in a workable way. Differential Revision: https://phab.mercurial-scm.org/D5993
author Augie Fackler <augie@google.com>
date Wed, 20 Feb 2019 19:28:51 -0500
parents 15d3facfa40a
children 1eb2fc21da12
files contrib/debugshell.py contrib/packaging/hg-docker hgext/acl.py hgext/bugzilla.py hgext/convert/cvsps.py hgext/convert/git.py hgext/convert/p4.py hgext/convert/subversion.py hgext/histedit.py hgext/infinitepush/__init__.py hgext/largefiles/lfutil.py hgext/largefiles/reposetup.py hgext/record.py hgext/releasenotes.py hgext/remotefilelog/fileserverclient.py hgext/shelve.py i18n/posplit mercurial/branchmap.py mercurial/bundle2.py mercurial/cmdutil.py mercurial/commands.py mercurial/context.py mercurial/debugcommands.py mercurial/exchange.py mercurial/httpconnection.py mercurial/merge.py mercurial/minirst.py mercurial/patch.py mercurial/simplemerge.py mercurial/sparse.py mercurial/subrepo.py mercurial/tags.py mercurial/ui.py setup.py tests/hghave.py tests/run-tests.py tests/test-duplicateoptions.py tests/test-run-tests.py tests/test-simplekeyvaluefile.py
diffstat 39 files changed, 128 insertions(+), 127 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/debugshell.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/contrib/debugshell.py	Wed Feb 20 19:28:51 2019 -0500
@@ -34,9 +34,9 @@
 
 @command('debugshell|dbsh', [])
 def debugshell(ui, repo, **opts):
-    bannermsg = "loaded repo : %s\n" \
-                "using source: %s" % (repo.root,
-                                      mercurial.__path__[0])
+    bannermsg = ("loaded repo : %s\n"
+                 "using source: %s" % (repo.root,
+                                       mercurial.__path__[0]))
 
     pdbmap = {
         'pdb'  : 'code',
--- a/contrib/packaging/hg-docker	Sun Jan 13 20:13:22 2019 -0500
+++ b/contrib/packaging/hg-docker	Wed Feb 20 19:28:51 2019 -0500
@@ -76,7 +76,7 @@
     p.communicate(input=dockerfile)
     if p.returncode:
         raise subprocess.CalledProcessException(
-                p.returncode, 'failed to build docker image: %s %s' \
+                p.returncode, 'failed to build docker image: %s %s'
                 % (p.stdout, p.stderr))
 
 def command_build(args):
--- a/hgext/acl.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/hgext/acl.py	Wed Feb 20 19:28:51 2019 -0500
@@ -293,15 +293,15 @@
             # if ug is a user  name: !username
             # if ug is a group name: !@groupname
             ug = ug[1:]
-            if not ug.startswith('@') and user != ug \
-                or ug.startswith('@') and user not in _getusers(ui, ug[1:]):
+            if (not ug.startswith('@') and user != ug
+                or ug.startswith('@') and user not in _getusers(ui, ug[1:])):
                 return True
 
         # Test for user or group. Format:
         # if ug is a user  name: username
         # if ug is a group name: @groupname
-        elif user == ug \
-             or ug.startswith('@') and user in _getusers(ui, ug[1:]):
+        elif (user == ug
+              or ug.startswith('@') and user in _getusers(ui, ug[1:])):
             return True
 
     return False
--- a/hgext/bugzilla.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/hgext/bugzilla.py	Wed Feb 20 19:28:51 2019 -0500
@@ -600,8 +600,8 @@
 
     def __init__(self, ui):
         bzmysql.__init__(self, ui)
-        self.default_notify = \
-            "cd %(bzdir)s && perl -T contrib/sendbugmail.pl %(id)s %(user)s"
+        self.default_notify = (
+            "cd %(bzdir)s && perl -T contrib/sendbugmail.pl %(id)s %(user)s")
 
 class bzmysql_3_0(bzmysql_2_18):
     '''support for bugzilla 3.0 series.'''
--- a/hgext/convert/cvsps.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/hgext/convert/cvsps.py	Wed Feb 20 19:28:51 2019 -0500
@@ -776,8 +776,8 @@
 
             # Ensure no changeset has a synthetic changeset as a parent.
             while p.synthetic:
-                assert len(p.parents) <= 1, \
-                       _('synthetic changeset cannot have multiple parents')
+                assert len(p.parents) <= 1, (
+                       _('synthetic changeset cannot have multiple parents'))
                 if p.parents:
                     p = p.parents[0]
                 else:
@@ -954,12 +954,12 @@
 
         # have we seen the start tag?
         if revisions and off:
-            if revisions[0] == (b"%d" % cs.id) or \
-                revisions[0] in cs.tags:
+            if (revisions[0] == (b"%d" % cs.id) or
+                revisions[0] in cs.tags):
                 off = False
 
         # see if we reached the end tag
         if len(revisions) > 1 and not off:
-            if revisions[1] == (b"%d" % cs.id) or \
-                revisions[1] in cs.tags:
+            if (revisions[1] == (b"%d" % cs.id) or
+                revisions[1] in cs.tags):
                 break
--- a/hgext/convert/git.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/hgext/convert/git.py	Wed Feb 20 19:28:51 2019 -0500
@@ -387,7 +387,7 @@
     def numcommits(self):
         output, ret = self.gitrunlines('rev-list', '--all')
         if ret:
-            raise error.Abort(_('cannot retrieve number of commits in %s') \
+            raise error.Abort(_('cannot retrieve number of commits in %s')
                               % self.path)
         return len(output)
 
--- a/hgext/convert/p4.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/hgext/convert/p4.py	Wed Feb 20 19:28:51 2019 -0500
@@ -198,8 +198,8 @@
             for filename in copiedfiles:
                 oldname = depotname[filename]
 
-                flcmd = 'p4 -G filelog %s' \
-                      % procutil.shellquote(oldname)
+                flcmd = ('p4 -G filelog %s'
+                         % procutil.shellquote(oldname))
                 flstdout = procutil.popen(flcmd, mode='rb')
 
                 copiedfilename = None
@@ -272,8 +272,8 @@
         return self.heads
 
     def getfile(self, name, rev):
-        cmd = 'p4 -G print %s' \
-            % procutil.shellquote("%s#%s" % (self.depotname[name], rev))
+        cmd = ('p4 -G print %s'
+               % procutil.shellquote("%s#%s" % (self.depotname[name], rev)))
 
         lasterror = None
         while True:
--- a/hgext/convert/subversion.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/hgext/convert/subversion.py	Wed Feb 20 19:28:51 2019 -0500
@@ -790,7 +790,7 @@
                         if childpath:
                             removed.add(self.recode(childpath))
                 else:
-                    self.ui.debug('unknown path in revision %d: %s\n' % \
+                    self.ui.debug('unknown path in revision %d: %s\n' %
                                   (revnum, path))
             elif kind == svn.core.svn_node_dir:
                 if ent.action == 'M':
--- a/hgext/histedit.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/hgext/histedit.py	Wed Feb 20 19:28:51 2019 -0500
@@ -1782,7 +1782,7 @@
             state.write(tr=tr)
             actobj = state.actions[0]
             progress.increment(item=actobj.torule())
-            ui.debug('histedit: processing %s %s\n' % (actobj.verb,\
+            ui.debug('histedit: processing %s %s\n' % (actobj.verb,
                                                        actobj.torule()))
             parentctx, replacement_ = actobj.run()
             state.parentctxnode = parentctx.node()
@@ -1881,7 +1881,7 @@
     else:
         rules = _readfile(ui, rules)
     actions = parserules(rules, state)
-    ctxs = [repo[act.node] \
+    ctxs = [repo[act.node]
             for act in state.actions if act.node]
     warnverifyactions(ui, repo, actions, state, ctxs)
     state.actions = actions
--- a/hgext/infinitepush/__init__.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/hgext/infinitepush/__init__.py	Wed Feb 20 19:28:51 2019 -0500
@@ -282,8 +282,8 @@
     scratchbranchpat = ui.config('infinitepush', 'branchpattern')
     if scratchbranchpat:
         global _scratchbranchmatcher
-        kind, pat, _scratchbranchmatcher = \
-                stringutil.stringmatcher(scratchbranchpat)
+        kind, pat, _scratchbranchmatcher = (
+                stringutil.stringmatcher(scratchbranchpat))
 
 def serverextsetup(ui):
     origpushkeyhandler = bundle2.parthandlermapping['pushkey']
@@ -294,8 +294,8 @@
     bundle2.parthandlermapping['pushkey'] = newpushkeyhandler
 
     orighandlephasehandler = bundle2.parthandlermapping['phase-heads']
-    newphaseheadshandler = lambda *args, **kwargs: \
-        bundle2handlephases(orighandlephasehandler, *args, **kwargs)
+    newphaseheadshandler = lambda *args, **kwargs: bundle2handlephases(
+        orighandlephasehandler, *args, **kwargs)
     newphaseheadshandler.params = orighandlephasehandler.params
     bundle2.parthandlermapping['phase-heads'] = newphaseheadshandler
 
@@ -754,10 +754,10 @@
     nametype_idx = 1
     remote_idx = 2
     name_idx = 3
-    remotenames = [remotename for remotename in \
-                   remotenamesext.readremotenames(repo) \
+    remotenames = [remotename for remotename in
+                   remotenamesext.readremotenames(repo)
                    if remotename[remote_idx] == path]
-    remote_bm_names = [remotename[name_idx] for remotename in \
+    remote_bm_names = [remotename[name_idx] for remotename in
                        remotenames if remotename[nametype_idx] == "bookmarks"]
 
     for name in names:
--- a/hgext/largefiles/lfutil.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/hgext/largefiles/lfutil.py	Wed Feb 20 19:28:51 2019 -0500
@@ -76,8 +76,8 @@
     if path:
         return path
     if pycompat.iswindows:
-        appdata = encoding.environ.get('LOCALAPPDATA',\
-                        encoding.environ.get('APPDATA'))
+        appdata = encoding.environ.get('LOCALAPPDATA',
+                                       encoding.environ.get('APPDATA'))
         if appdata:
             return os.path.join(appdata, name)
     elif pycompat.isdarwin:
--- a/hgext/largefiles/reposetup.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/hgext/largefiles/reposetup.py	Wed Feb 20 19:28:51 2019 -0500
@@ -174,8 +174,8 @@
                             if standin not in ctx1:
                                 # from second parent
                                 modified.append(lfile)
-                            elif lfutil.readasstandin(ctx1[standin]) \
-                                    != lfutil.hashfile(self.wjoin(lfile)):
+                            elif (lfutil.readasstandin(ctx1[standin])
+                                  != lfutil.hashfile(self.wjoin(lfile))):
                                 modified.append(lfile)
                             else:
                                 if listclean:
--- a/hgext/record.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/hgext/record.py	Wed Feb 20 19:28:51 2019 -0500
@@ -134,12 +134,12 @@
     except KeyError:
         return
 
-    cmdtable["qrecord"] = \
-        (qrecord,
-         # same options as qnew, but copy them so we don't get
-         # -i/--interactive for qrecord and add white space diff options
-         mq.cmdtable['qnew'][1][:] + cmdutil.diffwsopts,
-         _('hg qrecord [OPTION]... PATCH [FILE]...'))
+    cmdtable["qrecord"] = (
+        qrecord,
+        # same options as qnew, but copy them so we don't get
+        # -i/--interactive for qrecord and add white space diff options
+        mq.cmdtable['qnew'][1][:] + cmdutil.diffwsopts,
+        _('hg qrecord [OPTION]... PATCH [FILE]...'))
 
     _wrapcmd('qnew', mq.cmdtable, qnew, _("interactively record a new patch"))
     _wrapcmd('qrefresh', mq.cmdtable, qrefresh,
--- a/hgext/releasenotes.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/hgext/releasenotes.py	Wed Feb 20 19:28:51 2019 -0500
@@ -107,8 +107,9 @@
                       "releasenotes is disabled\n"))
 
         for section in other:
-            existingnotes = converttitled(self.titledforsection(section)) + \
-                convertnontitled(self.nontitledforsection(section))
+            existingnotes = (
+                converttitled(self.titledforsection(section)) +
+                convertnontitled(self.nontitledforsection(section)))
             for title, paragraphs in other.titledforsection(section):
                 if self.hastitledinsection(section, title):
                     # TODO prompt for resolution if different and running in
--- a/hgext/remotefilelog/fileserverclient.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/hgext/remotefilelog/fileserverclient.py	Wed Feb 20 19:28:51 2019 -0500
@@ -138,8 +138,8 @@
     def connect(self, cachecommand):
         if self.pipeo:
             raise error.Abort(_("cache connection already open"))
-        self.pipei, self.pipeo, self.pipee, self.subprocess = \
-            procutil.popen4(cachecommand)
+        self.pipei, self.pipeo, self.pipee, self.subprocess = (
+            procutil.popen4(cachecommand))
         self.connected = True
 
     def close(self):
--- a/hgext/shelve.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/hgext/shelve.py	Wed Feb 20 19:28:51 2019 -0500
@@ -248,8 +248,8 @@
         if version < cls._version:
             d = cls._readold(repo)
         elif version == cls._version:
-            d = scmutil.simplekeyvaluefile(repo.vfs, cls._filename)\
-                       .read(firstlinenonkeyval=True)
+            d = scmutil.simplekeyvaluefile(
+                repo.vfs, cls._filename).read(firstlinenonkeyval=True)
         else:
             raise error.Abort(_('this version of shelve is incompatible '
                                 'with the version used in this repo'))
@@ -287,8 +287,9 @@
             "keep": cls._keep if keep else cls._nokeep,
             "activebook": activebook or cls._noactivebook
         }
-        scmutil.simplekeyvaluefile(repo.vfs, cls._filename)\
-               .write(info, firstline=("%d" % cls._version))
+        scmutil.simplekeyvaluefile(
+            repo.vfs, cls._filename).write(info,
+                                           firstline=("%d" % cls._version))
 
     @classmethod
     def clear(cls, repo):
--- a/i18n/posplit	Sun Jan 13 20:13:22 2019 -0500
+++ b/i18n/posplit	Wed Feb 20 19:28:51 2019 -0500
@@ -77,7 +77,7 @@
                             continue
                         else:
                             # lines following directly, unexpected
-                            print('Warning: text follows line with directive' \
+                            print('Warning: text follows line with directive'
                                   ' %s' % directive)
                     comment = 'do not translate: .. %s::' % directive
                     if not newentry.comment:
--- a/mercurial/branchmap.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/mercurial/branchmap.py	Wed Feb 20 19:28:51 2019 -0500
@@ -229,7 +229,7 @@
         - True when cache is up to date or a subset of current repo."""
         try:
             return ((self.tipnode == repo.changelog.node(self.tiprev))
-                    and (self.filteredhash == \
+                    and (self.filteredhash ==
                          scmutil.filteredhash(repo, self.tiprev)))
         except IndexError:
             return False
--- a/mercurial/bundle2.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/mercurial/bundle2.py	Wed Feb 20 19:28:51 2019 -0500
@@ -1397,8 +1397,8 @@
             assert chunknum == 0, 'Must start with chunk 0'
             self._chunkindex.append((0, self._tellfp()))
         else:
-            assert chunknum < len(self._chunkindex), \
-                   'Unknown chunk %d' % chunknum
+            assert chunknum < len(self._chunkindex), (
+                   'Unknown chunk %d' % chunknum)
             self._seekfp(self._chunkindex[chunknum][1])
 
         pos = self._chunkindex[chunknum][0]
--- a/mercurial/cmdutil.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/mercurial/cmdutil.py	Wed Feb 20 19:28:51 2019 -0500
@@ -179,8 +179,8 @@
 def newandmodified(chunks, originalchunks):
     newlyaddedandmodifiedfiles = set()
     for chunk in chunks:
-        if ishunk(chunk) and chunk.header.isnewfile() and chunk not in \
-            originalchunks:
+        if (ishunk(chunk) and chunk.header.isnewfile() and chunk not in
+            originalchunks):
             newlyaddedandmodifiedfiles.add(chunk.header.filename())
     return newlyaddedandmodifiedfiles
 
@@ -322,8 +322,8 @@
         if backupall:
             tobackup = changed
         else:
-            tobackup = [f for f in newfiles if f in modified or f in \
-                    newlyaddedandmodifiedfiles]
+            tobackup = [f for f in newfiles if f in modified or f in
+                        newlyaddedandmodifiedfiles]
         backups = {}
         if tobackup:
             backupdir = repo.vfs.join('record-backups')
--- a/mercurial/commands.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/mercurial/commands.py	Wed Feb 20 19:28:51 2019 -0500
@@ -1676,8 +1676,8 @@
         if not bheads:
             raise error.Abort(_('can only close branch heads'))
         elif opts.get('amend'):
-            if repo['.'].p1().branch() != branch and \
-                    repo['.'].p2().branch() != branch:
+            if (repo['.'].p1().branch() != branch and
+                repo['.'].p2().branch() != branch):
                 raise error.Abort(_('can only close branch heads'))
 
     if opts.get('amend'):
@@ -4822,8 +4822,8 @@
     opts = pycompat.byteskwargs(opts)
     confirm = ui.configbool('commands', 'resolve.confirm')
     flaglist = 'all mark unmark list no_status re_merge'.split()
-    all, mark, unmark, show, nostatus, remerge = \
-        [opts.get(o) for o in flaglist]
+    all, mark, unmark, show, nostatus, remerge = [
+        opts.get(o) for o in flaglist]
 
     actioncount = len(list(filter(None, [show, mark, unmark, remerge])))
     if actioncount > 1:
@@ -4952,8 +4952,8 @@
             if mark:
                 if markcheck:
                     fdata = repo.wvfs.tryread(f)
-                    if filemerge.hasconflictmarkers(fdata) and \
-                        ms[f] != mergemod.MERGE_RECORD_RESOLVED:
+                    if (filemerge.hasconflictmarkers(fdata) and
+                        ms[f] != mergemod.MERGE_RECORD_RESOLVED):
                         hasconflictmarkers.append(f)
                 ms.mark(f, mergemod.MERGE_RECORD_RESOLVED)
             elif unmark:
--- a/mercurial/context.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/mercurial/context.py	Wed Feb 20 19:28:51 2019 -0500
@@ -983,9 +983,9 @@
 
         assert (changeid is not None
                 or fileid is not None
-                or changectx is not None), \
-                ("bad args: changeid=%r, fileid=%r, changectx=%r"
-                 % (changeid, fileid, changectx))
+                or changectx is not None), (
+                    "bad args: changeid=%r, fileid=%r, changectx=%r"
+                    % (changeid, fileid, changectx))
 
         if filelog is not None:
             self._filelog = filelog
--- a/mercurial/debugcommands.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/mercurial/debugcommands.py	Wed Feb 20 19:28:51 2019 -0500
@@ -1442,8 +1442,8 @@
                     if host == socket.gethostname():
                         locker = 'user %s, process %s' % (user or b'None', pid)
                     else:
-                        locker = 'user %s, process %s, host %s' \
-                                 % (user or b'None', pid, host)
+                        locker = ('user %s, process %s, host %s'
+                                  % (user or b'None', pid, host))
                 ui.write(("%-6s %s (%ds)\n") % (name + ":", locker, age))
                 return 1
             except OSError as e:
--- a/mercurial/exchange.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/mercurial/exchange.py	Wed Feb 20 19:28:51 2019 -0500
@@ -2547,8 +2547,8 @@
         return True
 
     # Stream clone v2
-    if (bundlespec.wirecompression == 'UN' and \
-        bundlespec.wireversion == '02' and \
+    if (bundlespec.wirecompression == 'UN' and
+        bundlespec.wireversion == '02' and
         bundlespec.contentopts.get('streamv2')):
         return True
 
--- a/mercurial/httpconnection.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/mercurial/httpconnection.py	Wed Feb 20 19:28:51 2019 -0500
@@ -109,10 +109,10 @@
             schemes, prefix = [p[0]], p[1]
         else:
             schemes = (auth.get('schemes') or 'https').split()
-        if (prefix == '*' or hostpath.startswith(prefix)) and \
-            (len(prefix) > bestlen or (len(prefix) == bestlen and \
-                not bestuser and 'username' in auth)) \
-             and scheme in schemes:
+        if ((prefix == '*' or hostpath.startswith(prefix)) and
+            (len(prefix) > bestlen or (len(prefix) == bestlen and
+                                       not bestuser and 'username' in auth))
+            and scheme in schemes):
             bestlen = len(prefix)
             bestauth = group, auth
             bestuser = auth.get('username')
--- a/mercurial/merge.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/mercurial/merge.py	Wed Feb 20 19:28:51 2019 -0500
@@ -391,9 +391,9 @@
         """
         # Check local variables before looking at filesystem for performance
         # reasons.
-        return bool(self._local) or bool(self._state) or \
-               self._repo.vfs.exists(self.statepathv1) or \
-               self._repo.vfs.exists(self.statepathv2)
+        return (bool(self._local) or bool(self._state) or
+                self._repo.vfs.exists(self.statepathv1) or
+                self._repo.vfs.exists(self.statepathv2))
 
     def commit(self):
         """Write current state on disk (if necessary)"""
--- a/mercurial/minirst.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/mercurial/minirst.py	Wed Feb 20 19:28:51 2019 -0500
@@ -114,9 +114,9 @@
                 # Partially minimized form: remove space and both
                 # colons.
                 blocks[i]['lines'][-1] = blocks[i]['lines'][-1][:-3]
-            elif len(blocks[i]['lines']) == 1 and \
-                 blocks[i]['lines'][0].lstrip(' ').startswith('.. ') and \
-                 blocks[i]['lines'][0].find(' ', 3) == -1:
+            elif (len(blocks[i]['lines']) == 1 and
+                  blocks[i]['lines'][0].lstrip(' ').startswith('.. ') and
+                  blocks[i]['lines'][0].find(' ', 3) == -1):
                 # directive on its own line, not a literal block
                 i += 1
                 continue
@@ -790,8 +790,8 @@
                     if section['type'] != 'margin':
                         sindent = section['indent']
                         if len(section['lines']) > 1:
-                            sindent += len(section['lines'][1]) - \
-                              len(section['lines'][1].lstrip(' '))
+                            sindent += (len(section['lines'][1]) -
+                                        len(section['lines'][1].lstrip(' ')))
                         if bindent >= sindent:
                             break
                     pointer += 1
--- a/mercurial/patch.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/mercurial/patch.py	Wed Feb 20 19:28:51 2019 -0500
@@ -925,8 +925,8 @@
         # if they have some content as we want to be able to change it
         nocontent = len(self.header) == 2
         emptynewfile = self.isnewfile() and nocontent
-        return emptynewfile or \
-                any(self.special_re.match(h) for h in self.header)
+        return (emptynewfile
+                or any(self.special_re.match(h) for h in self.header))
 
 class recordhunk(object):
     """patch hunk
@@ -2283,8 +2283,8 @@
             # If the file has been removed, fctx2 is None; but this should
             # not occur here since we catch removed files early in
             # logcmdutil.getlinerangerevs() for 'hg log -L'.
-            assert fctx2 is not None, \
-                'fctx2 unexpectly None in diff hunks filtering'
+            assert fctx2 is not None, (
+                'fctx2 unexpectly None in diff hunks filtering')
             hunks = hunksfilterfn(fctx2, hunks)
         text = ''.join(sum((list(hlines) for hrange, hlines in hunks), []))
         if hdr and (text or len(hdr) > 1):
--- a/mercurial/simplemerge.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/mercurial/simplemerge.py	Wed Feb 20 19:28:51 2019 -0500
@@ -289,15 +289,15 @@
 
             # find matches at the front
             ii = 0
-            while ii < alen and ii < blen and \
-                  self.a[a1 + ii] == self.b[b1 + ii]:
+            while (ii < alen and ii < blen and
+                   self.a[a1 + ii] == self.b[b1 + ii]):
                 ii += 1
             startmatches = ii
 
             # find matches at the end
             ii = 0
-            while ii < alen and ii < blen and \
-                  self.a[a2 - ii - 1] == self.b[b2 - ii - 1]:
+            while (ii < alen and ii < blen and
+                   self.a[a2 - ii - 1] == self.b[b2 - ii - 1]):
                 ii += 1
             endmatches = ii
 
@@ -350,8 +350,8 @@
                 aend = asub + intlen
                 bend = bsub + intlen
 
-                assert self.base[intbase:intend] == self.a[asub:aend], \
-                       (self.base[intbase:intend], self.a[asub:aend])
+                assert self.base[intbase:intend] == self.a[asub:aend], (
+                        (self.base[intbase:intend], self.a[asub:aend]))
 
                 assert self.base[intbase:intend] == self.b[bsub:bend]
 
--- a/mercurial/sparse.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/mercurial/sparse.py	Wed Feb 20 19:28:51 2019 -0500
@@ -643,8 +643,8 @@
             for kindpat in pats:
                 kind, pat = matchmod._patsplit(kindpat, None)
                 if kind in matchmod.cwdrelativepatternkinds or kind is None:
-                    ap = (kind + ':' if kind else '') +\
-                            pathutil.canonpath(root, cwd, pat)
+                    ap = ((kind + ':' if kind else '') +
+                          pathutil.canonpath(root, cwd, pat))
                     abspats.append(ap)
                 else:
                     abspats.append(kindpat)
--- a/mercurial/subrepo.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/mercurial/subrepo.py	Wed Feb 20 19:28:51 2019 -0500
@@ -369,8 +369,8 @@
         return 1
 
     def revert(self, substate, *pats, **opts):
-        self.ui.warn(_('%s: reverting %s subrepos is unsupported\n') \
-            % (substate[0], substate[2]))
+        self.ui.warn(_('%s: reverting %s subrepos is unsupported\n')
+                     % (substate[0], substate[2]))
         return []
 
     def shortid(self, revid):
@@ -697,7 +697,7 @@
             ctx = urepo[revision]
             if ctx.hidden():
                 urepo.ui.warn(
-                    _('revision %s in subrepository "%s" is hidden\n') \
+                    _('revision %s in subrepository "%s" is hidden\n')
                     % (revision[0:12], self._path))
                 repo = urepo
         hg.updaterepo(repo, revision, overwrite)
@@ -1787,8 +1787,8 @@
             cmd.append('--ignore-all-space')
         if diffopts.ignorewsamount:
             cmd.append('--ignore-space-change')
-        if self._gitversion(self._gitcommand(['--version'])) >= (1, 8, 4) \
-                and diffopts.ignoreblanklines:
+        if (self._gitversion(self._gitcommand(['--version'])) >= (1, 8, 4)
+            and diffopts.ignoreblanklines):
             cmd.append('--ignore-blank-lines')
 
         cmd.append(node1)
--- a/mercurial/tags.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/mercurial/tags.py	Wed Feb 20 19:28:51 2019 -0500
@@ -188,8 +188,8 @@
         return alltags
 
     for head in reversed(heads):  # oldest to newest
-        assert head in repo.changelog.nodemap, \
-               "tag cache returned bogus head %s" % short(head)
+        assert head in repo.changelog.nodemap, (
+               "tag cache returned bogus head %s" % short(head))
     fnodes = _filterfnodes(tagfnode, reversed(heads))
     alltags = _tagsfromfnodes(ui, repo, fnodes)
 
--- a/mercurial/ui.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/mercurial/ui.py	Wed Feb 20 19:28:51 2019 -0500
@@ -344,8 +344,8 @@
         try:
             yield
         finally:
-            self._blockedtimes[key + '_blocked'] += \
-                (util.timer() - starttime) * 1000
+            self._blockedtimes[key + '_blocked'] += (
+                (util.timer() - starttime) * 1000)
 
     @contextlib.contextmanager
     def uninterruptible(self):
@@ -1027,8 +1027,8 @@
         except IOError as err:
             raise error.StdioError(err)
         finally:
-            self._blockedtimes['stdio_blocked'] += \
-                (util.timer() - starttime) * 1000
+            self._blockedtimes['stdio_blocked'] += (
+                (util.timer() - starttime) * 1000)
 
     def write_err(self, *args, **opts):
         self._write(self._ferr, *args, **opts)
@@ -1078,8 +1078,8 @@
                 return
             raise error.StdioError(err)
         finally:
-            self._blockedtimes['stdio_blocked'] += \
-                (util.timer() - starttime) * 1000
+            self._blockedtimes['stdio_blocked'] += (
+                (util.timer() - starttime) * 1000)
 
     def _writemsg(self, dest, *args, **opts):
         _writemsgwith(self._write, dest, *args, **opts)
@@ -1103,8 +1103,8 @@
                     if err.errno not in (errno.EPIPE, errno.EIO, errno.EBADF):
                         raise error.StdioError(err)
         finally:
-            self._blockedtimes['stdio_blocked'] += \
-                (util.timer() - starttime) * 1000
+            self._blockedtimes['stdio_blocked'] += (
+                (util.timer() - starttime) * 1000)
 
     def _isatty(self, fh):
         if self.configbool('ui', 'nontty'):
--- a/setup.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/setup.py	Wed Feb 20 19:28:51 2019 -0500
@@ -437,10 +437,9 @@
     pure = False
     cffi = ispypy
 
-    global_options = Distribution.global_options + \
-                     [('pure', None, "use pure (slow) Python "
-                        "code instead of C extensions"),
-                     ]
+    global_options = Distribution.global_options + [
+        ('pure', None, "use pure (slow) Python code instead of C extensions"),
+    ]
 
     def has_ext_modules(self):
         # self.ext_modules is emptied in hgbuildpy.finalize_options which is
--- a/tests/hghave.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/tests/hghave.py	Wed Feb 20 19:28:51 2019 -0500
@@ -343,8 +343,8 @@
 
 @check("svn", "subversion client and admin tools")
 def has_svn():
-    return matchoutput('svn --version 2>&1', br'^svn, version') and \
-        matchoutput('svnadmin --version 2>&1', br'^svnadmin, version')
+    return (matchoutput('svn --version 2>&1', br'^svn, version') and
+            matchoutput('svnadmin --version 2>&1', br'^svnadmin, version'))
 
 @check("svn-bindings", "subversion python bindings")
 def has_svn_bindings():
--- a/tests/run-tests.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/tests/run-tests.py	Wed Feb 20 19:28:51 2019 -0500
@@ -929,8 +929,8 @@
             self.fail('no result code from test')
         elif out != self._refout:
             # Diff generation may rely on written .err file.
-            if (ret != 0 or out != self._refout) and not self._skipped \
-                and not self._debug:
+            if ((ret != 0 or out != self._refout) and not self._skipped
+                and not self._debug):
                 with open(self.errpath, 'wb') as f:
                     for line in out:
                         f.write(line)
@@ -978,8 +978,8 @@
             # files are deleted
             shutil.rmtree(self._chgsockdir, True)
 
-        if (self._ret != 0 or self._out != self._refout) and not self._skipped \
-            and not self._debug and self._out:
+        if ((self._ret != 0 or self._out != self._refout) and not self._skipped
+            and not self._debug and self._out):
             with open(self.errpath, 'wb') as f:
                 for line in self._out:
                     f.write(line)
@@ -1105,8 +1105,8 @@
         if 'HGTESTCATAPULTSERVERPIPE' not in env:
             # If we don't have HGTESTCATAPULTSERVERPIPE explicitly set, pull the
             # non-test one in as a default, otherwise set to devnull
-            env['HGTESTCATAPULTSERVERPIPE'] = \
-                env.get('HGCATAPULTSERVERPIPE', os.devnull)
+            env['HGTESTCATAPULTSERVERPIPE'] = env.get(
+                'HGCATAPULTSERVERPIPE', os.devnull)
 
         extraextensions = []
         for opt in self._extraconfigopts:
--- a/tests/test-duplicateoptions.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/tests/test-duplicateoptions.py	Wed Feb 20 19:28:51 2019 -0500
@@ -41,8 +41,8 @@
     seenshort = globalshort.copy()
     seenlong = globallong.copy()
     for option in entry[1]:
-        if (option[0] and option[0] in seenshort) or \
-           (option[1] and option[1] in seenlong):
+        if ((option[0] and option[0] in seenshort) or
+            (option[1] and option[1] in seenlong)):
             print("command '" + cmd + "' has duplicate option " + str(option))
         seenshort.add(option[0])
         seenlong.add(option[1])
--- a/tests/test-run-tests.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/tests/test-run-tests.py	Wed Feb 20 19:28:51 2019 -0500
@@ -37,8 +37,8 @@
     """
     assert (expected.endswith(b'\n')
             and output.endswith(b'\n')), 'missing newline'
-    assert not re.search(br'[^ \w\\/\r\n()*?]', expected + output), \
-           b'single backslash or unknown char'
+    assert not re.search(br'[^ \w\\/\r\n()*?]', expected + output), (
+           b'single backslash or unknown char')
     test = run_tests.TTest(b'test-run-test.t', b'.', b'.')
     match, exact = test.linematch(expected, output)
     if isinstance(match, str):
--- a/tests/test-simplekeyvaluefile.py	Sun Jan 13 20:13:22 2019 -0500
+++ b/tests/test-simplekeyvaluefile.py	Wed Feb 20 19:28:51 2019 -0500
@@ -82,8 +82,8 @@
         dw = {b'key1': b'value1'}
         scmutil.simplekeyvaluefile(self.vfs, b'fl').write(dw, firstline=b'1.0')
         self.assertEqual(self.vfs.read(b'fl'), b'1.0\nkey1=value1\n')
-        dr = scmutil.simplekeyvaluefile(self.vfs, b'fl')\
-                    .read(firstlinenonkeyval=True)
+        dr = scmutil.simplekeyvaluefile(
+            self.vfs, b'fl').read(firstlinenonkeyval=True)
         self.assertEqual(dr, {b'__firstline': b'1.0', b'key1': b'value1'})
 
 if __name__ == "__main__":