diff hgext/schemes.py @ 43076:2372284d9457

formatting: blacken the codebase This is using my patch to black (https://github.com/psf/black/pull/826) so we don't un-wrap collection literals. Done with: hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**"' | xargs black -S # skip-blame mass-reformatting only # no-check-commit reformats foo_bar functions Differential Revision: https://phab.mercurial-scm.org/D6971
author Augie Fackler <augie@google.com>
date Sun, 06 Oct 2019 09:45:02 -0400
parents 089fc0db0954
children 687b865b95ad
line wrap: on
line diff
--- a/hgext/schemes.py	Sat Oct 05 10:29:34 2019 -0400
+++ b/hgext/schemes.py	Sun Oct 06 09:45:02 2019 -0400
@@ -65,6 +65,7 @@
 
 _partre = re.compile(br'\{(\d+)\}')
 
+
 class ShortRepository(object):
     def __init__(self, url, scheme, templater):
         self.scheme = scheme
@@ -80,8 +81,9 @@
 
     def instance(self, ui, url, create, intents=None, createopts=None):
         url = self.resolve(url)
-        return hg._peerlookup(url).instance(ui, url, create, intents=intents,
-                                            createopts=createopts)
+        return hg._peerlookup(url).instance(
+            ui, url, create, intents=intents, createopts=createopts
+        )
 
     def resolve(self, url):
         # Should this use the util.url class, or is manual parsing better?
@@ -98,6 +100,7 @@
         context = dict(('%d' % (i + 1), v) for i, v in enumerate(parts))
         return ''.join(self.templater.process(self.url, context)) + tail
 
+
 def hasdriveletter(orig, path):
     if path:
         for scheme in schemes:
@@ -105,26 +108,35 @@
                 return False
     return orig(path)
 
+
 schemes = {
     'py': 'http://hg.python.org/',
     'bb': 'https://bitbucket.org/',
     'bb+ssh': 'ssh://hg@bitbucket.org/',
     'gcode': 'https://{1}.googlecode.com/hg/',
-    'kiln': 'https://{1}.kilnhg.com/Repo/'
-    }
+    'kiln': 'https://{1}.kilnhg.com/Repo/',
+}
+
 
 def extsetup(ui):
     schemes.update(dict(ui.configitems('schemes')))
     t = templater.engine(templater.parse)
     for scheme, url in schemes.items():
-        if (pycompat.iswindows and len(scheme) == 1 and scheme.isalpha()
-            and os.path.exists('%s:\\' % scheme)):
-            raise error.Abort(_('custom scheme %s:// conflicts with drive '
-                               'letter %s:\\\n') % (scheme, scheme.upper()))
+        if (
+            pycompat.iswindows
+            and len(scheme) == 1
+            and scheme.isalpha()
+            and os.path.exists('%s:\\' % scheme)
+        ):
+            raise error.Abort(
+                _('custom scheme %s:// conflicts with drive ' 'letter %s:\\\n')
+                % (scheme, scheme.upper())
+            )
         hg.schemes[scheme] = ShortRepository(url, scheme, t)
 
     extensions.wrapfunction(util, 'hasdriveletter', hasdriveletter)
 
+
 @command('debugexpandscheme', norepo=True)
 def expandscheme(ui, url, **opts):
     """given a repo path, provide the scheme-expanded path