Remove support for the extra <remote> definitions in manifests

These aren't that widely used, and actually make it difficult for
users to fully mirror a forest of repositories, and then permit
someone else to clone off that forest, rather then the original
upstream servers.

Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce 2009-05-19 13:00:29 -07:00
parent 4cc70ce501
commit 242b52690d
4 changed files with 5 additions and 91 deletions

View File

@ -23,32 +23,23 @@ following DTD:
<!ELEMENT manifest (remote*, <!ELEMENT manifest (remote*,
default?, default?,
remove-project*, remove-project*,
project*, project*)>
add-remote*)>
<!ELEMENT remote (EMPTY)> <!ELEMENT remote (EMPTY)>
<!ATTLIST remote name ID #REQUIRED> <!ATTLIST remote name ID #REQUIRED>
<!ATTLIST remote fetch CDATA #REQUIRED> <!ATTLIST remote fetch CDATA #REQUIRED>
<!ATTLIST remote review CDATA #IMPLIED> <!ATTLIST remote review CDATA #IMPLIED>
<!ATTLIST remote project-name CDATA #IMPLIED>
<!ELEMENT default (EMPTY)> <!ELEMENT default (EMPTY)>
<!ATTLIST default remote IDREF #IMPLIED> <!ATTLIST default remote IDREF #IMPLIED>
<!ATTLIST default revision CDATA #IMPLIED> <!ATTLIST default revision CDATA #IMPLIED>
<!ELEMENT project (remote*)> <!ELEMENT project (EMPTY)>
<!ATTLIST project name CDATA #REQUIRED> <!ATTLIST project name CDATA #REQUIRED>
<!ATTLIST project path CDATA #IMPLIED> <!ATTLIST project path CDATA #IMPLIED>
<!ATTLIST project remote IDREF #IMPLIED> <!ATTLIST project remote IDREF #IMPLIED>
<!ATTLIST project revision CDATA #IMPLIED> <!ATTLIST project revision CDATA #IMPLIED>
<!ELEMENT add-remote (EMPTY)>
<!ATTLIST add-remote to-project ID #REQUIRED>
<!ATTLIST add-remote name ID #REQUIRED>
<!ATTLIST add-remote fetch CDATA #REQUIRED>
<!ATTLIST add-remote review CDATA #IMPLIED>
<!ATTLIST add-remote project-name CDATA #IMPLIED>
<!ELEMENT remove-project (EMPTY)> <!ELEMENT remove-project (EMPTY)>
<!ATTLIST remove-project name CDATA #REQUIRED> <!ATTLIST remove-project name CDATA #REQUIRED>
]> ]>
@ -82,25 +73,6 @@ 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.
Attribute `project-name`: Specifies the name of this project used
by the review server given in the review attribute of this element.
Only permitted when the remote element is nested inside of a project
element (see below). If not given, defaults to the name supplied
in the project's name attribute.
Element add-remote
------------------
Adds a remote to an existing project, whose name is given by the
to-project attribute. This is functionally equivalent to nesting
a remote element under the project, but has the advantage that it
can be specified in the uesr's `local_manifest.xml` to add a remote
to a project declared by the normal manifest.
The element can be used to add a fork of an existing project that
the user needs to work with.
Element default Element default
--------------- ---------------
@ -152,13 +124,6 @@ Tags and/or explicit SHA-1s should work in theory, but have not
been extensively tested. If not supplied the revision given by been extensively tested. If not supplied the revision given by
the default element is used. the default element is used.
Child element `remote`: Described like the top-level remote element,
but adds an additional remote to only this project. These additional
remotes are fetched from first on the initial `repo sync`, causing
the majority of the project's object database to be obtained through
these additional remotes.
Element remove-project Element remove-project
---------------------- ----------------------

View File

