当前位置: 首页>>代码示例>>Java>>正文


Java RemoteRefUpdate类代码示例

本文整理汇总了Java中org.eclipse.jgit.transport.RemoteRefUpdate的典型用法代码示例。如果您正苦于以下问题:Java RemoteRefUpdate类的具体用法?Java RemoteRefUpdate怎么用?Java RemoteRefUpdate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RemoteRefUpdate类属于org.eclipse.jgit.transport包,在下文中一共展示了RemoteRefUpdate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shouldShowSuccessWhenPushSucceeds

import org.eclipse.jgit.transport.RemoteRefUpdate; //导入依赖的package包/类
@Test
public void shouldShowSuccessWhenPushSucceeds() throws Exception {
  XulMessageBox message = spy( new XulMessageBoxMock( XulDialogCallback.Status.ACCEPT ) );
  when( document.createElement( MESSAGEBOX ) ).thenReturn( message );
  doReturn( true ).when( uiGit ).hasRemote();
  PushResult result = mock( PushResult.class );
  doReturn( new URIish( "https://test.example.com" ) ).when( result ).getURI();
  RemoteRefUpdate update = mock( RemoteRefUpdate.class );
  when( update.getStatus() ).thenReturn( Status.OK );
  when( result.getRemoteUpdates() ).thenReturn( Arrays.asList( update ) );

  controller.push();
  controller.push( IVCS.TYPE_BRANCH );

  verify( uiGit ).push( "default" );
  verify( uiGit ).push( IVCS.TYPE_BRANCH );
}
 
开发者ID:HiromuHota,项目名称:pdi-git-plugin,代码行数:18,代码来源:GitControllerTest.java

示例2: processPushResult

import org.eclipse.jgit.transport.RemoteRefUpdate; //导入依赖的package包/类
private void processPushResult( Iterable<PushResult> resultIterable ) throws Exception {
  resultIterable.forEach( result -> { // for each (push)url
    StringBuilder sb = new StringBuilder();
    result.getRemoteUpdates().stream()
      .filter( update -> update.getStatus() != RemoteRefUpdate.Status.OK )
      .filter( update -> update.getStatus() != RemoteRefUpdate.Status.UP_TO_DATE )
      .forEach( update -> { // for each failed refspec
        sb.append(
          result.getURI().toString()
          + "\n" + update.getSrcRef().toString()
          + "\n" + update.getStatus().toString()
          + ( update.getMessage() == null ? "" : "\n" + update.getMessage() )
          + "\n\n"
        );
      } );
    if ( sb.length() == 0 ) {
      showMessageBox( BaseMessages.getString( PKG, "Dialog.Success" ), BaseMessages.getString( PKG, "Dialog.Success" ) );
    } else {
      showMessageBox( BaseMessages.getString( PKG, "Dialog.Error" ), sb.toString() );
    }
  } );
}
 
开发者ID:HiromuHota,项目名称:pdi-git-plugin,代码行数:23,代码来源:UIGit.java

示例3: pushVia

import org.eclipse.jgit.transport.RemoteRefUpdate; //导入依赖的package包/类
private PushResult pushVia(Transport tn)
    throws IOException, NotSupportedException, TransportException, PermissionBackendException {
  tn.applyConfig(config);
  tn.setCredentialsProvider(credentialsProvider);

  List<RemoteRefUpdate> todo = generateUpdates(tn);
  if (todo.isEmpty()) {
    // If we have no commands selected, we have nothing to do.
    // Calling JGit at this point would just redo the work we
    // already did, and come up with the same answer. Instead
    // send back an empty result.
    return new PushResult();
  }

  repLog.info("Push to " + uri + " references: " + todo);

  return tn.push(NullProgressMonitor.INSTANCE, todo);
}
 
开发者ID:GerritCodeReview,项目名称:plugins_replication,代码行数:19,代码来源:PushOne.java

示例4: doPushDelta

