mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
Add support for url.*.insteadof
Teach repo how to resolve URLs using the url.insteadof feature that C Git natively uses during clone, fetch or push. This will later allow repo to resolve a URL before accessing it directly. We do not want to pre-resolve things and store the resolved URL into individual projects, as this makes it impossible for the user to undo the insteadof mapping at a later date. Change-Id: I0f62e811197c53fbc8a8be424e3cabf4ed07b4cb Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
parent
bd0312a484
commit
13111b4e97
@ -198,6 +198,15 @@ class GitConfig(object):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def UrlInsteadOf(self, url):
|
||||||
|
"""Resolve any url.*.insteadof references.
|
||||||
|
"""
|
||||||
|
for new_url in self.GetSubSections('url'):
|
||||||
|
old_url = self.GetString('url.%s.insteadof' % new_url)
|
||||||
|
if old_url is not None and url.startswith(old_url):
|
||||||
|
return new_url + url[len(old_url):]
|
||||||
|
return url
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _sections(self):
|
def _sections(self):
|
||||||
d = self._section_dict
|
d = self._section_dict
|
||||||
|
Loading…
Reference in New Issue
Block a user