Add git rm command to acceptance test framework

Change-Id: I6b6c55a20d9c5f08b26547e5f2d0e8ee184e8b59
This commit is contained in:
David Ostrovsky 2013-12-23 18:36:50 +01:00
parent 47f359d29b
commit ca8ae281d1
2 changed files with 22 additions and 0 deletions
gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance

@ -135,6 +135,13 @@ public class GitUtil {
addCmd.call();
}
public static void rm(Git gApi, String path)
throws GitAPIException, IOException {
gApi.rm()
.addFilepattern(path)
.call();
}
public static Commit createCommit(Git git, PersonIdent i, String msg)
throws GitAPIException, IOException {
return createCommit(git, i, msg, null);

@ -39,7 +39,10 @@ import com.google.inject.assistedinject.Assisted;
import com.google.inject.assistedinject.AssistedInject;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.api.errors.InvalidTagNameException;
import org.eclipse.jgit.api.errors.NoHeadException;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.PersonIdent;
import org.eclipse.jgit.revwalk.RevCommit;
@ -130,6 +133,18 @@ public class PushOneCommit {
public Result to(Git git, String ref)
throws GitAPIException, IOException {
add(git, fileName, content);
return execute(git, ref);
}
public Result rm(Git git, String ref)
throws GitAPIException, IOException {
GitUtil.rm(git, fileName);
return execute(git, ref);
}
private Result execute(Git git, String ref) throws GitAPIException,
IOException, ConcurrentRefUpdateException, InvalidTagNameException,
NoHeadException {
Commit c;
if (changeId != null) {
c = amendCommit(git, i, subject, changeId);