import org.eclipse.jgit.transport.RemoteRefUpdate; //导入依赖的package包/类
private List<RemoteRefUpdate> doPushDelta(Map<String, Ref> local) throws IOException {
  List<RemoteRefUpdate> cmds = new ArrayList<>();
  boolean noPerms = !pool.isReplicatePermissions();
  for (String src : delta) {
    RefSpec spec = matchSrc(src);
    if (spec != null) {
      // If the ref still exists locally, send it, otherwise delete it.
      Ref srcRef = local.get(src);

      // Second try to ensure that the ref is truly not found locally
      if (srcRef == null) {
        srcRef = git.exactRef(src);
      }

      if (srcRef != null && canPushRef(src, noPerms)) {
        push(cmds, spec, srcRef);
      } else if (config.isMirror()) {
        delete(cmds, spec);
      }
    }
  }
  return cmds;
}
 
开发者ID:GerritCodeReview,项目名称:plugins_replication,代码行数:24,代码来源:PushOne.java

示例5: shouldFireEventsForReplicationOfOneRefToOneNode

import org.eclipse.jgit.transport.RemoteRefUpdate; //导入依赖的package包/类
@Test
public void shouldFireEventsForReplicationOfOneRefToOneNode() throws URISyntaxException {
  resetToDefault(pushResultProcessingMock);
  URIish uri = new URIish("git://someHost/someRepo.git");

  //expected events
  pushResultProcessingMock.onRefReplicatedToOneNode(
      "someProject", "someRef", uri, RefPushResult.SUCCEEDED, RemoteRefUpdate.Status.OK);
  pushResultProcessingMock.onRefReplicatedToAllNodes("someProject", "someRef", 1);
  pushResultProcessingMock.onAllRefsReplicatedToAllNodes(1);
  replay(pushResultProcessingMock);

  //actual test
  replicationState.increasePushTaskCount("someProject", "someRef");
  replicationState.markAllPushTasksScheduled();
  replicationState.notifyRefReplicated(
      "someProject", "someRef", uri, RefPushResult.SUCCEEDED, RemoteRefUpdate.Status.OK);
  verify(pushResultProcessingMock);
}
 
开发者ID:GerritCodeReview,项目名称:plugins_replication,代码行数:20,代码来源:ReplicationStateTest.java

示例6: shouldFireEventsForReplicationOfOneRefToMultipleNodes

import org.eclipse.jgit.transport.RemoteRefUpdate; //导入依赖的package包/类
@Test
public void shouldFireEventsForReplicationOfOneRefToMultipleNodes() throws URISyntaxException {
  resetToDefault(pushResultProcessingMock);
  URIish uri1 = new URIish("git://someHost1/someRepo.git");
  URIish uri2 = new URIish("git://someHost2/someRepo.git");

  //expected events
  pushResultProcessingMock.onRefReplicatedToOneNode(
      "someProject", "someRef", uri1, RefPushResult.SUCCEEDED, RemoteRefUpdate.Status.OK);
  pushResultProcessingMock.onRefReplicatedToOneNode(
      "someProject", "someRef", uri2, RefPushResult.FAILED, RemoteRefUpdate.Status.NON_EXISTING);
  pushResultProcessingMock.onRefReplicatedToAllNodes("someProject", "someRef", 2);
  pushResultProcessingMock.onAllRefsReplicatedToAllNodes(2);
  replay(pushResultProcessingMock);

  //actual test
  replicationState.increasePushTaskCount("someProject", "someRef");
  replicationState.increasePushTaskCount("someProject", "someRef");
  replicationState.markAllPushTasksScheduled();
  replicationState.notifyRefReplicated(
      "someProject", "someRef", uri1, RefPushResult.SUCCEEDED, RemoteRefUpdate.Status.OK);
  replicationState.notifyRefReplicated(
      "someProject", "someRef", uri2, RefPushResult.FAILED, RemoteRefUpdate.Status.NON_EXISTING);
  verify(pushResultProcessingMock);
}
 
开发者ID:GerritCodeReview,项目名称:plugins_replication,代码行数:26,代码来源:ReplicationStateTest.java

