Add batch mode to Abandon

When an extension wants to abandon more than one changes in the same
project, batch them together inside a BatchUpdate will be much better
than calling Abandon REST API multiple times, so this change provides
the batch mode.

Also changed AbandonUtil to group changes by project and use the new
batchAbandon code.

Change-Id: I9d89b58d4cfa469b666a234af1a564c1f5211b19
This commit is contained in:
Yuxuan 'fishy' Wang
2016-08-23 16:55:26 -07:00
parent fc090c8f36
commit 676a0155e0
4 changed files with 164 additions and 31 deletions

View File

@@ -64,6 +64,7 @@ import com.google.gerrit.server.OutputFormat;
import com.google.gerrit.server.PatchSetUtil;
import com.google.gerrit.server.account.AccountCache;
import com.google.gerrit.server.account.GroupCache;
import com.google.gerrit.server.change.Abandon;
import com.google.gerrit.server.change.ChangeResource;
import com.google.gerrit.server.change.RevisionResource;
import com.google.gerrit.server.change.Revisions;
@@ -238,6 +239,9 @@ public abstract class AbstractDaemonTest {
@Inject
protected ChangeNotes.Factory notesFactory;
@Inject
protected Abandon changeAbandoner;
@Rule
public ExpectedException exception = ExpectedException.none();