D5993: cleanup: use () to wrap long lines instead of \
This revision was automatically updated to reflect the committed changes. Closed by commit rHGaaad36b88298: cleanup: use () to wrap long lines instead of \ (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5993?vs=14173=14178 REVISION DETAIL https://phab.mercurial-scm.org/D5993 AFFECTED 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 CHANGE DETAILS diff --git a/tests/test-simplekeyvaluefile.py b/tests/test-simplekeyvaluefile.py --- a/tests/test-simplekeyvaluefile.py +++ b/tests/test-simplekeyvaluefile.py @@ -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__": diff --git a/tests/test-run-tests.py b/tests/test-run-tests.py --- a/tests/test-run-tests.py +++ b/tests/test-run-tests.py @@ -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): diff --git a/tests/test-duplicateoptions.py b/tests/test-duplicateoptions.py --- a/tests/test-duplicateoptions.py +++ b/tests/test-duplicateoptions.py @@ -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]) diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -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: diff --git a/tests/hghave.py b/tests/hghave.py --- a/tests/hghave.py +++
D5993: cleanup: use () to wrap long lines instead of \
durin42 updated this revision to Diff 14173. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5993?vs=14163=14173 REVISION DETAIL https://phab.mercurial-scm.org/D5993 AFFECTED 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 CHANGE DETAILS diff --git a/tests/test-simplekeyvaluefile.py b/tests/test-simplekeyvaluefile.py --- a/tests/test-simplekeyvaluefile.py +++ b/tests/test-simplekeyvaluefile.py @@ -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__": diff --git a/tests/test-run-tests.py b/tests/test-run-tests.py --- a/tests/test-run-tests.py +++ b/tests/test-run-tests.py @@ -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): diff --git a/tests/test-duplicateoptions.py b/tests/test-duplicateoptions.py --- a/tests/test-duplicateoptions.py +++ b/tests/test-duplicateoptions.py @@ -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]) diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -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: diff --git a/tests/hghave.py b/tests/hghave.py --- a/tests/hghave.py +++ b/tests/hghave.py @@ -343,8 +343,8 @@ @check("svn", "subversion client and admin tools") def has_svn(): -return matchoutput('svn --version 2>&1',
D5993: cleanup: use () to wrap long lines instead of \
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY 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. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5993 AFFECTED 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 CHANGE DETAILS diff --git a/tests/test-simplekeyvaluefile.py b/tests/test-simplekeyvaluefile.py --- a/tests/test-simplekeyvaluefile.py +++ b/tests/test-simplekeyvaluefile.py @@ -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__": diff --git a/tests/test-run-tests.py b/tests/test-run-tests.py --- a/tests/test-run-tests.py +++ b/tests/test-run-tests.py @@ -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): diff --git a/tests/test-duplicateoptions.py b/tests/test-duplicateoptions.py --- a/tests/test-duplicateoptions.py +++ b/tests/test-duplicateoptions.py @@ -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]) diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -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: diff --git