问题描述
我有一个Gerrit安装,其中有几个相关的项目(每个都在git仓库中)。另一个项目即将上线也会使用gerrit,但为了整洁起见,我希望把现有的一系列项目放在一个新的超级项目之下(以便在顶层可以看到伞项目。我还想保留这些数据(比如评论历史)。
一个人如何去做这样的事情?看看这个,是如何将gerrit中的一个子项目从一个超级项目移动到另一个超级项目?解析方案
我有一个Gerrit安装,其中有几个相关的项目(每个都在git仓库中)。另一个项目即将上线也会使用gerrit,但为了整洁起见,我希望把现有的一系列项目放在一个新的超级项目之下(以便在顶层可以看到伞项目。我还想保留这些数据(比如评论历史)。
一个人如何去做这样的事情?看看这个,是如何将gerrit中的一个子项目从一个超级项目移动到另一个超级项目?解析方案
感谢我偶然发现了这个早上,我找到了解决方案的坚实途径!虽然它不是很简单,但它是强大的,它的工作。
确保你已经创建了伞项目,你将重新 - 将子项目导出并执行以下步骤:
MYGERRIT = ssh:// $ {M YGERRIT_IP}:$ {MYGERRIT_PORT}
mkdir〜/ x
cd〜/ x
#克隆要重新生成子项目的子项目
git clone $ {MYGERRIT} /< subproject>
cd< subproject>
git fetch origin refs / meta / config:refs / remotes / origin / meta / config
git checkout meta / config
#更改project.config
-----> inheritFrom =< your_umbrella_project_name>
#提交更改
git add -A
EDITOR = vi git commit -a
#推送更改
git push origin meta / config:meta / config#如果直接推送
#git push origin meta / config:refs / for / meta / config#如果通过gerrit
#刷新gerrit缓存
ssh -p $ {MYGERRIT_PORT} $ {MYGERRIT_IP} gerrit flush-caches --cache project_list
ssh -p $ {MYGERRIT_PORT} $ {MYGERRIT_IP} gerrit flush-caches --cache projects
I have a Gerrit installation within which are several related projects (each in a git repository). Another project is coming online would also use gerrit, but for the sake of tidiness I'd like to take the existing set of projects and put them under a new super-project (so that at the top level one sees the "umbrella" projects. I'd also like to retain the data we have for this (e.g., the review history).
How does one go about doing something like this? Another way of looking at this is, how does one move a sub-project in gerrit from one super-project to another?
Thanks to this blog post I stumbled upon this morning, I found a solid path to the solution! While it's not exactly simple it's robust and it works.
Ensure you've already created the umbrella project you will be re-parenting the subproject to, and perform the following steps:
MYGERRIT=ssh://${MYGERRIT_IP}:${MYGERRIT_PORT}
mkdir ~/x
cd ~/x
# Clone the repo for the subproject you want to re-parent
git clone ${MYGERRIT}/<subproject>
cd <subproject>
git fetch origin refs/meta/config:refs/remotes/origin/meta/config
git checkout meta/config
# Make changes to project.config
-----> inheritFrom = <your_umbrella_project_name>
# Commit changes
git add -A
EDITOR=vi git commit -a
# Push changes
git push origin meta/config:meta/config # If pushing directly
#git push origin meta/config:refs/for/meta/config # If going through gerrit
# Flush gerrit caches
ssh -p ${MYGERRIT_PORT} ${MYGERRIT_IP} gerrit flush-caches --cache project_list
ssh -p ${MYGERRIT_PORT} ${MYGERRIT_IP} gerrit flush-caches --cache projects
这篇关于在Gerrit中如何获得几个顶级项目并将它们移动到另一个“容器”中?项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!