parameters: (self, repo_manifest)
docstring: Parse an XML manifest of repository info as produced
          by the `repo manifest -r` command.
docstring_summary: Parse an XML manifest of repository info as produced
          by the `repo manifest -r` command.
docstring_tokens: Parse an XML manifest of repository info as produced by the repo manifest - r command .
function: def parse_repo_manifest(self, repo_manifest):
          """
          Parse an XML manifest of repository info as produced
          by the `repo manifest -r` command.
          """
          doc = parse(repo_manifest)
          if doc.firstChild.tagName != "manifest":
              return
          # First, get remotes.
          remotes = dict([(r.getAttribute("name"), r.getAttribute("fetch")) for r in doc.getElementsByTagName("remote")])
          # And default remote.
          default_remote = None
          if doc.getElementsByTagName("default"):
              default_remote = doc.getElementsByTagName("default")[0].getAttribute("remote")
          # Now get projects. Assume they're relative to repo_manifest.
          base_dir = os.path.abspath(os.path.dirname(repo_manifest))
          for proj in doc.getElementsByTagName("project"):
              # name is the repository URL relative to the remote path.
              name = proj.getAttribute("name")
              # path is the path on-disk, relative to the manifest file.
              path = proj.getAttribute("path")
              # revision is the changeset ID.
              rev = proj.getAttribute("revision")
              # remote is the base URL to use.
              remote = proj.getAttribute("remote")
              # remote defaults to the <default remote>.
              if not remote:
                  remote = default_remote
              # path defaults to name.
              if not path:
                  path = name
              if not (name and path and rev and remote):
                  print "Skipping project %s" % proj.toxml()
                  continue
              remote = remotes[remote]
              # Turn git URLs into http URLs so that urljoin works.
              if remote.startswith("git:"):
                  remote = "http" + remote[3:]
              # Add this project to srcdirs.
              srcdir = os.path.join(base_dir, path)
              self.srcdirs.append(srcdir)
              # And cache its VCS file info. Currently all repos mentioned
              # in a repo manifest are assumed to be git.
              root = urlparse.urljoin(remote, name)
              srcdirRepoInfo[srcdir] = GitRepoInfo(srcdir, rev, root)
function_tokens: def parse_repo_manifest ( self , repo_manifest ) : doc = parse ( repo_manifest ) if doc . firstChild . tagName != "manifest" : return # First, get remotes. remotes = dict ( [ ( r . getAttribute ( "name" ) , r . getAttribute ( "fetch" ) ) for r in doc . getElementsByTagName ( "remote" ) ] ) # And default remote. default_remote = None if doc . getElementsByTagName ( "default" ) : default_remote = doc . getElementsByTagName ( "default" ) [ 0 ] . getAttribute ( "remote" ) # Now get projects. Assume they're relative to repo_manifest. base_dir = os . path . abspath ( os . path . dirname ( repo_manifest ) ) for proj in doc . getElementsByTagName ( "project" ) : # name is the repository URL relative to the remote path. name = proj . getAttribute ( "name" ) # path is the path on-disk, relative to the manifest file. path = proj . getAttribute ( "path" ) # revision is the changeset ID. rev = proj . getAttribute ( "revision" ) # remote is the base URL to use. remote = proj . getAttribute ( "remote" ) # remote defaults to the <default remote>. if not remote : remote = default_remote # path defaults to name. if not path : path = name if not ( name and path and rev and remote ) : print "Skipping project %s" % proj . toxml ( ) continue remote = remotes [ remote ] # Turn git URLs into http URLs so that urljoin works. if remote . startswith ( "git:" ) : remote = "http" + remote [ 3 : ] # Add this project to srcdirs. srcdir = os . path . join ( base_dir , path ) self . srcdirs . append ( srcdir ) # And cache its VCS file info. Currently all repos mentioned # in a repo manifest are assumed to be git. root = urlparse . urljoin ( remote , name ) srcdirRepoInfo [ srcdir ] = GitRepoInfo ( srcdir , rev , root )