本文整理汇总了Java中org.eclipse.jgit.transport.RemoteRefUpdate.Status方法的典型用法代码示例。如果您正苦于以下问题:Java RemoteRefUpdate.Status方法的具体用法?Java RemoteRefUpdate.Status怎么用?Java RemoteRefUpdate.Status使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jgit.transport.RemoteRefUpdate
的用法示例。
在下文中一共展示了RemoteRefUpdate.Status方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deleteRemoteBranch
import org.eclipse.jgit.transport.RemoteRefUpdate; //导入方法依赖的package包/类
/**
* Deletes a remote branch. Essentially a 'git push <remote> :<remote branch name>'
*
* @param branchHelper the remote branch to delete
* @return the status of the push to remote to delete
* @throws GitAPIException
*/
public RemoteRefUpdate.Status deleteRemoteBranch(RemoteBranchHelper branchHelper) throws GitAPIException, IOException {
PushCommand pushCommand = new Git(this.repoHelper.repo).push();
// We're deleting the branch on a remote, so there it shows up as refs/heads/<branchname>
// instead of what it shows up on local: refs/<remote>/<branchname>, so we manually enter
// this thing in here
pushCommand.setRemote("origin").add(":refs/heads/"+branchHelper.parseBranchName());
this.repoHelper.myWrapAuthentication(pushCommand);
// Update the remote branches in case it worked
updateRemoteBranches();
boolean succeeded=false;
for (PushResult result : pushCommand.call()) {
for (RemoteRefUpdate refUpdate : result.getRemoteUpdates()) {
return refUpdate.getStatus();
}
}
return null;
}
示例2: postReplicationFailedEvent
import org.eclipse.jgit.transport.RemoteRefUpdate; //导入方法依赖的package包/类
private void postReplicationFailedEvent(PushOne pushOp, RemoteRefUpdate.Status status) {
Project.NameKey project = pushOp.getProjectNameKey();
String targetNode = resolveNodeName(pushOp.getURI());
for (String ref : pushOp.getRefs()) {
RefReplicatedEvent event =
new RefReplicatedEvent(project.get(), ref, targetNode, RefPushResult.FAILED, status);
try {
eventDispatcher.get().postEvent(new Branch.NameKey(project, ref), event);
} catch (PermissionBackendException e) {
repLog.error("error posting event", e);
}
}
}
示例3: onRefReplicatedToOneNode
import org.eclipse.jgit.transport.RemoteRefUpdate; //导入方法依赖的package包/类
@Override
void onRefReplicatedToOneNode(
String project,
String ref,
URIish uri,
RefPushResult status,
RemoteRefUpdate.Status refStatus) {
StringBuilder sb = new StringBuilder();
sb.append("Replicate ");
sb.append(project);
sb.append(" ref ");
sb.append(ref);
sb.append(" to ");
sb.append(resolveNodeName(uri));
sb.append(", ");
switch (status) {
case SUCCEEDED:
sb.append("Succeeded!");
break;
case FAILED:
sb.append("FAILED!");
hasError.compareAndSet(false, true);
break;
case NOT_ATTEMPTED:
sb.append("NOT ATTEMPTED!");
break;
default:
sb.append("UNKNOWN RESULT!");
break;
}
sb.append(" (");
sb.append(refStatus.toString());
sb.append(")");
writeStdOut(sb.toString());
}
示例4: notifyRefReplicated
import org.eclipse.jgit.transport.RemoteRefUpdate; //导入方法依赖的package包/类
public void notifyRefReplicated(
String project,
String ref,
URIish uri,
RefPushResult status,
RemoteRefUpdate.Status refUpdateStatus) {
pushResultProcessing.onRefReplicatedToOneNode(project, ref, uri, status, refUpdateStatus);
RefReplicationStatus completedRefStatus = null;
boolean allPushTaksCompleted = false;
countingLock.lock();
try {
RefReplicationStatus refStatus = getRefStatus(project, ref);
refStatus.replicatedNodesCount++;
finishedPushTasksCount++;
if (allScheduled) {
if (refStatus.allDone()) {
completedRefStatus = statusByProjectRef.remove(project, ref);
}
allPushTaksCompleted = finishedPushTasksCount == totalPushTasksCount;
}
} finally {
countingLock.unlock();
}
if (completedRefStatus != null) {
doRefPushTasksCompleted(completedRefStatus);
}
if (allPushTaksCompleted) {
doAllPushTasksCompleted();
}
}
示例5: RefReplicatedEvent
import org.eclipse.jgit.transport.RemoteRefUpdate; //导入方法依赖的package包/类
public RefReplicatedEvent(
String project,
String ref,
String targetNode,
RefPushResult status,
RemoteRefUpdate.Status refStatus) {
super(TYPE);
this.project = project;
this.ref = ref;
this.targetNode = targetNode;
this.status = status.toString();
this.refStatus = refStatus;
}
示例6: pushForReview
import org.eclipse.jgit.transport.RemoteRefUpdate; //导入方法依赖的package包/类
private static void pushForReview(
TestRepository<?> testRepo, RemoteRefUpdate.Status expectedStatus, String expectedMessage)
throws GitAPIException {
String ref = "refs/for/master";
PushResult r = pushHead(testRepo, ref);
RemoteRefUpdate refUpdate = r.getRemoteUpdate(ref);
assertThat(refUpdate.getStatus()).isEqualTo(expectedStatus);
if (expectedMessage != null) {
assertThat(refUpdate.getMessage()).contains(expectedMessage);
}
}
示例7: assertDeleteRef
import org.eclipse.jgit.transport.RemoteRefUpdate; //导入方法依赖的package包/类
private void assertDeleteRef(RemoteRefUpdate.Status expectedStatus) throws Exception {
BranchInput in = new BranchInput();
in.ref = "refs/heads/test";
gApi.projects().name(project.get()).branch(in.ref).create(in);
PushResult result = deleteRef(testRepo, in.ref);
RemoteRefUpdate refUpdate = result.getRemoteUpdate(in.ref);
assertThat(refUpdate.getStatus()).isEqualTo(expectedStatus);
}
示例8: validateRemoteRefUpdates
import org.eclipse.jgit.transport.RemoteRefUpdate; //导入方法依赖的package包/类
/**
* Check references updates for any errors
*
* @param errorPrefix The error prefix for any error message
* @param refUpdates A collection of remote references updates
*/
public static void validateRemoteRefUpdates(String errorPrefix, Collection<RemoteRefUpdate> refUpdates) {
for (RemoteRefUpdate refUpdate : refUpdates) {
RemoteRefUpdate.Status status = refUpdate.getStatus();
if (status == RemoteRefUpdate.Status.REJECTED_NODELETE ||
status == RemoteRefUpdate.Status.NON_EXISTING ||
status == RemoteRefUpdate.Status.NOT_ATTEMPTED ||
status == RemoteRefUpdate.Status.REJECTED_NONFASTFORWARD ||
status == RemoteRefUpdate.Status.REJECTED_OTHER_REASON ||
status == RemoteRefUpdate.Status.REJECTED_REMOTE_CHANGED) {
throw new BuildException(String.format("%s - Status '%s'", errorPrefix, status.name()));
}
}
}
示例9: testRemoteUpdateStatus
import org.eclipse.jgit.transport.RemoteRefUpdate; //导入方法依赖的package包/类
public void testRemoteUpdateStatus () {
for (RemoteRefUpdate.Status status : RemoteRefUpdate.Status.values()) {
assertNotNull(GitRefUpdateResult.valueOf(status.name()));
}
}