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>
diff --git a/docs/manifest-format.txt b/docs/manifest-format.txt
index d8db21d..da0e69f 100644
--- a/docs/manifest-format.txt
+++ b/docs/manifest-format.txt
@@ -23,32 +23,23 @@
     <!ELEMENT manifest (remote*,
                         default?,
                         remove-project*,
-                        project*,
-                        add-remote*)>
+                        project*)>
   
     <!ELEMENT remote (EMPTY)>
     <!ATTLIST remote name         ID    #REQUIRED>
     <!ATTLIST remote fetch        CDATA #REQUIRED>
     <!ATTLIST remote review       CDATA #IMPLIED>
-    <!ATTLIST remote project-name CDATA #IMPLIED>
   
     <!ELEMENT default (EMPTY)>
     <!ATTLIST default remote   IDREF #IMPLIED>
     <!ATTLIST default revision CDATA #IMPLIED>
   
-    <!ELEMENT project (remote*)>
+    <!ELEMENT project (EMPTY)>
     <!ATTLIST project name     CDATA #REQUIRED>
     <!ATTLIST project path     CDATA #IMPLIED>
     <!ATTLIST project remote   IDREF #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)>
     <!ATTLIST remove-project name  CDATA #REQUIRED>
   ]>
@@ -82,25 +73,6 @@
 are uploaded to by `repo upload`.  This attribute is optional;
 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
 ---------------
 
@@ -152,13 +124,6 @@
 been extensively tested.  If not supplied the revision given by
 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
 ----------------------
 
diff --git a/manifest.py b/manifest.py
index 4b740e5..e7a5afb 100644
--- a/manifest.py
+++ b/manifest.py
@@ -80,8 +80,6 @@
     e.setAttribute('fetch', r.fetchUrl)
     if r.reviewUrl is not None:
       e.setAttribute('review', r.reviewUrl)
-    if r.projectName is not None:
-      e.setAttribute('project-name', r.projectName)
 
   def Save(self, fd, peg_rev=False):
     """Write the current manifest out to the given file descriptor.
@@ -133,8 +131,6 @@
       elif not d.revision or p.revision != d.revision:
         e.setAttribute('revision', p.revision)
 
-      for r in p.extraRemotes:
-        self._RemoteToXml(p.extraRemotes[r], doc, e)
       for c in p.copyfiles:
         ce = doc.createElement('copyfile')
         ce.setAttribute('src', c.src)
@@ -245,16 +241,6 @@
                 (project.name, self.manifestFile)
         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):
     name = None
     m_url = m.GetRemote(m.remote.name).url
@@ -298,16 +284,7 @@
     review = node.getAttribute('review')
     if review == '':
       review = None
-
-    projectName = node.getAttribute('project-name')
-    if projectName == '':
-      projectName = None
-
-    r = Remote(name=name,
-               fetch=fetch,
-               review=review,
-               projectName=projectName)
-    return r
+    return Remote(name=name, fetch=fetch, review=review)
 
   def _ParseDefault(self, node):
     """
@@ -367,22 +344,11 @@
                       revision = revision)
 
     for n in node.childNodes:
-      if n.nodeName == 'remote':
-        self._ParseProjectExtraRemote(project, n)
-      elif n.nodeName == 'copyfile':
+      if n.nodeName == 'copyfile':
         self._ParseCopyFile(project, n)
 
     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):
     src = self._reqatt(node, 'src')
     dest = self._reqatt(node, 'dest')
diff --git a/project.py b/project.py
index 1d908e7..5ccf33e 100644
--- a/project.py
+++ b/project.py
@@ -230,7 +230,6 @@
     self.relpath = relpath
     self.revision = revision
     self.snapshots = {}
-    self.extraRemotes = {}
     self.copyfiles = []
     self.config = GitConfig.ForRepository(
                     gitdir = self.gitdir,
@@ -579,9 +578,6 @@
       self._InitGitDir()
 
     self._InitRemote()
-    for r in self.extraRemotes.values():
-      if not self._RemoteFetch(r.name):
-        return False
     if not self._RemoteFetch():
       return False
 
@@ -1083,17 +1079,6 @@
         remote.ResetFetch(mirror=True)
       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):
     if self.manifest.branch:
       msg = 'manifest set to %s' % self.revision
diff --git a/remote.py b/remote.py
index 2a9bc7d..bb8f740 100644
--- a/remote.py
+++ b/remote.py
@@ -16,9 +16,7 @@
 class Remote(object):
   def __init__(self, name,
                fetch=None,
-               review=None,
-               projectName=None):
+               review=None):
     self.name = name
     self.fetchUrl = fetch
     self.reviewUrl = review
-    self.projectName = projectName