diff options
author | Michael Kelly <mkelly@arista.com> | 2020-06-13 02:10:40 -0700 |
---|---|---|
committer | Michael Kelly <mkelly@arista.com> | 2021-09-28 20:12:00 +0000 |
commit | 37c21c268badc2602a827d2236027e235fff95e0 (patch) | |
tree | d2d8c1b751e38036acb6a530bea9b6dae121147b /manifest_xml.py | |
parent | b12c369e0bce29914a50aca258271b25893d2857 (diff) | |
download | git-repo-37c21c268badc2602a827d2236027e235fff95e0.tar.gz |
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 <vapier@google.com>
Tested-by: Michael Kelly <mkelly@arista.com>
Diffstat (limited to 'manifest_xml.py')
-rw-r--r-- | manifest_xml.py | 11 |
1 files changed, 11 insertions, 0 deletions
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 | |||
868 | 'project: %s' % name) | 868 | 'project: %s' % name) |
869 | 869 | ||
870 | path = node.getAttribute('path') | 870 | path = node.getAttribute('path') |
871 | dest_path = node.getAttribute('dest-path') | ||
871 | groups = node.getAttribute('groups') | 872 | groups = node.getAttribute('groups') |
872 | if groups: | 873 | if groups: |
873 | groups = self._ParseList(groups) | 874 | groups = self._ParseList(groups) |
@@ -876,6 +877,10 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md | |||
876 | if remote: | 877 | if remote: |
877 | remote = self._get_remote(node) | 878 | remote = self._get_remote(node) |
878 | 879 | ||
880 | named_projects = self._projects[name] | ||
881 | if dest_path and not path and len(named_projects) > 1: | ||
882 | raise ManifestParseError('extend-project cannot use dest-path when ' | ||
883 | 'matching multiple projects: %s' % name) | ||
879 | for p in self._projects[name]: | 884 | for p in self._projects[name]: |
880 | if path and p.relpath != path: | 885 | if path and p.relpath != path: |
881 | continue | 886 | continue |
@@ -889,6 +894,12 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md | |||
889 | p.revisionId = None | 894 | p.revisionId = None |
890 | if remote: | 895 | if remote: |
891 | p.remote = remote.ToRemoteSpec(name) | 896 | p.remote = remote.ToRemoteSpec(name) |
897 | if dest_path: | ||
898 | del self._paths[p.relpath] | ||
899 | relpath, worktree, gitdir, objdir, _ = self.GetProjectPaths(name, dest_path) | ||
900 | p.UpdatePaths(relpath, worktree, gitdir, objdir) | ||
901 | self._paths[p.relpath] = p | ||
902 | |||
892 | if node.nodeName == 'repo-hooks': | 903 | if node.nodeName == 'repo-hooks': |
893 | # Only one project can be the hooks project | 904 | # Only one project can be the hooks project |
894 | if repo_hooks_project is not None: | 905 | if repo_hooks_project is not None: |