changeset 27981:d630eac3a5db

schemes: extract scheme expansion as its own method on ShortRepository
author Jason R. Coombs <jaraco@jaraco.com>
date Fri, 29 Jan 2016 14:40:41 -0500
parents 01a5143cd25f
children bf1d5c223ac0
files hgext/schemes.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/schemes.py	Wed Feb 03 16:24:24 2016 -0600
+++ b/hgext/schemes.py	Fri Jan 29 14:40:41 2016 -0500
@@ -65,6 +65,10 @@
         return '<ShortRepository: %s>' % self.scheme
 
     def instance(self, ui, url, create):
+        url = self.resolve(url)
+        return hg._peerlookup(url).instance(ui, url, create)
+
+    def resolve(self, url):
         # Should this use the util.url class, or is manual parsing better?
         try:
             url = url.split('://', 1)[1]
@@ -77,8 +81,7 @@
         else:
             tail = ''
         context = dict((str(i + 1), v) for i, v in enumerate(parts))
-        url = ''.join(self.templater.process(self.url, context)) + tail
-        return hg._peerlookup(url).instance(ui, url, create)
+        return ''.join(self.templater.process(self.url, context)) + tail
 
 def hasdriveletter(orig, path):
     if path: