protected CheckoutResult checkout(Context context, String branchName) { return context.command(CheckoutOp.class).setSource(branchName).call(); }
protected void checkout(Repository repo, String branch) { repo.command(CheckoutOp.class).setSource(branch).call(); }
protected CheckoutResult checkout(String branchName) { return repo.command(CheckoutOp.class).setSource(branchName).call(); }
public TestData checkout(String branch) { getContext().command(CheckoutOp.class).setSource(branch).call(); Ref head = getContext().command(RefParse.class).setName(Ref.HEAD).call().get(); if (head instanceof SymRef) { String target = ((SymRef) head).getTarget(); head = getContext().command(RefParse.class).setName(target).call().get(); } String headBranch = head.localName(); checkState(branch.equals(headBranch), "expected %s, got %s", branch, headBranch); return this; }
@Test public void testCheckoutBranchDuringConflict() throws Exception { createConflictedState(); try { geogig.command(CheckoutOp.class).setSource("TestBranch").call(); } catch (CheckoutException e) { assertTrue(true); } }
public TestData checkout(String branch) { getContext().command(CheckoutOp.class).setSource(branch).call(); Ref head = getContext().command(RefParse.class).setName(Ref.HEAD).call().get(); if (head instanceof SymRef) { String target = ((SymRef) head).getTarget(); head = getContext().command(RefParse.class).setName(target).call().get(); } String headBranch = head.localName(); checkState(branch.equals(headBranch), "expected %s, got %s", branch, headBranch); return this; }
@Test public void testCheckoutBranchDuringConflict() throws Exception { createConflictedState(); try { geogig.command(CheckoutOp.class).setSource("TestBranch").call(); } catch (CheckoutException e) { assertTrue(true); } }
private void verifyPrune() throws Exception { // Make sure the local repository got all of the commits from master localGeogig.geogig.command(CheckoutOp.class).setForce(true) .setSource("refs/remotes/origin/master").call(); Iterator<RevCommit> logs = localGeogig.geogig.command(LogOp.class).call(); List<RevCommit> logged = Lists.newArrayList(logs); assertEquals(expectedMaster, logged); // Make sure the local repository no longer has Branch1 Optional<Ref> missing = localGeogig.geogig.command(RefParse.class) .setName("refs/remotes/origin/Branch1").call(); assertFalse(missing.isPresent()); }
private void verifyPrune() throws Exception { // Make sure the local repository got all of the commits from master localGeogig.geogig.command(CheckoutOp.class).setForce(true) .setSource("refs/remotes/origin/master").call(); Iterator<RevCommit> logs = localGeogig.geogig.command(LogOp.class).call(); List<RevCommit> logged = Lists.newArrayList(logs); assertEquals(expectedMaster, logged); // Make sure the local repository no longer has Branch1 Optional<Ref> missing = localGeogig.geogig.command(RefParse.class) .setName("refs/remotes/origin/Branch1").call(); assertFalse(missing.isPresent()); }
private void verifyPrune() throws Exception { // Make sure the local repository got all of the commits from master localGeogig.geogig.command(CheckoutOp.class).setForce(true) .setSource("refs/remotes/origin/master").call(); Iterator<RevCommit> logs = localGeogig.geogig.command(LogOp.class).call(); List<RevCommit> logged = Lists.newArrayList(logs); assertEquals(expectedMaster, logged); // Make sure the local repository no longer has Branch1 Optional<Ref> missing = localGeogig.geogig.command(RefParse.class) .setName("refs/remotes/origin/Branch1").call(); assertFalse(missing.isPresent()); }
private void verifyPrune() throws Exception { // Make sure the local repository got all of the commits from master localGeogig.geogig.command(CheckoutOp.class).setForce(true) .setSource("refs/remotes/origin/master").call(); Iterator<RevCommit> logs = localGeogig.geogig.command(LogOp.class).call(); List<RevCommit> logged = Lists.newArrayList(logs); assertEquals(expectedMaster, logged); // Make sure the local repository no longer has Branch1 Optional<Ref> missing = localGeogig.geogig.command(RefParse.class) .setName("refs/remotes/origin/Branch1").call(); assertFalse(missing.isPresent()); }
@Test public void testCheckoutOursAndBranchDuringConflict() throws Exception { createConflictedState(); try { geogig.command(CheckoutOp.class).setSource("TestBranch").setOurs(true).call(); } catch (IllegalArgumentException e) { assertTrue(true); } }
@Test public void testCheckoutOursAndBranchDuringConflict() throws Exception { createConflictedState(); try { geogig.command(CheckoutOp.class).setSource("TestBranch").setOurs(true).call(); } catch (IllegalArgumentException e) { assertTrue(true); } }
@Test public void testCheckoutBranchWithChangesInTheIndex() throws Exception { insertAndAdd(points1); geogig.command(CommitOp.class).setMessage("commit for " + idP1).call(); geogig.command(BranchCreateOp.class).setName("branch1").call(); insertAndAdd(points2); exception.expect(CheckoutException.class); geogig.command(CheckoutOp.class).setSource("branch1").call(); }
@Test public void testCheckoutBranchWithChangesInTheWorkTree() throws Exception { insertAndAdd(points1); geogig.command(CommitOp.class).setMessage("commit for " + idP1).call(); geogig.command(BranchCreateOp.class).setName("branch1").call(); insert(points2); exception.expect(CheckoutException.class); geogig.command(CheckoutOp.class).setSource("branch1").call(); }
@Test public void testCheckoutBranchWithChangesInTheIndex() throws Exception { insertAndAdd(points1); geogig.command(CommitOp.class).setMessage("commit for " + idP1).call(); geogig.command(BranchCreateOp.class).setName("branch1").call(); insertAndAdd(points2); exception.expect(CheckoutException.class); geogig.command(CheckoutOp.class).setSource("branch1").call(); }
@Test public void testCheckoutBranchWithChangesInTheWorkTree() throws Exception { insertAndAdd(points1); geogig.command(CommitOp.class).setMessage("commit for " + idP1).call(); geogig.command(BranchCreateOp.class).setName("branch1").call(); insert(points2); exception.expect(CheckoutException.class); geogig.command(CheckoutOp.class).setSource("branch1").call(); }
@Test public void testCheckoutBranchWithForceOptionAndChangesInTheIndex() throws Exception { insertAndAdd(points1); RevCommit c1 = geogig.command(CommitOp.class).setMessage("commit for " + idP1).call(); Ref branch1 = geogig.command(BranchCreateOp.class).setName("branch1").call(); insertAndAdd(points2); CheckoutResult result = geogig.command(CheckoutOp.class).setSource("branch1").setForce(true) .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()); }
@Test public void testCheckoutBranchWithForceOptionAndChangesInTheIndex() throws Exception { insertAndAdd(points1); RevCommit c1 = geogig.command(CommitOp.class).setMessage("commit for " + idP1).call(); Ref branch1 = geogig.command(BranchCreateOp.class).setName("branch1").call(); insertAndAdd(points2); CheckoutResult result = geogig.command(CheckoutOp.class).setSource("branch1").setForce(true) .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()); }
@Test public void BranchIsHeadTest() throws Exception { insertAndAdd(points1); geogig.command(AddOp.class).call(); geogig.command(CommitOp.class).call(); geogig.command(BranchCreateOp.class).setName("TestMasterBranch").call(); geogig.command(BranchCreateOp.class).setName("TestBranch").call(); geogig.command(CheckoutOp.class).setSource("TestBranch").call(); insertAndAdd(points2); geogig.command(AddOp.class).call(); geogig.command(CommitOp.class).call(); exception.expect(IllegalArgumentException.class); geogig.command(BranchDeleteOp.class).setName("TestBranch").call(); }