@Test public void testFetchDepthWithFullRepo() throws Exception { prepareForFetch(true); FetchOp fetch = fetchOp(); fetch.setDepth(2); fetch.call(); verifyFetch(); }
@Test public void testFetchSpecificRemote() throws Exception { // fetch from the remote FetchOp fetch = fetchOp(); TransferSummary summary = fetch.addRemote("upstream").call(); assertEquals(1, summary.getRefDiffs().size()); assertTrue(summary.getRefDiffs().containsKey(upstream.getFetchURL())); assertSummary(summary, upstream.getFetchURL(), absent(), upstreamMaster); assertSummary(summary, upstream.getFetchURL(), absent(), upstreamTag); assertSummary(summary, upstream.getFetchURL(), absent(), upstreamBranch1); TestSupport.verifySameContents(upstreamRepo, localRepo); }
@Test public void testFetchDepthWithFullRepo() throws Exception { prepareForFetch(true); FetchOp fetch = fetchOp(); fetch.setDepth(2); fetch.call(); verifyFetch(); }
@Test public void testFetchFullDepthWithFullRepo() throws Exception { prepareForFetch(true); FetchOp fetch = fetchOp(); fetch.setFullDepth(true); fetch.call(); verifyFetch(); }
@Test public void testFetchSpecificRemote() throws Exception { // fetch from the remote FetchOp fetch = fetchOp(); TransferSummary summary = fetch.addRemote("upstream").call(); assertEquals(1, summary.getRefDiffs().size()); assertTrue(summary.getRefDiffs().containsKey(upstream.getFetchURL())); assertSummary(summary, upstream.getFetchURL(), absent(), upstreamMaster); assertSummary(summary, upstream.getFetchURL(), absent(), upstreamTag); assertSummary(summary, upstream.getFetchURL(), absent(), upstreamBranch1); TestSupport.verifySameContents(upstreamRepo, localRepo); }
@Test public void testFetchFullDepthWithFullRepo() throws Exception { prepareForFetch(true); FetchOp fetch = fetchOp(); fetch.setFullDepth(true); fetch.call(); verifyFetch(); }
@Test public void testFetchNoChanges() throws Exception { // fetch from the remote FetchOp fetch = fetchOp(); TransferSummary summary = fetch.addRemote("origin").call(); assertEquals(1, summary.getRefDiffs().size()); assertTrue(summary.getRefDiffs().containsKey(origin.getFetchURL())); assertSummary(summary, origin.getFetchURL(), localOriginMaster, originMaster); assertSummary(summary, origin.getFetchURL(), absent(), originBranch1); assertSummary(summary, origin.getFetchURL(), absent(), originTag); verifyFetch(); // fetch again summary = fetch.call(); assertTrue(summary.toString(), summary.isEmpty()); }
@Test public void testFetchNoChanges() throws Exception { // fetch from the remote FetchOp fetch = fetchOp(); TransferSummary summary = fetch.addRemote("origin").call(); assertEquals(1, summary.getRefDiffs().size()); assertTrue(summary.getRefDiffs().containsKey(origin.getFetchURL())); assertSummary(summary, origin.getFetchURL(), localOriginMaster, originMaster); assertSummary(summary, origin.getFetchURL(), absent(), originBranch1); assertSummary(summary, origin.getFetchURL(), absent(), originTag); verifyFetch(); // fetch again summary = fetch.call(); assertTrue(summary.toString(), summary.isEmpty()); }
@Test public void testFetchFullDepth() throws Exception { prepareForFetch(false); // clone the repository CloneOp clone = cloneOp(); clone.setDepth(2); // clone.setRepositoryURL(remoteGeogig.envHome.toURI().toString()).call(); clone.setRemoteURI(remoteGeogig.envHome.toURI()).setCloneURI(localGeogig.envHome.toURI()) .call(); FetchOp fetch = fetchOp(); fetch.setFullDepth(true); fetch.call(); verifyFetch(); }
@Test public void testFetchNoArgsDefaultsToOrigin() throws Exception { // fetch from the remote FetchOp fetch = fetchOp(); TransferSummary summary = fetch.call(); assertNotNull(summary); assertEquals(1, summary.getRefDiffs().size()); assertTrue(summary.getRefDiffs().containsKey(origin.getFetchURL())); assertSummary(summary, origin.getFetchURL(), localOriginMaster, originMaster); assertSummary(summary, origin.getFetchURL(), absent(), originBranch1); assertSummary(summary, origin.getFetchURL(), absent(), originTag); verifyFetch(); }
@Test public void testFetchFullDepth() throws Exception { prepareForFetch(false); // clone the repository CloneOp clone = cloneOp(); clone.setDepth(2); // clone.setRepositoryURL(remoteGeogig.envHome.toURI().toString()).call(); clone.setRemoteURI(remoteGeogig.envHome.toURI()).setCloneURI(localGeogig.envHome.toURI()) .call(); FetchOp fetch = fetchOp(); fetch.setFullDepth(true); fetch.call(); verifyFetch(); }
@Test public void testFetchNoArgsDefaultsToOrigin() throws Exception { // fetch from the remote FetchOp fetch = fetchOp(); TransferSummary summary = fetch.call(); assertNotNull(summary); assertEquals(1, summary.getRefDiffs().size()); assertTrue(summary.getRefDiffs().containsKey(origin.getFetchURL())); assertSummary(summary, origin.getFetchURL(), localOriginMaster, originMaster); assertSummary(summary, origin.getFetchURL(), absent(), originBranch1); assertSummary(summary, origin.getFetchURL(), absent(), originTag); verifyFetch(); }
@Test public void testFetchAll() throws Exception { // fetch from the remote FetchOp fetch = fetchOp(); TransferSummary summary = fetch.setAll(true).call(); assertEquals(2, summary.getRefDiffs().size()); assertTrue(summary.getRefDiffs().containsKey(origin.getFetchURL())); assertTrue(summary.getRefDiffs().containsKey(upstream.getFetchURL())); assertSummary(summary, origin.getFetchURL(), localOriginMaster, originMaster); assertSummary(summary, origin.getFetchURL(), absent(), originBranch1); assertSummary(summary, origin.getFetchURL(), absent(), originTag); assertSummary(summary, upstream.getFetchURL(), absent(), upstreamMaster); assertSummary(summary, upstream.getFetchURL(), absent(), upstreamBranch1); verifyFetch(); }
@Test public void testFetchWithPrune() throws Exception { // fetch from the remote FetchOp fetch = fetchOp(); fetch.addRemote("origin").setAll(true).call(); verifyFetch(); Optional<Ref> localOriginBranch1 = getRef(localRepo, "refs/remotes/origin/Branch1"); assertTrue(localOriginBranch1.isPresent()); // Remove a branch from the remote remoteGeogig.geogig.command(BranchDeleteOp.class).setName("Branch1").call(); // fetch again fetch = fetchOp(); TransferSummary summary = fetch.setPrune(true).call(); assertSummary(summary, origin.getFetchURL(), localOriginBranch1, absent()); verifyPrune(); }
@Test public void testFetchAll() throws Exception { // fetch from the remote FetchOp fetch = fetchOp(); TransferSummary summary = fetch.setAll(true).call(); assertEquals(2, summary.getRefDiffs().size()); assertTrue(summary.getRefDiffs().containsKey(origin.getFetchURL())); assertTrue(summary.getRefDiffs().containsKey(upstream.getFetchURL())); assertSummary(summary, origin.getFetchURL(), localOriginMaster, originMaster); assertSummary(summary, origin.getFetchURL(), absent(), originBranch1); assertSummary(summary, origin.getFetchURL(), absent(), originTag); assertSummary(summary, upstream.getFetchURL(), absent(), upstreamMaster); assertSummary(summary, upstream.getFetchURL(), absent(), upstreamBranch1); verifyFetch(); }
@Test public void testFetchSpecificRemoteAndAll() throws Exception { // fetch from the remote FetchOp fetch = fetchOp(); TransferSummary summary = fetch.addRemote("upstream").setAllRemotes(true).call(); assertEquals(2, summary.getRefDiffs().size()); assertTrue(summary.getRefDiffs().containsKey(origin.getFetchURL())); assertTrue(summary.getRefDiffs().containsKey(upstream.getFetchURL())); assertSummary(summary, origin.getFetchURL(), localOriginMaster, originMaster); assertSummary(summary, origin.getFetchURL(), absent(), originBranch1); assertSummary(summary, origin.getFetchURL(), absent(), originTag); assertSummary(summary, upstream.getFetchURL(), absent(), upstreamMaster); assertSummary(summary, upstream.getFetchURL(), absent(), upstreamBranch1); verifyFetch(); }
@Test public void testPullMergeNothingToFetch() throws Exception { // Add a commit to the remote insertAndAdd(remoteGeogig.geogig, lines3); RevCommit commit = commit(remoteGeogig.repo, "lines3"); expectedMaster.addFirst(commit); // call fetch first so the missing objects are already in the local repo fetchOp().call(); // Then Pull should update the target ref even if there's nothing to fetch PullOp pull = pullOp(); pull.setRemote("origin").call(); List<RevCommit> logged = log(localGeogig.repo); assertEquals(expectedMaster, logged); }
@Test public void testFetchNoRemotes() throws Exception { localGeogig.geogig.command(RemoteRemoveOp.class).setName(REMOTE_NAME).call(); FetchOp fetch = fetchOp(); exception.expect(IllegalArgumentException.class); exception.expectMessage("Remote could not be resolved"); fetch.call(); }
@Test public void testFetchNoRemotes() throws Exception { localGeogig.geogig.command(RemoteRemoveOp.class).setName(REMOTE_NAME).call(); FetchOp fetch = fetchOp(); exception.expect(IllegalArgumentException.class); exception.expectMessage("Remote could not be resolved"); fetch.call(); }
private void fakeUpToDate() { Remote remote = request.buildRemote(); GeogigTransaction tx = request.getTransaction(origin.getRepo().context()); tx.command(FetchOp.class).setFetchIndexes(true).addRemote(remote).call(); Ref remoteBranchState = clone.getRef(request.getRemoteBranch()); Ref localRemoteBranchState = tx.command(RefParse.class).setName(request.getOriginRef()) .call().get(); assertEquals(remoteBranchState.getObjectId(), localRemoteBranchState.getObjectId()); } }