mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
implement optional 'pushurl' in the manifest file
Allow the 'remote' element in the manifest file to define an optional 'pushurl' attribute which is passed into the .git/config file. Change-Id: If342d299d371374aedc4440645798888869c9714 Signed-off-by: Steve Rae <steve.rae@raedomain.com>
This commit is contained in:
parent
628456833a
commit
d648045366
@ -35,6 +35,7 @@ following DTD:
|
|||||||
<!ATTLIST remote name ID #REQUIRED>
|
<!ATTLIST remote name ID #REQUIRED>
|
||||||
<!ATTLIST remote alias CDATA #IMPLIED>
|
<!ATTLIST remote alias CDATA #IMPLIED>
|
||||||
<!ATTLIST remote fetch CDATA #REQUIRED>
|
<!ATTLIST remote fetch CDATA #REQUIRED>
|
||||||
|
<!ATTLIST remote pushurl CDATA #IMPLIED>
|
||||||
<!ATTLIST remote review CDATA #IMPLIED>
|
<!ATTLIST remote review CDATA #IMPLIED>
|
||||||
<!ATTLIST remote revision CDATA #IMPLIED>
|
<!ATTLIST remote revision CDATA #IMPLIED>
|
||||||
|
|
||||||
@ -125,6 +126,12 @@ Attribute `fetch`: The Git URL prefix for all projects which use
|
|||||||
this remote. Each project's name is appended to this prefix to
|
this remote. Each project's name is appended to this prefix to
|
||||||
form the actual URL used to clone the project.
|
form the actual URL used to clone the project.
|
||||||
|
|
||||||
|
Attribute `pushurl`: The Git "push" URL prefix for all projects
|
||||||
|
which use this remote. Each project's name is appended to this
|
||||||
|
prefix to form the actual URL used to "git push" the project.
|
||||||
|
This attribute is optional; if not specified then "git push"
|
||||||
|
will use the same URL as the `fetch` attribute.
|
||||||
|
|
||||||
Attribute `review`: Hostname of the Gerrit server where reviews
|
Attribute `review`: Hostname of the Gerrit server where reviews
|
||||||
are uploaded to by `repo upload`. This attribute is optional;
|
are uploaded to by `repo upload`. This attribute is optional;
|
||||||
if not specified then `repo upload` will not function.
|
if not specified then `repo upload` will not function.
|
||||||
|
@ -572,6 +572,7 @@ class Remote(object):
|
|||||||
self._config = config
|
self._config = config
|
||||||
self.name = name
|
self.name = name
|
||||||
self.url = self._Get('url')
|
self.url = self._Get('url')
|
||||||
|
self.pushUrl = self._Get('pushurl')
|
||||||
self.review = self._Get('review')
|
self.review = self._Get('review')
|
||||||
self.projectname = self._Get('projectname')
|
self.projectname = self._Get('projectname')
|
||||||
self.fetch = list(map(RefSpec.FromString,
|
self.fetch = list(map(RefSpec.FromString,
|
||||||
@ -701,6 +702,10 @@ class Remote(object):
|
|||||||
"""Save this remote to the configuration.
|
"""Save this remote to the configuration.
|
||||||
"""
|
"""
|
||||||
self._Set('url', self.url)
|
self._Set('url', self.url)
|
||||||
|
if self.pushUrl is not None:
|
||||||
|
self._Set('pushurl', self.pushUrl + '/' + self.projectname)
|
||||||
|
else:
|
||||||
|
self._Set('pushurl', self.pushUrl)
|
||||||
self._Set('review', self.review)
|
self._Set('review', self.review)
|
||||||
self._Set('projectname', self.projectname)
|
self._Set('projectname', self.projectname)
|
||||||
self._Set('fetch', list(map(str, self.fetch)))
|
self._Set('fetch', list(map(str, self.fetch)))
|
||||||
|
@ -64,11 +64,13 @@ class _XmlRemote(object):
|
|||||||
name,
|
name,
|
||||||
alias=None,
|
alias=None,
|
||||||
fetch=None,
|
fetch=None,
|
||||||
|
pushUrl=None,
|
||||||
manifestUrl=None,
|
manifestUrl=None,
|
||||||
review=None,
|
review=None,
|
||||||
revision=None):
|
revision=None):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.fetchUrl = fetch
|
self.fetchUrl = fetch
|
||||||
|
self.pushUrl = pushUrl
|
||||||
self.manifestUrl = manifestUrl
|
self.manifestUrl = manifestUrl
|
||||||
self.remoteAlias = alias
|
self.remoteAlias = alias
|
||||||
self.reviewUrl = review
|
self.reviewUrl = review
|
||||||
@ -104,6 +106,7 @@ class _XmlRemote(object):
|
|||||||
remoteName = self.remoteAlias
|
remoteName = self.remoteAlias
|
||||||
return RemoteSpec(remoteName,
|
return RemoteSpec(remoteName,
|
||||||
url=url,
|
url=url,
|
||||||
|
pushUrl=self.pushUrl,
|
||||||
review=self.reviewUrl,
|
review=self.reviewUrl,
|
||||||
orig_name=self.name)
|
orig_name=self.name)
|
||||||
|
|
||||||
@ -160,6 +163,8 @@ class XmlManifest(object):
|
|||||||
root.appendChild(e)
|
root.appendChild(e)
|
||||||
e.setAttribute('name', r.name)
|
e.setAttribute('name', r.name)
|
||||||
e.setAttribute('fetch', r.fetchUrl)
|
e.setAttribute('fetch', r.fetchUrl)
|
||||||
|
if r.pushUrl is not None:
|
||||||
|
e.setAttribute('pushurl', r.pushUrl)
|
||||||
if r.remoteAlias is not None:
|
if r.remoteAlias is not None:
|
||||||
e.setAttribute('alias', r.remoteAlias)
|
e.setAttribute('alias', r.remoteAlias)
|
||||||
if r.reviewUrl is not None:
|
if r.reviewUrl is not None:
|
||||||
@ -639,6 +644,9 @@ class XmlManifest(object):
|
|||||||
if alias == '':
|
if alias == '':
|
||||||
alias = None
|
alias = None
|
||||||
fetch = self._reqatt(node, 'fetch')
|
fetch = self._reqatt(node, 'fetch')
|
||||||
|
pushUrl = node.getAttribute('pushurl')
|
||||||
|
if pushUrl == '':
|
||||||
|
pushUrl = None
|
||||||
review = node.getAttribute('review')
|
review = node.getAttribute('review')
|
||||||
if review == '':
|
if review == '':
|
||||||
review = None
|
review = None
|
||||||
@ -646,7 +654,7 @@ class XmlManifest(object):
|
|||||||
if revision == '':
|
if revision == '':
|
||||||
revision = None
|
revision = None
|
||||||
manifestUrl = self.manifestProject.config.GetString('remote.origin.url')
|
manifestUrl = self.manifestProject.config.GetString('remote.origin.url')
|
||||||
return _XmlRemote(name, alias, fetch, manifestUrl, review, revision)
|
return _XmlRemote(name, alias, fetch, pushUrl, manifestUrl, review, revision)
|
||||||
|
|
||||||
def _ParseDefault(self, node):
|
def _ParseDefault(self, node):
|
||||||
"""
|
"""
|
||||||
|
@ -320,11 +320,13 @@ class RemoteSpec(object):
|
|||||||
def __init__(self,
|
def __init__(self,
|
||||||
name,
|
name,
|
||||||
url=None,
|
url=None,
|
||||||
|
pushUrl=None,
|
||||||
review=None,
|
review=None,
|
||||||
revision=None,
|
revision=None,
|
||||||
orig_name=None):
|
orig_name=None):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.url = url
|
self.url = url
|
||||||
|
self.pushUrl = pushUrl
|
||||||
self.review = review
|
self.review = review
|
||||||
self.revision = revision
|
self.revision = revision
|
||||||
self.orig_name = orig_name
|
self.orig_name = orig_name
|
||||||
@ -1825,6 +1827,7 @@ class Project(object):
|
|||||||
|
|
||||||
remote = RemoteSpec(self.remote.name,
|
remote = RemoteSpec(self.remote.name,
|
||||||
url=url,
|
url=url,
|
||||||
|
pushUrl=self.remote.pushUrl,
|
||||||
review=self.remote.review,
|
review=self.remote.review,
|
||||||
revision=self.remote.revision)
|
revision=self.remote.revision)
|
||||||
subproject = Project(manifest=self.manifest,
|
subproject = Project(manifest=self.manifest,
|
||||||
@ -2346,6 +2349,7 @@ class Project(object):
|
|||||||
if self.remote.url:
|
if self.remote.url:
|
||||||
remote = self.GetRemote(self.remote.name)
|
remote = self.GetRemote(self.remote.name)
|
||||||
remote.url = self.remote.url
|
remote.url = self.remote.url
|
||||||
|
remote.pushUrl = self.remote.pushUrl
|
||||||
remote.review = self.remote.review
|
remote.review = self.remote.review
|
||||||
remote.projectname = self.name
|
remote.projectname = self.name
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user