private Ref resolveCurrentBranch() { return command(BranchResolveOp.class).call().orElseThrow( () -> new IllegalStateException("Repository has no HEAD, can't pull.")); } }
/** * @param remoteName the name or URL of a remote repository to fetch from * @return {@code this} */ public PullOp setRemote(final String remoteName) { checkNotNull(remoteName); return setRemote(command(RemoteResolve.class).setName(remoteName)); }
/** * @param remoteName the name or URL of a remote repository to fetch from * @return {@code this} */ public PullOp setRemote(final String remoteName) { Preconditions.checkNotNull(remoteName); return setRemote(command(RemoteResolve.class).setName(remoteName)); }
/** * @param ref the ref to find * @return an {@link Optional} of the ref, or {@link Optional#absent()} if it wasn't found */ public Optional<Ref> findRemoteRef(String ref) { String remoteRef = Ref.REMOTES_PREFIX + remote.get().get().getName() + "/" + ref; return command(RefParse.class).setName(remoteRef).call(); } }
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> 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) .setAuthor(authorName.orNull(), authorEmail.orNull()) .addCommit(sourceOid).call(); result.setNewRef(command(RefParse.class).setName(destinationref).call().get()); } else { Ref newRef = command(BranchCreateOp.class).setAutoCheckout(true) .setName(destinationref).setSource(sourceOid.toString()).call();
TransferSummary fetchResult = command(FetchOp.class)// final Optional<Ref> localRemoteRefOpt = command(RefParse.class) .setName(localRemoteRefName).call(); if (!localRemoteRefOpt.isPresent()) { command(RebaseOp.class).setUpstream(fn).call(); } else { getProgressListener().setDescription("Pull: merging..."); MergeReport report = command(MergeOp.class)