@Test public void testPullTooManyRefs() throws Exception { // Add a commit to the remote insertAndAdd(remoteGeogig.geogig, lines3); RevCommit commit = remoteGeogig.geogig.command(CommitOp.class).call(); expectedMaster.addFirst(commit); // Pull the commit PullOp pull = pullOp(); pull.addRefSpec("master:newbranch:newbranch2"); exception.expect(IllegalArgumentException.class); pull.setRebase(true).call(); }
private PullResult pull(final GeogigTransaction context, final Remote remote) throws MergeConflictsException { String fetchSpec = remote.getFetchSpec(); PullResult pullResult = context.command(PullOp.class)// .setAll(false)// .setIncludeIndexes(true)// .setRemote(remote)// .addRefSpec(fetchSpec)// .setNoFastForward(true)// .setMessage(message)// .setProgressListener(getProgressListener())// .call(); return pullResult; }
pull.setProgressListener(cli.getProgressListener()); pull.setAll(all).setRebase(rebase).setFullDepth(fulldepth); pull.setDepth(depth); pull.setIncludeIndexes(withIndexes); pull.setRemote(args.get(0)); pull.addRefSpec(args.get(i)); final PullResult result = pull.call();
.setAuthor(authorName.orNull(), authorEmail.orNull()).setRemote(remoteName) .setAll(fetchAll).addRefSpec(refSpec); try { final PullResult result = command.call(); context.setResponseContent(new CommandResponse() { @Override
@Test public void testPullMerge() throws Exception { // Add a commit to the remote insertAndAdd(remoteGeogig.geogig, lines3); RevCommit commit = commit(remoteGeogig.repo, "lines3"); expectedMaster.addFirst(commit); // Pull the commit PullOp pull = pullOp(); pull.setRemote("origin").call(); List<RevCommit> logged = log(localGeogig.repo); assertEquals(expectedMaster, logged); }
@Test public void testPullRebase() throws Exception { // Add a commit to the remote insertAndAdd(remoteGeogig.geogig, lines3); RevCommit commit = remoteGeogig.geogig.command(CommitOp.class).call(); expectedMaster.addFirst(commit); // Pull the commit PullOp pull = pullOp(); pull.setRebase(true).setAll(true).call(); List<RevCommit> logged = log(localGeogig.repo); assertEquals(expectedMaster, logged); }
@Test public void testPullMultipleRefspecsNonPersistedRemote() throws Exception { // Add a commit to the remote insertAndAdd(remoteGeogig.geogig, lines3); RevCommit commit = remoteGeogig.geogig.command(CommitOp.class).call(); expectedMaster.addFirst(commit); // remove the remote Remote removedOrigin = localGeogig.geogig.command(RemoteRemoveOp.class).setName("origin") .call(); assertFalse(localGeogig.geogig.command(RemoteResolve.class).setName("origin").call() .isPresent()); // Pull the commit PullOp pull = pullOp(); pull.setRemote(removedOrigin);// client supplied remote pull.addRefSpec("master:newbranch"); pull.addRefSpec("Branch1:newbranch2"); pull.call(); assertTrue(getRef(localGeogig.repo, "refs/remotes/origin/newbranch").isPresent()); assertTrue(getRef(localGeogig.repo, "refs/remotes/origin/newbranch2").isPresent()); assertEquals(7, log(localGeogig.repo).size()); }
public @Test void prepareAndManuallyResolveAllConflicts() { createConflicts(TestData.point1, TestData.line1, TestData.poly1); PRStatus result = prepare(); assertEquals(3, result.getNumConflicts()); final UUID transactionId = request.getTransactionId(); origin.resumeTransaction(transactionId); assertEquals(request.getTargetBranch(), origin.getRef("HEAD").peel().localName()); //@formatter:off SimpleFeature c1 = TestData.clone(TestData.point1); c1.setAttribute("sp", "manually set"); SimpleFeature c2 = TestData.clone(TestData.line1); c2.setAttribute("sp", "manually set"); SimpleFeature c3 = TestData.clone(TestData.poly1); c3.setAttribute("sp", "manually set"); //@formatter:on Context context = clone.checkout("issuerBranch").getContext(); try { PullResult pres = context.command(PullOp.class).addRefSpec("master").call(); fail("Expected MergeConflictsException , got " + pres); } catch (MergeConflictsException e) { assertEquals(3, e.getReport().getConflicts()); clone.insert(c1, c2, c3).add().commit("manual conflict fix"); } result = prepare(); assertTrue(result.getMergeCommit().isPresent()); assertTrue(result.getReport().isPresent()); GeogigTransaction prtx = getTransaction(); Optional<Ref> mergeRef = request.resolveMergeRef(prtx); assertTrue(mergeRef.isPresent()); assertEquals(result.getMergeCommit().get(), mergeRef.get().getObjectId()); }
PullResult pres = context.command(PullOp.class).setIncludeIndexes(true) .addRefSpec("master").call(); fail("Expected MergeConflictsException , got " + pres); } catch (MergeConflictsException e) {
@Test public void testPullCommitThatDoesNotPassFilter() throws Exception { setupSparseClone(); // Add a commit that passes our filter to the remote. ObjectId oId = insertAndAdd(remoteGeogig.geogig, city1); final RevCommit commit = remoteGeogig.geogig.command(CommitOp.class) .setMessage(city1.getIdentifier().toString()).call(); Optional<RevObject> childObject = remoteGeogig.geogig.command(RevObjectParse.class) .setObjectId(oId).call(); assertTrue(childObject.isPresent()); PullOp pull = pullOp(); pull.call(); List<RevCommit> logged = newArrayList(localGeogig.geogig.command(LogOp.class).call()); assertEquals(AbstractMappedRemoteRepo.PLACEHOLDER_COMMIT_MESSAGE, logged.get(0).getMessage()); assertFalse(commit.getId().equals(logged.get(0).getId())); assertNotExists(localGeogig, oId); }
@Test public void testPullNullCurrentBranch() throws Exception { // Add a commit to the remote insertAndAdd(remoteGeogig.geogig, lines3); RevCommit commit = remoteGeogig.geogig.command(CommitOp.class).call(); expectedMaster.addFirst(commit); localGeogig.geogig.command(UpdateRef.class).setName("master").setNewValue(ObjectId.NULL) .call(); localGeogig.geogig.command(UpdateSymRef.class).setName(Ref.HEAD).setNewValue("master") .call(); // Pull the commit PullOp pull = pullOp(); pull.setRebase(true).call(); Iterator<RevCommit> logs = localGeogig.geogig.command(LogOp.class).call(); List<RevCommit> logged = new ArrayList<RevCommit>(); for (; logs.hasNext();) { logged.add(logs.next()); } assertEquals(expectedMaster, logged); }
setRemote("origin"); getProgressListener().started(); TransferSummary fetchResult = command(FetchOp.class).addRemote(remote).setDepth(depth.or(0)) .setFullDepth(fullDepth).setAll(all).setProgressListener(subProgress(80.f)).call(); final Optional<Ref> currHead = command(RefParse.class).setName(Ref.HEAD).call(); Preconditions.checkState(currHead.isPresent(), "Repository has no HEAD, can't pull."); Preconditions.checkState(currHead.get() instanceof SymRef, final Optional<Ref> sourceRefOpt = findRemoteRef(remoteref); if (!sourceRefOpt.isPresent()) { continue; final Optional<Ref> currHead = command(RefParse.class).setName(Ref.HEAD).call(); Preconditions.checkState(currHead.isPresent(), "Repository has no HEAD, can't pull."); final Optional<Ref> destRefOpt = command(RefParse.class).setName(destinationref).call(); if (destRefOpt.isPresent()) { final Ref destRef = destRefOpt.get(); command(CheckoutOp.class).setSource(destinationref).setForce(forceCheckout).call(); if (rebase) { command(RebaseOp.class).setUpstream(Suppliers.ofInstance(sourceOid)).call(); } else { try { MergeReport report = command(MergeOp.class)
protected PullResult _call() { if (remote == null) { setRemote("origin"); final Ref currentBranch = resolveCurrentBranch(); getProgressListener().started(); getProgressListener().setDescription("Pull: pulling " + remote); TransferSummary fetchResult = command(FetchOp.class)// .setProgressListener(getProgressListener())// .call(); final Optional<Ref> localRemoteRefOpt = command(RefParse.class) .setName(localRemoteRefName).call(); if (!localRemoteRefOpt.isPresent()) { getProgressListener().setDescription("Pull: rebasing..."); command(RebaseOp.class).setUpstream(fn).call(); } else { getProgressListener().setDescription("Pull: merging..."); String message = this.message; if (noFastForward && Strings.isNullOrEmpty(message)) { MergeReport report = command(MergeOp.class) .setProgressListener(getProgressListener())//
public PullOp setRemote(final Remote remote) { checkNotNull(remote); return setRemote(Suppliers.ofInstance(Optional.of(remote))); }
pull.setProgressListener(cli.getProgressListener()); pull.setAll(all).setRebase(rebase).setFullDepth(fulldepth); pull.setDepth(depth); pull.setIncludeIndexes(withIndexes); pull.setRemote(args.get(0)); pull.addRefSpec(args.get(i)); final PullResult result = pull.call();
@Test public void testPullMerge() throws Exception { // Add a commit to the remote insertAndAdd(remoteGeogig.geogig, lines3); RevCommit commit = remoteGeogig.geogig.command(CommitOp.class).call(); expectedMaster.addFirst(commit); // Pull the commit PullOp pull = pullOp(); pull.setRemote("origin").call(); Iterator<RevCommit> logs = localGeogig.geogig.command(LogOp.class).call(); List<RevCommit> logged = new ArrayList<RevCommit>(); for (; logs.hasNext();) { logged.add(logs.next()); } assertEquals(expectedMaster, logged); }
@Test public void testPullRebase() throws Exception { // Add a commit to the remote insertAndAdd(remoteGeogig.geogig, lines3); RevCommit commit = remoteGeogig.geogig.command(CommitOp.class).call(); expectedMaster.addFirst(commit); // Pull the commit PullOp pull = pullOp(); pull.setRebase(true).setAll(true).call(); Iterator<RevCommit> logs = localGeogig.geogig.command(LogOp.class).call(); List<RevCommit> logged = new ArrayList<RevCommit>(); for (; logs.hasNext();) { logged.add(logs.next()); } assertEquals(expectedMaster, logged); }
PullResult pres = context.command(PullOp.class).addRefSpec("master").call(); fail("Expected MergeConflictsException , got " + pres); } catch (MergeConflictsException e) {
@Test public void testPullCommitThatDoesNotPassFilter() throws Exception { setupSparseClone(); // Add a commit that passes our filter to the remote. ObjectId oId = insertAndAdd(remoteGeogig.geogig, city1); final RevCommit commit = remoteGeogig.geogig.command(CommitOp.class) .setMessage(city1.getIdentifier().toString()).call(); Optional<RevObject> childObject = remoteGeogig.geogig.command(RevObjectParse.class) .setObjectId(oId).call(); assertTrue(childObject.isPresent()); PullOp pull = pullOp(); pull.call(); List<RevCommit> logged = newArrayList(localGeogig.geogig.command(LogOp.class).call()); assertEquals(AbstractMappedRemoteRepo.PLACEHOLDER_COMMIT_MESSAGE, logged.get(0).getMessage()); assertFalse(commit.getId().equals(logged.get(0).getId())); assertNotExists(localGeogig, oId); }