Add git rm command to acceptance test framework
Change-Id: I6b6c55a20d9c5f08b26547e5f2d0e8ee184e8b59
This commit is contained in:
@@ -135,6 +135,13 @@ public class GitUtil {
|
|||||||
addCmd.call();
|
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)
|
public static Commit createCommit(Git git, PersonIdent i, String msg)
|
||||||
throws GitAPIException, IOException {
|
throws GitAPIException, IOException {
|
||||||
return createCommit(git, i, msg, null);
|
return createCommit(git, i, msg, null);
|
||||||
|
|||||||
@@ -39,7 +39,10 @@ import com.google.inject.assistedinject.Assisted;
|
|||||||
import com.google.inject.assistedinject.AssistedInject;
|
import com.google.inject.assistedinject.AssistedInject;
|
||||||
|
|
||||||
import org.eclipse.jgit.api.Git;
|
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.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.ObjectId;
|
||||||
import org.eclipse.jgit.lib.PersonIdent;
|
import org.eclipse.jgit.lib.PersonIdent;
|
||||||
import org.eclipse.jgit.revwalk.RevCommit;
|
import org.eclipse.jgit.revwalk.RevCommit;
|
||||||
@@ -130,6 +133,18 @@ public class PushOneCommit {
|
|||||||
public Result to(Git git, String ref)
|
public Result to(Git git, String ref)
|
||||||
throws GitAPIException, IOException {
|
throws GitAPIException, IOException {
|
||||||
add(git, fileName, content);
|
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;
|
Commit c;
|
||||||
if (changeId != null) {
|
if (changeId != null) {
|
||||||
c = amendCommit(git, i, subject, changeId);
|
c = amendCommit(git, i, subject, changeId);
|
||||||
|
|||||||
Reference in New Issue
Block a user