Actually delete repositories through the webapi when they're empty.

Review Request #3880 — Created Feb. 17, 2013 and submitted — Latest diff uploaded

Information

Review Board
release-1.6.x

Reviewers

Actually delete repositories through the webapi when they're empty.

If you delete a repository through the API, it doesn't actually delete it, it
just "archives" it (sets it to be invisible and changes the name). The reasoning
behind this is that we don't want to break any existing review requests.
Unfortunately, if you then try to create a new repository with the same path, it
will fail due to the unique_together constraints. This keeps hitting users of
RBCommons, where the API is the primary way that repositories are
managed--what's happening is that users create a repository and as they're
trying to get things working, they delete it. They then recreate it and hit a
constraint error.

Instead of blindly archiving, we now only archive if we actually have review
requests to preserve. This doesn't fix every possible case (maybe someone
created a test review request and then deleted the repository) but it should
handle most of the failures I've seen so far.

A better fix would be to do constraint checking by hand and only test for
uniqueness among visible repositories, but that involves schema changes.
Ran unit tests. Verified that a DELETE call did what I expected.