Mercurial > hg
comparison hgext/schemes.py @ 18910:b52404a914a9
scheme: don't crash on invalid URLs
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Thu, 11 Apr 2013 14:41:22 +0200 |
parents | e95ec38f86b0 |
children | 80c5b2666a96 |
comparison
equal
deleted
inserted
replaced
18909:3a72c89a83ec | 18910:b52404a914a9 |
---|---|
60 def __repr__(self): | 60 def __repr__(self): |
61 return '<ShortRepository: %s>' % self.scheme | 61 return '<ShortRepository: %s>' % self.scheme |
62 | 62 |
63 def instance(self, ui, url, create): | 63 def instance(self, ui, url, create): |
64 # Should this use the util.url class, or is manual parsing better? | 64 # Should this use the util.url class, or is manual parsing better? |
65 url = url.split('://', 1)[1] | 65 try: |
66 url = url.split('://', 1)[1] | |
67 except IndexError: | |
68 raise util.Abort(_("no '://' in scheme url '%s'") % url) | |
66 parts = url.split('/', self.parts) | 69 parts = url.split('/', self.parts) |
67 if len(parts) > self.parts: | 70 if len(parts) > self.parts: |
68 tail = parts[-1] | 71 tail = parts[-1] |
69 parts = parts[:-1] | 72 parts = parts[:-1] |
70 else: | 73 else: |