diff mercurial/httpconnection.py @ 43075:57875cf423c9

style: run a patched black on a subset of mercurial This applied black to the 20 smallest files in mercurial/: ls -S1 mercurial/*.py | tail -n20 | xargs black --skip-string-normalization Note that a few files failed to format, presumably due to a bug in my patch. The intent is to be able to compare results to D5064 with https://github.com/python/black/pull/826 applied to black. I skipped string normalization on this patch for clarity - in reality I think we'd want one pass without string normalization, followed by another to normalize strings (which is basically replacing ' with " globally.) # skip-blame mass-reformatting only Differential Revision: https://phab.mercurial-scm.org/D6342
author Augie Fackler <augie@google.com>
date Sat, 05 Oct 2019 10:29:34 -0400
parents aaad36b88298
children 687b865b95ad
line wrap: on
line diff
--- a/mercurial/httpconnection.py	Fri Oct 04 15:53:45 2019 -0400
+++ b/mercurial/httpconnection.py	Sat Oct 05 10:29:34 2019 -0400
@@ -43,8 +43,9 @@
         # requires authentication. Since we can't know until we try
         # once whether authentication will be required, just lie to
         # the user and maybe the push succeeds suddenly at 50%.
-        self._progress = ui.makeprogress(_('sending'), unit=_('kb'),
-                                         total=(self.length // 1024 * 2))
+        self._progress = ui.makeprogress(
+            _('sending'), unit=_('kb'), total=(self.length // 1024 * 2)
+        )
 
     def read(self, *args, **kwargs):
         ret = self._data.read(*args, **kwargs)
@@ -61,6 +62,7 @@
     def __exit__(self, exc_type, exc_val, exc_tb):
         self.close()
 
+
 # moved here from url.py to avoid a cycle
 def readauthforuri(ui, uri, user):
     uri = pycompat.bytesurl(uri)
@@ -109,10 +111,18 @@
             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')