After I rename the project and login to gerrit, I don't even see the project name(old/new) under list of projects.
On Friday, November 9, 2012 3:38:50 PM UTC-8, Shawn Pearce wrote:On Fri, Nov 9, 2012 at 3:23 PM, Jen <jstan...@gmail.com> wrote:
> I created a test gerrit project, and renamed it. (mv old_name.git
> new_name.git)
>
> However, I do not see anything under the changes table. So, the UPDATE would
> not work.
It won't fail either.
The update is necessary to correct any prior or pending code reviews.
If you have no code reviews (e.g. brand new repository) then there is
nothing to update.
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en
Could you pl let me know how to correctly rename a Gerrit Code Review (2.4.2) project?
Hello to all,
here are my steps to rename Gerrit projects in Gerrit version 2.9(.0) performed in linux command line.
Lets say your project to rename is called projecttorename.old and you like to change its name to projecttorename.new.
1. Check submodules
Discover whether project projecttorename.old is submodule of other projects. If so, you have to modify submodule configuration of these affected projects (it's stored in file .gitmodules). Submodule is a project that is linked to another project and that project in fact depends on its submodule. If you rename submodule and not configuration of dependent project, then that dependent project could not be cloned with module any more.
So check if project servers as submodule to I have not an idea how to do it gently and easily, so all projects were cloned and file .gitmodules was searched in root directory of these projects. If it referred to projecttorename.old, then projecttorename.old was a submodule.
2. Check permission inheritance
Does other projects inherit permissions from your projecttorename.old? If so, do not forget to update it after end of renaming.
To see inheritance tree try
ssh -p 29418 adminusername@gerrit-hostname gerrit ls-projects --tree
Could you see projecttorename.old as a leaf in that graph with no another project inheritting from it? If so, it's OK. However, if another project (e.g. projectA) depends on projecttorename.old, you will have to update configuration of permissions of projectA at the end of the process.
Here there are two ways for renaming project:
NO-SUBMODULES (the project projecttorename.old is not a submodule of other projects and there are no submodules defined in the project) and WITH-SUBMODULES (project projecttorename.old is either submodule or there are some submodules defined inside it)
NO-SUBMODULES WAY
No submodules, no code review.
3. Update of project name in Gerrit database
Here shown for internal H2 database. You have to update tables ACCOUNT_PROJECT_WATCHES a CHANGES
UPDATE ACCOUNT_PROJECT_WATCHES SET PROJECT_NAME='projecttorename.new' WHERE PROJECT_NAME='projecttorename.old';
UPDATE CHANGES SET DEST_PROJECT_NAME='projecttorename.new' WHERE DEST_PROJECT_NAME='projecttorename.old';
4. Rename directory on filesystem of Gerrit server
cd /path/to/repository/base
mv projecttorename.old.git projecttorename.new.git
5. Flush Gerrit cache
ssh -p 29418 adminusername@gerrit-hostname gerrit flush-caches --all
6. Reindexing of Gerrit
Stop Gerrit.
java -jar /home/gerrit/review_site/bin/gerrit.war reindex -d /home/gerrit/review_siteStart Gerrit.
7. Update permission inheritance (Rights Inherit From), if necessary
Web UI > Projects > Select projecttorename.new > Access > Edit
8. Optional: Clone project
To verify your project was renamed, clone it (projecttorename.new) to your local machine.
WITH-SUBMODULES
Let's assume the most complicated case: you rename both
commontorename.old (common projects with submodule submoduletorename.old project) and
submoduletorename.old to new names. Your project commontorename.old is configured that all changes must be reviewed with code-review functionality to be merged on remote server.
3. Clone commontorename.old to local disk
4. Update submodule URL
Open file commontorename.old/.gitmodules and update URL of submodule.
Example:
after update
5. Install hook commit-msg just to add Change-Id tag
Change-Id in commit message is necessary for accepting change to code review.
cd /path/to/localrepobase/
cd commontorename.old
scp -p -P 29418 admin@gerrit.company.com:hooks/commit-msg .git/hooks/
6. Rename submodule project
According to NO-SUBMODULES scheme, rename
submoduletorename.old to submoduletorename.newcd commontorename.old
git add .gitmodules
git commit -m "Submodule URL update"
git push --progress origin refs/heads/master:refs/for/master
git fetch --progress origin
git statusUPDATE ACCOUNT_PROJECT_WATCHES SET PROJECT_NAME='commontorename.new' WHERE PROJECT_NAME='commontorename.old';
UPDATE CHANGES SET DEST_PROJECT_NAME='commontorename.new' WHERE DEST_PROJECT_NAME='commontorename.old';cd /path/to/repository/base
mv commontorename.old.git commontorename.new.git
11. Flush Gerrit cache
ssh -p 29418 adminusername@gerrit-hostname gerrit flush-caches --all12. Reindexing of Gerrit
Stop Gerrit.
java -jar /home/gerrit/review_site/bin/gerrit.war reindex -d /home/gerrit/review_siteStart Gerrit.
13. Testing of success of operation
Clone both commontorename.new and submoduletorename.new.