示例7: shouldFireEventsForReplicationSameRefDifferentProjects

import org.eclipse.jgit.transport.RemoteRefUpdate; //导入依赖的package包/类
@Test
public void shouldFireEventsForReplicationSameRefDifferentProjects() throws URISyntaxException {
  resetToDefault(pushResultProcessingMock);
  URIish uri = new URIish("git://host1/someRepo.git");

  //expected events
  pushResultProcessingMock.onRefReplicatedToOneNode(
      "project1", "ref1", uri, RefPushResult.SUCCEEDED, RemoteRefUpdate.Status.OK);
  pushResultProcessingMock.onRefReplicatedToOneNode(
      "project2", "ref2", uri, RefPushResult.SUCCEEDED, RemoteRefUpdate.Status.OK);
  pushResultProcessingMock.onRefReplicatedToAllNodes("project1", "ref1", 1);
  pushResultProcessingMock.onRefReplicatedToAllNodes("project2", "ref2", 1);
  pushResultProcessingMock.onAllRefsReplicatedToAllNodes(2);
  replay(pushResultProcessingMock);

  //actual test
  replicationState.increasePushTaskCount("project1", "ref1");
  replicationState.increasePushTaskCount("project2", "ref2");
  replicationState.markAllPushTasksScheduled();
  replicationState.notifyRefReplicated(
      "project1", "ref1", uri, RefPushResult.SUCCEEDED, RemoteRefUpdate.Status.OK);
  replicationState.notifyRefReplicated(
      "project2", "ref2", uri, RefPushResult.SUCCEEDED, RemoteRefUpdate.Status.OK);
  verify(pushResultProcessingMock);
}
 
开发者ID:GerritCodeReview,项目名称:plugins_replication,代码行数:26,代码来源:ReplicationStateTest.java

示例8: shouldFireEventsWhenSomeReplicationCompleteBeforeAllTasksAreScheduled

import org.eclipse.jgit.transport.RemoteRefUpdate; //导入依赖的package包/类
@Test
public void shouldFireEventsWhenSomeReplicationCompleteBeforeAllTasksAreScheduled()
    throws URISyntaxException {
  resetToDefault(pushResultProcessingMock);
  URIish uri1 = new URIish("git://host1/someRepo.git");

  //expected events
  pushResultProcessingMock.onRefReplicatedToOneNode(
      "someProject", "ref1", uri1, RefPushResult.SUCCEEDED, RemoteRefUpdate.Status.OK);
  pushResultProcessingMock.onRefReplicatedToOneNode(
      "someProject", "ref2", uri1, RefPushResult.SUCCEEDED, RemoteRefUpdate.Status.OK);
  pushResultProcessingMock.onRefReplicatedToAllNodes("someProject", "ref1", 1);
  pushResultProcessingMock.onRefReplicatedToAllNodes("someProject", "ref2", 1);
  pushResultProcessingMock.onAllRefsReplicatedToAllNodes(2);
  replay(pushResultProcessingMock);

  //actual test
  replicationState.increasePushTaskCount("someProject", "ref1");
  replicationState.increasePushTaskCount("someProject", "ref2");
  replicationState.notifyRefReplicated(
      "someProject", "ref1", uri1, RefPushResult.SUCCEEDED, RemoteRefUpdate.Status.OK);
  replicationState.notifyRefReplicated(
      "someProject", "ref2", uri1, RefPushResult.SUCCEEDED, RemoteRefUpdate.Status.OK);
  replicationState.markAllPushTasksScheduled();
  verify(pushResultProcessingMock);
}
 
开发者ID:GerritCodeReview,项目名称:plugins_replication,代码行数:27,代码来源:ReplicationStateTest.java

示例9: headRefReplicated

import org.eclipse.jgit.transport.RemoteRefUpdate; //导入依赖的package包/类
@Test
public void headRefReplicated()
    throws URISyntaxException, OrmException, PermissionBackendException {
  reset(dispatcherMock);
  RefReplicatedEvent expectedEvent =
      new RefReplicatedEvent(
          "someProject",
          "refs/heads/master",
          "someHost",
          RefPushResult.SUCCEEDED,
          RemoteRefUpdate.Status.OK);
  dispatcherMock.postEvent(RefReplicatedEventEquals.eqEvent(expectedEvent));
  expectLastCall().once();
  replay(dispatcherMock);

  gitUpdateProcessing.onRefReplicatedToOneNode(
      "someProject",
      "refs/heads/master",
      new URIish("git://someHost/someProject.git"),
      RefPushResult.SUCCEEDED,
      RemoteRefUpdate.Status.OK);
  verify(dispatcherMock);
}
 
开发者ID:GerritCodeReview,项目名称:plugins_replication,代码行数:24,代码来源:GitUpdateProcessingTest.java

示例10: changeRefReplicated

import org.eclipse.jgit.transport.RemoteRefUpdate; //导入依赖的package包/类
@Test
public void changeRefReplicated()
    throws URISyntaxException, OrmException, PermissionBackendException {
  reset(dispatcherMock);
  RefReplicatedEvent expectedEvent =
      new RefReplicatedEvent(
          "someProject",
          "refs/changes/01/1/1",
          "someHost",
          RefPushResult.FAILED,
          RemoteRefUpdate.Status.REJECTED_NONFASTFORWARD);
  dispatcherMock.postEvent(RefReplicatedEventEquals.eqEvent(expectedEvent));
  expectLastCall().once();
  replay(dispatcherMock);

  gitUpdateProcessing.onRefReplicatedToOneNode(
      "someProject",
      "refs/changes/01/1/1",
      new URIish("git://someHost/someProject.git"),
      RefPushResult.FAILED,
      RemoteRefUpdate.Status.REJECTED_NONFASTFORWARD);
  verify(dispatcherMock);
}
 
开发者ID:GerritCodeReview,项目名称:plugins_replication,代码行数:24,代码来源:GitUpdateProcessingTest.java

示例11: mergedOptionWithNewCommitWithSameChangeIdFails

import org.eclipse.jgit.transport.RemoteRefUpdate; //导入依赖的package包/类
@Test
public void mergedOptionWithNewCommitWithSameChangeIdFails() throws Exception {
  PushOneCommit.Result r = pushTo("refs/for/master");
  r.assertOkStatus();
  gApi.changes().id(r.getChangeId()).current().review(ReviewInput.approve());
  gApi.changes().id(r.getChangeId()).current().submit();

  RevCommit c2 =
      testRepo
          .amend(r.getCommit())
          .message("New subject")
          .insertChangeId(r.getChangeId().substring(1))
          .create();
  testRepo.reset(c2);

  String ref = "refs/for/master%merged";
  PushResult pr = pushHead(testRepo, ref, false);
  RemoteRefUpdate rru = pr.getRemoteUpdate(ref);
  assertThat(rru.getStatus()).isEqualTo(RemoteRefUpdate.Status.REJECTED_OTHER_REASON);
  assertThat(rru.getMessage()).contains("not merged into branch");
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:22,代码来源:AbstractPushForReview.java

示例12: allowedButNotSubscribed

import org.eclipse.jgit.transport.RemoteRefUpdate; //导入依赖的package包/类
@Test
public void allowedButNotSubscribed() throws Exception {
  TestRepository<?> superRepo = createProjectWithPush("super-project");
  TestRepository<?> subRepo = createProjectWithPush("subscribed-to-project");
  allowMatchingSubmoduleSubscription(
      "subscribed-to-project", "refs/heads/master", "super-project", "refs/heads/master");

  pushChangeTo(subRepo, "master");
  subRepo
      .branch("HEAD")
      .commit()
      .insertChangeId()
      .message("some change")
      .add("b.txt", "b contents for testing")
      .create();
  String refspec = "HEAD:refs/heads/master";
  PushResult r =
      Iterables.getOnlyElement(
          subRepo.git().push().setRemote("origin").setRefSpecs(new RefSpec(refspec)).call());
  assertThat(r.getMessages()).doesNotContain("error");
  assertThat(r.getRemoteUpdate("refs/heads/master").getStatus())
      .isEqualTo(RemoteRefUpdate.Status.OK);

  assertThat(hasSubmodule(superRepo, "master", "subscribed-to-project")).isFalse();
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:26,代码来源:SubmoduleSubscriptionsIT.java

示例13: pushChangeTo

import org.eclipse.jgit.transport.RemoteRefUpdate; //导入依赖的package包/类
protected ObjectId pushChangeTo(
    TestRepository<?> repo, String ref, String file, String content, String message, String topic)
    throws Exception {
  ObjectId ret =
      repo.branch("HEAD").commit().insertChangeId().message(message).add(file, content).create();

  String pushedRef = ref;
  if (!topic.isEmpty()) {
    pushedRef += "/" + name(topic);
  }
  String refspec = "HEAD:" + pushedRef;

  Iterable<PushResult> res =
      repo.git().push().setRemote("origin").setRefSpecs(new RefSpec(refspec)).call();

  RemoteRefUpdate u = Iterables.getOnlyElement(res).getRemoteUpdate(pushedRef);
  assertThat(u).isNotNull();
  assertThat(u.getStatus()).isEqualTo(Status.OK);
  assertThat(u.getNewObjectId()).isEqualTo(ret);

  return ret;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:23,代码来源:AbstractSubmoduleSubscription.java

示例14: cannotDeleteUserBranch

import org.eclipse.jgit.transport.RemoteRefUpdate; //导入依赖的package包/类
@Test
@Sandboxed
public void cannotDeleteUserBranch() throws Exception {
  grant(
      allUsers,
      RefNames.REFS_USERS + "${" + RefPattern.USERID_SHARDED + "}",
      Permission.DELETE,
      true,
      REGISTERED_USERS);

  TestRepository<InMemoryRepository> allUsersRepo = cloneProject(allUsers);
  String userRef = RefNames.refsUsers(admin.id);
  PushResult r = deleteRef(allUsersRepo, userRef);
  RemoteRefUpdate refUpdate = r.getRemoteUpdate(userRef);
  assertThat(refUpdate.getStatus()).isEqualTo(RemoteRefUpdate.Status.REJECTED_OTHER_REASON);
  assertThat(refUpdate.getMessage()).contains("Not allowed to delete user branch.");

  try (Repository repo = repoManager.openRepository(allUsers)) {
    assertThat(repo.exactRef(userRef)).isNotNull();
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:22,代码来源:AccountIT.java

示例15: deleteUserBranchWithAccessDatabaseCapability

import org.eclipse.jgit.transport.RemoteRefUpdate; //导入依赖的package包/类
@Test
@Sandboxed
public void deleteUserBranchWithAccessDatabaseCapability() throws Exception {
  allowGlobalCapabilities(REGISTERED_USERS, GlobalCapability.ACCESS_DATABASE);
  grant(
      allUsers,
      RefNames.REFS_USERS + "${" + RefPattern.USERID_SHARDED + "}",
      Permission.DELETE,
      true,
      REGISTERED_USERS);

  TestRepository<InMemoryRepository> allUsersRepo = cloneProject(allUsers);
  String userRef = RefNames.refsUsers(admin.id);
  PushResult r = deleteRef(allUsersRepo, userRef);
  RemoteRefUpdate refUpdate = r.getRemoteUpdate(userRef);
  assertThat(refUpdate.getStatus()).isEqualTo(RemoteRefUpdate.Status.OK);

  try (Repository repo = repoManager.openRepository(allUsers)) {
    assertThat(repo.exactRef(userRef)).isNull();
  }

  assertThat(accountCache.getOrNull(admin.id)).isNull();
  assertThat(accountQueryProvider.get().byDefault(admin.id.toString())).isEmpty();
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:25,代码来源:AccountIT.java


注:本文中的org.eclipse.jgit.transport.RemoteRefUpdate类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。