hgext/schemes.py
changeset 43076 2372284d9457
parent 39549 089fc0db0954
child 43077 687b865b95ad
--- 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