Patchwork [1,of,3,STABLE] schemes: extract scheme expansion as its own method on ShortRepository

login
register
mail settings
Submitter Jason R. Coombs
Date Jan. 29, 2016, 8:13 p.m.
Message ID <69854d00f42654a31d11.1454098435@waste.org>
Download mbox | patch
Permalink /patch/12909/
State Superseded
Commit d630eac3a5dbaf33a12e23d65abeff4d54df9f10
Headers show

Comments

Jason R. Coombs - Jan. 29, 2016, 8:13 p.m.
# HG changeset patch
# User Jason R. Coombs <jaraco@jaraco.com>
# Date 1454096441 18000
#      Fri Jan 29 14:40:41 2016 -0500
# Branch stable
# Node ID 69854d00f42654a31d113294024f50c9e81e8779
# Parent  7cb7264cfd52d2672644db4bc16a0bd50aa093ca
schemes: extract scheme expansion as its own method on ShortRepository

Patch

diff --git a/hgext/schemes.py b/hgext/schemes.py
--- a/hgext/schemes.py
+++ b/hgext/schemes.py
@@ -65,6 +65,10 @@ 
         return '<ShortRepository: %s>' % self.scheme
 
     def instance(self, ui, url, create):
+        url = self.resolve(ui, url)
+        return hg._peerlookup(url).instance(ui, url, create)
+
+    def resolve(self, ui, 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: