Package org.eclipse.jgit.api

Examples of org.eclipse.jgit.api.Git.push()


    w.write("// " + new Date().toString() + "\n");
    w.close();
    git.add().addFilepattern(file.getName()).call();
    git.commit().setMessage("test commit").call();

    Iterable<PushResult> results = git.push().setPushAll().setCredentialsProvider(new UsernamePasswordCredentialsProvider(account, password)).call();
    for (PushResult result : results) {
      for (RemoteRefUpdate update : result.getRemoteUpdates()) {
        assertEquals(Status.REJECTED_OTHER_REASON, update.getStatus());
      }
    }
View Full Code Here


    // unfreeze repo
    model.isFrozen = false;
    repositories().updateRepositoryModel(model.name, model, false);

    results = git.push().setPushAll().setCredentialsProvider(new UsernamePasswordCredentialsProvider(account, password)).call();
    GitBlitSuite.close(git);
    for (PushResult result : results) {
      for (RemoteRefUpdate update : result.getRemoteUpdates()) {
        assertEquals(Status.OK, update.getStatus());
      }
View Full Code Here

    BufferedWriter w = new BufferedWriter(os);
    w.write("// " + new Date().toString() + "\n");
    w.close();
    git.add().addFilepattern(file.getName()).call();
    git.commit().setMessage("test commit followed by push to non-bare repository").call();
    Iterable<PushResult> results = git.push().setPushAll().setCredentialsProvider(new UsernamePasswordCredentialsProvider(account, password)).call();
    GitBlitSuite.close(git);
    for (PushResult result : results) {
      for (RemoteRefUpdate update : result.getRemoteUpdates()) {
        assertEquals(Status.REJECTED_OTHER_REASON, update.getStatus());
      }
View Full Code Here

    BufferedWriter w = new BufferedWriter(os);
    w.write("// " + new Date().toString() + "\n");
    w.close();
    git.add().addFilepattern(file.getName()).call();
    git.commit().setMessage("push test").call();
    Iterable<PushResult> results = git.push().setCredentialsProvider(cp).setRemote("origin").call();

    for (PushResult result : results) {
      RemoteRefUpdate ref = result.getRemoteUpdate("refs/heads/master");
      Status status = ref.getStatus();
      if (expectedSuccess) {
View Full Code Here

    // merge the tip of the mergetest branch into master with --no-ff
    MergeResult mergeResult = git.merge().setFastForward(FastForwardMode.NO_FF).include(mergeTip.getId()).call();
    assertEquals(MergeResult.MergeStatus.MERGED, mergeResult.getMergeStatus());

    // push the merged master to the origin
    Iterable<PushResult> results = git.push().setCredentialsProvider(cp).setRemote("origin").call();

    for (PushResult result : results) {
      RemoteRefUpdate ref = result.getRemoteUpdate("refs/heads/master");
      Status status = ref.getStatus();
      if (expectedSuccess) {
View Full Code Here

    w.close();
    git.add().addFilepattern(file.getName()).call();
    git.commit().setMessage("push test").call();
    Iterable<PushResult> results = null;
    try {
      results = git.push().setCredentialsProvider(cp).setRemote("origin").call();
    } catch (GitAPIException e) {
      if (permission.atLeast(AccessPermission.PUSH)) {
        throw e;
      } else {
        // close serving repository
View Full Code Here

    }

    // create a local branch and push the new branch back to the origin
    git.branchCreate().setName("protectme").call();
    RefSpec refSpec = new RefSpec("refs/heads/protectme:refs/heads/protectme");
    results = git.push().setCredentialsProvider(cp).setRefSpecs(refSpec).setRemote("origin").call();
    for (PushResult result : results) {
      RemoteRefUpdate ref = result.getRemoteUpdate("refs/heads/protectme");
      Status status = ref.getStatus();
      if (Status.OK.equals(expectedCreate)) {
        assertTrue("User failed to push creation?! " + status.name(), status.equals(expectedCreate));
View Full Code Here

    // delete the branch locally
    git.branchDelete().setBranchNames("protectme").call();

    // push a delete ref command
    refSpec = new RefSpec(":refs/heads/protectme");
    results = git.push().setCredentialsProvider(cp).setRefSpecs(refSpec).setRemote("origin").call();
    for (PushResult result : results) {
      RemoteRefUpdate ref = result.getRemoteUpdate("refs/heads/protectme");
      Status status = ref.getStatus();
      if (Status.OK.equals(expectedDelete)) {
        assertTrue("User failed to push ref deletion?! " + status.name(), status.equals(Status.OK));
View Full Code Here

    // Try pushing our new tip to the origin.
    // This requires the server to "rewind" it's master branch and update it
    // to point to our alternate tip.  This leaves the original master tip
    // unreferenced.
    results = git.push().setCredentialsProvider(cp).setRemote("origin").setForce(true).call();
    for (PushResult result : results) {
      RemoteRefUpdate ref = result.getRemoteUpdate("refs/heads/master");
      Status status = ref.getStatus();
      if (Status.OK.equals(expectedRewind)) {
        assertTrue("User failed to rewind master?! " + status.name(), status.equals(expectedRewind));
View Full Code Here

    git.getRepository().getConfig().setString("remote", "project", "url", MessageFormat.format("{0}/project/ticgit.git", url));
    git.getRepository().getConfig().save();

    // push to non-existent user repository
    try {
      Iterable<PushResult> results = git.push().setRemote("user").setPushAll().setCredentialsProvider(cp).call();

      for (PushResult result : results) {
        RemoteRefUpdate ref = result.getRemoteUpdate("refs/heads/master");
        Status status = ref.getStatus();
        assertTrue("User failed to create repository?! " + status.name(), Status.OK.equals(status));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.