mirror of
https://gerrit.googlesource.com/git-repo
synced 2025-01-02 16:14:25 +00:00
Better handling of duplicate remotes
In the current implementation, an error is raised if a remote with the same name is defined more than once. The check is only that the remote has the same name as an existing remote. With the support for multiple local manifests, it is more likely than before that the same remote is defined in more than one manifest. Change the check so that it only raises an error if a remote is defined more than once with the same name, but different attributes. Change-Id: Ic3608646cf9f40aa2bea7015d3ecd099c5f5f835
This commit is contained in:
parent
5566ae5dde
commit
717ece9d81
@ -54,6 +54,12 @@ class _XmlRemote(object):
|
|||||||
self.reviewUrl = review
|
self.reviewUrl = review
|
||||||
self.resolvedFetchUrl = self._resolveFetchUrl()
|
self.resolvedFetchUrl = self._resolveFetchUrl()
|
||||||
|
|
||||||
|
def __eq__(self, other):
|
||||||
|
return self.__dict__ == other.__dict__
|
||||||
|
|
||||||
|
def __ne__(self, other):
|
||||||
|
return self.__dict__ != other.__dict__
|
||||||
|
|
||||||
def _resolveFetchUrl(self):
|
def _resolveFetchUrl(self):
|
||||||
url = self.fetchUrl.rstrip('/')
|
url = self.fetchUrl.rstrip('/')
|
||||||
manifestUrl = self.manifestUrl.rstrip('/')
|
manifestUrl = self.manifestUrl.rstrip('/')
|
||||||
@ -365,11 +371,14 @@ class XmlManifest(object):
|
|||||||
for node in itertools.chain(*node_list):
|
for node in itertools.chain(*node_list):
|
||||||
if node.nodeName == 'remote':
|
if node.nodeName == 'remote':
|
||||||
remote = self._ParseRemote(node)
|
remote = self._ParseRemote(node)
|
||||||
if self._remotes.get(remote.name):
|
if remote:
|
||||||
raise ManifestParseError(
|
if remote.name in self._remotes:
|
||||||
'duplicate remote %s in %s' %
|
if remote != self._remotes[remote.name]:
|
||||||
(remote.name, self.manifestFile))
|
raise ManifestParseError(
|
||||||
self._remotes[remote.name] = remote
|
'remote %s already exists with different attributes' %
|
||||||
|
(remote.name))
|
||||||
|
else:
|
||||||
|
self._remotes[remote.name] = remote
|
||||||
|
|
||||||
for node in itertools.chain(*node_list):
|
for node in itertools.chain(*node_list):
|
||||||
if node.nodeName == 'default':
|
if node.nodeName == 'default':
|
||||||
|
Loading…
Reference in New Issue
Block a user