try (IRemoteRepo remoteRepo = openRemote(remote)) { final Integer depth = this.depth.or(remoteRepo.getDepth()).or(0); setDepth(cloneRepo, depth); localRemoteRefs = fetchRemoteData(cloneRepo, remote, depth);
@Test public void testSparseShallowClone() throws Exception { Map<String, String> filter = new HashMap<String, String>(); filter.put("default", "BBOX(pp,9, -80, 15, -70,'EPSG:4326')"); createFilterFile(filter); CloneOp clone = cloneOp(); clone.setDepth(3).setBranch("master"); exception.expect(IllegalStateException.class); clone.setRemoteURI(remoteGeogig.envHome.toURI()).call(); }
@Test public void testSparseShallowClone() throws Exception { Map<String, String> filter = new HashMap<String, String>(); filter.put("default", "BBOX(pp,9, -80, 15, -70,'EPSG:4326')"); createFilterFile(filter); CloneOp clone = cloneOp(); clone.setDepth(3).setBranch("master"); exception.expect(IllegalStateException.class); clone.setRemoteURI(remoteGeogig.envHome.toURI()).call(); }
clone.setDepth(2); String repositoryURL = remoteGeogig.envHome.toURI().toString();
clone.setDepth(2);
clone.setDepth(2); String repositoryURL = remoteGeogig.envHome.toURI().toString();
clone.setDepth(0); clone.setRemoteURI(remoteGeogig.envHome.toURI()).setBranch("master").call();
@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 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(); }
clone.setDepth(0); clone.setRemoteURI(remoteGeogig.envHome.toURI()).setBranch("master").call();
clone.setDepth(0); clone.setRemoteURI(remoteGeogig.envHome.toURI()).setBranch("master").call();
@Test public void testFetchNewCommitsWithShallowClone() 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(); // Checkout master and commit some changes remoteGeogig.geogig.command(CheckoutOp.class).setSource("master").call(); insertAndAdd(remoteGeogig.geogig, points1_modified); RevCommit commit = remoteGeogig.geogig.command(CommitOp.class).call(); expectedMaster.addFirst(commit); FetchOp fetch = fetchOp(); fetch.call(); // Make sure the local repository got all of the commits from master localGeogig.geogig.command(CheckoutOp.class).setSource("refs/remotes/origin/master").call(); Iterator<RevCommit> logs = localGeogig.geogig.command(LogOp.class).call(); List<RevCommit> logged = Lists.newArrayList(logs); assertEquals(3, logged.size()); assertEquals(expectedMaster.get(0), logged.get(0)); assertEquals(expectedMaster.get(1), logged.get(1)); assertEquals(expectedMaster.get(2), logged.get(2)); }
@Test public void testFetchNewCommitsWithShallowClone() 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(); // Checkout master and commit some changes remoteGeogig.geogig.command(CheckoutOp.class).setSource("master").call(); insertAndAdd(remoteGeogig.geogig, points1_modified); RevCommit commit = remoteGeogig.geogig.command(CommitOp.class).call(); expectedMaster.addFirst(commit); FetchOp fetch = fetchOp(); fetch.call(); // Make sure the local repository got all of the commits from master localGeogig.geogig.command(CheckoutOp.class).setSource("refs/remotes/origin/master").call(); Iterator<RevCommit> logs = localGeogig.geogig.command(LogOp.class).call(); List<RevCommit> logged = Lists.newArrayList(logs); assertEquals(3, logged.size()); assertEquals(expectedMaster.get(0), logged.get(0)); assertEquals(expectedMaster.get(1), logged.get(1)); assertEquals(expectedMaster.get(2), logged.get(2)); }
clone.setDepth(0); clone.setRemoteURI(remoteGeogig.envHome.toURI()).setBranch("master").call();
clone.setDepth(0); clone.setRemoteURI(remoteGeogig.envHome.toURI()).setBranch("master").call();
clone.setDepth(0);
/** * Set up multiple repositories with a shallow clone for testing. * * @return Collection of repository names created. * * @throws Exception */ public Collection<String> setUpDefaultMultiRepoServerWithShallowClone() throws Exception { Repository repo1 = createRepo("full")// .init("geogigUser", "full_Owner@geogig.org")// .loadDefaultData()// .getRepo(); Repository repo2 = createRepo("shallow")// .init("geogigUser", "shallow_Owner@geogig.org").getRepo(); repo2.command(CloneOp.class).setRemoteURI(repo1.getLocation()).setDepth(1).call(); repo1.close(); repo2.close(); return Arrays.asList("full", "shallow"); }
clone.setDepth(2);