@ -80,8 +80,6 @@ class Manifest(object):
e.setAttribute('fetch', r.fetchUrl) e.setAttribute('fetch', r.fetchUrl)
if r.reviewUrl is not None: if r.reviewUrl is not None:
e.setAttribute('review', r.reviewUrl) e.setAttribute('review', r.reviewUrl)
if r.projectName is not None:
e.setAttribute('project-name', r.projectName)
def Save(self, fd, peg_rev=False): def Save(self, fd, peg_rev=False):
"""Write the current manifest out to the given file descriptor. """Write the current manifest out to the given file descriptor.
@ -133,8 +131,6 @@ class Manifest(object):
elif not d.revision or p.revision != d.revision: elif not d.revision or p.revision != d.revision:
e.setAttribute('revision', p.revision) e.setAttribute('revision', p.revision)
for r in p.extraRemotes:
self._RemoteToXml(p.extraRemotes[r], doc, e)
for c in p.copyfiles: for c in p.copyfiles:
ce = doc.createElement('copyfile') ce = doc.createElement('copyfile')
ce.setAttribute('src', c.src) ce.setAttribute('src', c.src)
@ -245,16 +241,6 @@ class Manifest(object):
(project.name, self.manifestFile) (project.name, self.manifestFile)
self._projects[project.name] = project self._projects[project.name] = project
for node in config.childNodes:
if node.nodeName == 'add-remote':
pn = self._reqatt(node, 'to-project')
project = self._projects.get(pn)
if not project:
raise ManifestParseError, \
'project %s not defined in %s' % \
(pn, self.manifestFile)
self._ParseProjectExtraRemote(project, node)
def _AddMetaProjectMirror(self, m): def _AddMetaProjectMirror(self, m):
name = None name = None
m_url = m.GetRemote(m.remote.name).url m_url = m.GetRemote(m.remote.name).url
@ -298,16 +284,7 @@ class Manifest(object):
review = node.getAttribute('review') review = node.getAttribute('review')
if review == '': if review == '':
review = None review = None
return Remote(name=name, fetch=fetch, review=review)
projectName = node.getAttribute('project-name')
if projectName == '':
projectName = None
r = Remote(name=name,
fetch=fetch,
review=review,
projectName=projectName)
return r
def _ParseDefault(self, node): def _ParseDefault(self, node):
""" """
@ -367,22 +344,11 @@ class Manifest(object):
revision = revision) revision = revision)
for n in node.childNodes: for n in node.childNodes:
if n.nodeName == 'remote': if n.nodeName == 'copyfile':
self._ParseProjectExtraRemote(project, n)
elif n.nodeName == 'copyfile':
self._ParseCopyFile(project, n) self._ParseCopyFile(project, n)
return project return project
def _ParseProjectExtraRemote(self, project, n):
r = self._ParseRemote(n)
if project.extraRemotes.get(r.name) \
or project.remote.name == r.name:
raise ManifestParseError, \
'duplicate remote %s in project %s in %s' % \
(r.name, project.name, self.manifestFile)
project.extraRemotes[r.name] = r
def _ParseCopyFile(self, project, node): def _ParseCopyFile(self, project, node):
src = self._reqatt(node, 'src') src = self._reqatt(node, 'src')
dest = self._reqatt(node, 'dest') dest = self._reqatt(node, 'dest')

View File

@ -230,7 +230,6 @@ class Project(object):
self.relpath = relpath self.relpath = relpath
self.revision = revision self.revision = revision
self.snapshots = {} self.snapshots = {}
self.extraRemotes = {}
self.copyfiles = [] self.copyfiles = []
self.config = GitConfig.ForRepository( self.config = GitConfig.ForRepository(
gitdir = self.gitdir, gitdir = self.gitdir,
@ -579,9 +578,6 @@ class Project(object):
self._InitGitDir() self._InitGitDir()
self._InitRemote() self._InitRemote()
for r in self.extraRemotes.values():
if not self._RemoteFetch(r.name):
return False
if not self._RemoteFetch(): if not self._RemoteFetch():
return False return False
@ -1083,17 +1079,6 @@ class Project(object):
remote.ResetFetch(mirror=True) remote.ResetFetch(mirror=True)
remote.Save() remote.Save()
for r in self.extraRemotes.values():
remote = self.GetRemote(r.name)
remote.url = r.fetchUrl
remote.review = r.reviewUrl
if r.projectName:
remote.projectname = r.projectName
elif remote.projectname is None:
remote.projectname = self.name
remote.ResetFetch()
remote.Save()
def _InitMRef(self): def _InitMRef(self):
if self.manifest.branch: if self.manifest.branch:
msg = 'manifest set to %s' % self.revision msg = 'manifest set to %s' % self.revision

View File

@ -16,9 +16,7 @@
class Remote(object): class Remote(object):
def __init__(self, name, def __init__(self, name,
fetch=None, fetch=None,
review=None, review=None):
projectName=None):
self.name = name self.name = name
self.fetchUrl = fetch self.fetchUrl = fetch
self.reviewUrl = review self.reviewUrl = review
self.projectName = projectName