From 37c21c268badc2602a827d2236027e235fff95e0 Mon Sep 17 00:00:00 2001 From: Michael Kelly Date: Sat, 13 Jun 2020 02:10:40 -0700 Subject: Add 'dest-path' to extend-project to support changing path This allows us to move the repository to a new location in the source tree without having to remove-project + add a new project tag. Change-Id: I4dba6151842e57f6f2b8fe60cda260ecea68b7b4 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/310962 Reviewed-by: Mike Frysinger Tested-by: Michael Kelly --- manifest_xml.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'manifest_xml.py') diff --git a/manifest_xml.py b/manifest_xml.py index 86f20202..39656975 100644 --- a/manifest_xml.py +++ b/manifest_xml.py @@ -868,6 +868,7 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md 'project: %s' % name) path = node.getAttribute('path') + dest_path = node.getAttribute('dest-path') groups = node.getAttribute('groups') if groups: groups = self._ParseList(groups) @@ -876,6 +877,10 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md if remote: remote = self._get_remote(node) + named_projects = self._projects[name] + if dest_path and not path and len(named_projects) > 1: + raise ManifestParseError('extend-project cannot use dest-path when ' + 'matching multiple projects: %s' % name) for p in self._projects[name]: if path and p.relpath != path: continue @@ -889,6 +894,12 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md p.revisionId = None if remote: p.remote = remote.ToRemoteSpec(name) + if dest_path: + del self._paths[p.relpath] + relpath, worktree, gitdir, objdir, _ = self.GetProjectPaths(name, dest_path) + p.UpdatePaths(relpath, worktree, gitdir, objdir) + self._paths[p.relpath] = p + if node.nodeName == 'repo-hooks': # Only one project can be the hooks project if repo_hooks_project is not None: -- cgit v1.2.3-54-g00ecf