Examples of CheckoutResult


Examples of org.eclipse.jgit.api.CheckoutResult

    CheckoutCommand checkout = git.checkout().setName("b1");
    try {
      checkout.call();
      fail("Checkout exception not thrown");
    } catch (org.eclipse.jgit.api.errors.CheckoutConflictException e) {
      CheckoutResult result = checkout.getResult();
      assertNotNull(result);
      assertNotNull(result.getConflictList());
      assertEquals(1, result.getConflictList().size());
      assertTrue(result.getConflictList().contains("file.txt"));
    }
  }
View Full Code Here

Examples of org.eclipse.jgit.api.CheckoutResult

    if (doCheckout) {
      CheckoutCommand co = new Git(repository).checkout();
      try {
        co.setName(textForBranch).call();
      } catch (CheckoutConflictException e) {
        final CheckoutResult result = co.getResult();

        if (result.getStatus() == Status.CONFLICTS) {
          final Shell shell = getWizard().getContainer().getShell();

          shell.getDisplay().asyncExec(new Runnable() {
            public void run() {
              new CheckoutConflictDialog(shell, repository,
                  result.getConflictList()).open();
            }
          });
        }
      }
    }
View Full Code Here

Examples of org.locationtech.geogig.api.porcelain.CheckoutResult

        Ref branch1 = geogig.command(RefParse.class).setName("branch1").call().get();
        geogig.command(RebaseOp.class).setUpstream(Suppliers.ofInstance(branch1.getObjectId()))
                .call();

        CheckoutResult result;
        result = geogig.command(CheckoutOp.class).setSource("branch1").call();
        assertEquals(c2.getTreeId(), result.getNewTree());
        assertTrue(geogig.command(RefParse.class).setName(Ref.HEAD).call().get() instanceof SymRef);
        assertEquals(branch1.getName(), ((SymRef) geogig.command(RefParse.class).setName(Ref.HEAD)
                .call().get()).getTarget());

        result = geogig.command(CheckoutOp.class).setSource("branch2").call();
        assertFalse(c4.getTreeId().equals(result.getNewTree()));
        assertTrue(geogig.command(RefParse.class).setName(Ref.HEAD).call().get() instanceof SymRef);
        assertEquals(branch2.getName(), ((SymRef) geogig.command(RefParse.class).setName(Ref.HEAD)
                .call().get()).getTarget());

        Iterator<RevCommit> log = geogig.command(LogOp.class).call();
View Full Code Here

Examples of org.locationtech.geogig.api.porcelain.CheckoutResult

        Ref branch1 = geogig.command(RefParse.class).setName("branch1").call().get();
        geogig.command(RebaseOp.class).setUpstream(Suppliers.ofInstance(branch1.getObjectId()))
                .setSquashMessage("squashed commit").call();

        CheckoutResult result;
        result = geogig.command(CheckoutOp.class).setSource("branch1").call();
        assertEquals(c2.getTreeId(), result.getNewTree());
        assertTrue(geogig.command(RefParse.class).setName(Ref.HEAD).call().get() instanceof SymRef);
        assertEquals(branch1.getName(), ((SymRef) geogig.command(RefParse.class).setName(Ref.HEAD)
                .call().get()).getTarget());

        result = geogig.command(CheckoutOp.class).setSource("branch2").call();
        assertFalse(c4.getTreeId().equals(result.getNewTree()));
        assertTrue(geogig.command(RefParse.class).setName(Ref.HEAD).call().get() instanceof SymRef);
        assertEquals(branch2.getName(), ((SymRef) geogig.command(RefParse.class).setName(Ref.HEAD)
                .call().get()).getTarget());

        Iterator<RevCommit> log = geogig.command(LogOp.class).call();
View Full Code Here

Examples of org.locationtech.geogig.api.porcelain.CheckoutResult

        Optional<Ref> master = geogig.command(RefParse.class).setName("master").call();

        geogig.command(RebaseOp.class).setUpstream(Suppliers.ofInstance(branch1.getObjectId()))
                .setOnto(Suppliers.ofInstance(master.get().getObjectId())).call();

        CheckoutResult result;
        result = geogig.command(CheckoutOp.class).setSource("branch1").call();
        assertEquals(c3.getTreeId(), result.getNewTree());
        assertTrue(geogig.command(RefParse.class).setName(Ref.HEAD).call().get() instanceof SymRef);
        assertEquals(branch1.getName(), ((SymRef) geogig.command(RefParse.class).setName(Ref.HEAD)
                .call().get()).getTarget());

        result = geogig.command(CheckoutOp.class).setSource("branch2").call();
        assertFalse(c4.getTreeId().equals(result.getNewTree()));
        assertTrue(geogig.command(RefParse.class).setName(Ref.HEAD).call().get() instanceof SymRef);
        assertEquals(branch2.getName(), ((SymRef) geogig.command(RefParse.class).setName(Ref.HEAD)
                .call().get()).getTarget());

        Iterator<RevCommit> log = geogig.command(LogOp.class).call();
View Full Code Here

