I believe this should still work for 2.1.7.2 (unverified):
1) In the gerrit UI, delete all the project's rights.
2) In the gerrit UI, set the project's description to 'DELETE ME'.
3) Via gsql:
select name from projects p where description='DELETE ME' and
not exists (select 1 from projects where p.parent_name = p.name) and
not exists (select 1 from ref_rights rr where rr.project_name = p.name) and
not exists (select 1 from changes c where c.dest_project_name = p.name);
delete from projects p where description='DELETE ME' and
not exists (select 1 from projects where p.parent_name = p.name) and
not exists (select 1 from ref_rights rr where rr.project_name = p.name) and
not exists (select 1 from changes c where c.dest_project_name = p.name);
select project_name from account_project_watches where project_name
not in (select name from projects);
delete from account_project_watches where project_name not in (select
name from projects);
(The selects are obviously there so you can see what you're about to delete.)
4) Remove the repo from on disk
Doh, sorry, that'll only work for deleting a project with no changes.
You're going to have to delete all the changes first from the changes
table and any related tables that reference the changes. :-(
Use '\d' in gsql to explore the schema. It's pretty straight-forward from there.
j.
On a Gerrit 2.1.8 instance I'm using the attached script to remove
repositories. They are offered under the Apache License 2.0.
WARNING: THE SCRIPT MAY REMOVE ALL YOUR DATA, KILL KITTENS, ETC. IT'S JUST A
HACK I HAVE DEVELOPED AND SUCCESSFULLY USED ON MY SERVER. THIS WAS NOT
BLESSED/REVIEWED BY ANY GERRIT DEVELOPERS. YOU'VE BEEN WARNED.
Instructions:
- install the "pgdb" Python module (on Ubuntu I had to "apt-get install
python-pygresql")
- run the script as the user that runs Gerrit (and on the machine running
Gerrit). It assumes certain paths, you may have to point it to your
gerrit_site directory
- do a db dump and save the to-be-removed repository files before running the
script, just to be sure
--
Mihai Rusu
[Swindells, Thomas] With H2 there is a special table used to keep track of the next change Id (and other unique autogenerated values). Even if you delete
the rows new changes will carry on from the same previous number.
Thanks! ~ Pat
--
To unsubscribe, email
repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en