Examples of org.locationtech.geogig.api.porcelain.CheckoutResult

        try {
            final ConsoleReader console = cli.getConsole();
            String branchOrCommit = (branchOrStartPoint.size() > 0 ? branchOrStartPoint.get(0)
                    : null);

            CheckoutResult result = geogig.command(CheckoutOp.class).setForce(force)
                    .setSource(branchOrCommit).addPaths(paths).setOurs(ours).setTheirs(theirs)
                    .call();

            switch (result.getResult()) {
            case CHECKOUT_LOCAL_BRANCH:
                console.println("Switched to branch '" + result.getNewRef().localName() + "'");
                break;
            case CHECKOUT_REMOTE_BRANCH:
                console.println("Branch '" + result.getNewRef().localName()
                        + "' was set up to track remote branch '" + result.getNewRef().localName()
                        + "' from " + result.getRemoteName() + ".");
                console.println("Switched to a new branch '" + result.getNewRef().localName() + "'");
                break;
            case UPDATE_OBJECTS:
                console.println("Objects in the working tree were updated to the specifed version.");
                break;
            case DETACHED_HEAD:
                console.println("You are in 'detached HEAD' state. HEAD is now at "
                        + result.getOid().toString().substring(0, 7) + "...");
                break;
            default:
                break;
            }
        } catch (CheckoutException e) {
View Full Code Here

Examples of org.locationtech.geogig.api.porcelain.CheckoutResult

        final RevCommit c2 = geogig.command(CommitOp.class).setMessage("commit for " + idP2).call();

        insertAndAdd(lines1);
        final RevCommit c3 = geogig.command(CommitOp.class).setMessage("commit for " + idL2).call();

        CheckoutResult result;
        result = geogig.command(CheckoutOp.class).setSource(c1.getId().toString()).call();
        assertEquals(c1.getTreeId(), result.getNewTree());

        assertFalse(geogig.command(RefParse.class).setName(Ref.HEAD).call().get() instanceof SymRef);
        assertTrue(geogig.command(RefParse.class).setName(Ref.HEAD).call().get() instanceof Ref);

        result = geogig.command(CheckoutOp.class).setSource(c2.getId().toString()).call();
        assertEquals(c2.getTreeId(), result.getNewTree());

        result = geogig.command(CheckoutOp.class).setSource(c3.getId().toString()).call();
        assertEquals(c3.getTreeId(), result.getNewTree());
    }
View Full Code Here

Examples of org.locationtech.geogig.api.porcelain.CheckoutResult

        insertAndAdd(lines1);
        final RevCommit c3 = geogig.command(CommitOp.class).setMessage("commit for " + idL2).call();
        final Ref branch3 = geogig.command(BranchCreateOp.class).setName("branch3").call();

        CheckoutResult result;
        result = geogig.command(CheckoutOp.class).setSource("branch1").call();
        assertEquals(c1.getTreeId(), result.getNewTree());
        assertTrue(geogig.command(RefParse.class).setName(Ref.HEAD).call().get() instanceof SymRef);
        assertEquals(branch1.getName(), ((SymRef) geogig.command(RefParse.class).setName(Ref.HEAD)
                .call().get()).getTarget());

        result = geogig.command(CheckoutOp.class).setSource("branch2").call();
        assertEquals(c2.getTreeId(), result.getNewTree());
        assertTrue(geogig.command(RefParse.class).setName(Ref.HEAD).call().get() instanceof SymRef);
        assertEquals(branch2.getName(), ((SymRef) geogig.command(RefParse.class).setName(Ref.HEAD)
                .call().get()).getTarget());

        result = geogig.command(CheckoutOp.class).setSource("branch3").call();
        assertEquals(c3.getTreeId(), result.getNewTree());
        assertTrue(geogig.command(RefParse.class).setName(Ref.HEAD).call().get() instanceof SymRef);
        assertEquals(branch3.getName(), ((SymRef) geogig.command(RefParse.class).setName(Ref.HEAD)
                .call().get()).getTarget());
    }
View Full Code Here

Examples of org.locationtech.geogig.api.porcelain.CheckoutResult

    public void testCheckoutPathFilter() throws Exception {
        ObjectId points1Id = insertAndAdd(points1);
        geogig.command(CommitOp.class).setMessage("commit for " + idP1).call();
        insert(points1_modified);

        CheckoutResult result = geogig.command(CheckoutOp.class).addPath("Points/Points.1").call();

        Optional<RevTree> workTree = geogig.command(RevObjectParse.class)
                .setObjectId(result.getNewTree()).call(RevTree.class);

        Optional<NodeRef> nodeRef = geogig.command(FindTreeChild.class).setParent(workTree.get())
                .setChildPath("Points/Points.1").call();

        assertEquals(points1Id, nodeRef.get().getNode().getObjectId());
View Full Code Here

Examples of org.locationtech.geogig.api.porcelain.CheckoutResult

        ObjectId lines1Id = insertAndAdd(lines1);
        geogig.command(CommitOp.class).setMessage("commit 1").call();
        insert(points1_modified);
        insert(lines2);
        Collection<String> paths = Arrays.asList("Points/Points.1", "Lines");
        CheckoutResult result = geogig.command(CheckoutOp.class).addPaths(paths).call();
        Optional<RevTree> workTree = geogig.command(RevObjectParse.class)
                .setObjectId(result.getNewTree()).call(RevTree.class);
        Optional<NodeRef> nodeRef = geogig.command(FindTreeChild.class).setParent(workTree.get())
                .setChildPath("Points/Points.1").call();

        assertEquals(points1Id, nodeRef.get().getNode().getObjectId());
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.