private String resolveCommitter() { final String key = "user.name"; Optional<String> name = command(ConfigGet.class).setName(key).call(); checkState(name.isPresent(), "%s not found in config. Use geogig config [--global] %s <your name> to configure it.", key, key); return name.get(); }
private String resolveCommitterEmail() { final String key = "user.email"; Optional<String> email = command(ConfigGet.class).setName(key).call(); checkState(email.isPresent(), "%s not found in config. Use geogig config [--global] %s <your email> to configure it.", key, key); return email.get(); }
private String resolveCommitterEmail() { final String emailkey = "user.email"; String email = getClientData(emailkey, String.class) .or(command(ConfigGet.class).setName(emailkey).call()).orNull(); checkState(email != null, "%s not found in config. Use geogig config [--global] %s <your email> to configure it.", emailkey, emailkey); return email; }
private String resolveCommitter() { final String namekey = "user.name"; String name = getClientData(namekey, String.class) .or(command(ConfigGet.class).setName(namekey).call()).orNull(); checkState(name != null, "%s not found in config. Use geogig config [--global] %s <your name> to configure it.", namekey, namekey); return name; }
private List<RevCommit> getCommitsAfterUntil() { Iterator<RevCommit> commitIterator = command(LogOp.class).setSince(until.getId()).call(); List<RevCommit> commits = Lists.newArrayList(commitIterator); Collections.reverse(commits); return commits; }
private List<RevCommit> getCommitsAfterUntil() { Iterator<RevCommit> commitIterator = command(LogOp.class).setSince(until.getId()).call(); List<RevCommit> commits = Lists.newArrayList(commitIterator); Collections.reverse(commits); return commits; }
Platform platform = platform(); final Optional<Ref> currHead = command(RefParse.class).setName(Ref.HEAD).call(); Preconditions.checkState(currHead.isPresent(), "Repository has no HEAD, can't squash."); Preconditions.checkState(currHead.get() instanceof SymRef, "You must have a clean working tree and index to perform a squash."); Optional<ObjectId> ancestor = command(FindCommonAncestor.class).setLeft(since) .setRight(until).call(); Preconditions.checkArgument(ancestor.isPresent(), ImmutableSet<Ref> refs = command(ForEachRef.class).setPrefixFilter(Ref.HEADS_PREFIX).call(); Iterator<RevCommit> toSquash = command(LogOp.class).setSince(since.getParentIds().get(0)) .setUntil(until.getId()).setFirstParentOnly(true).call(); List<ObjectId> firstParents = Lists.newArrayList(); command(ResetOp.class).setCommit(Suppliers.ofInstance(newHead)).setMode(ResetMode.HARD) .call(); ObjectId newTreeId = newCommit.getTreeId(); command(UpdateRef.class).setName(currentBranch).setNewValue(newHead).call(); command(UpdateSymRef.class).setName(Ref.HEAD).setNewValue(currentBranch).call();
Platform platform = platform(); final Optional<Ref> currHead = command(RefParse.class).setName(Ref.HEAD).call(); Preconditions.checkState(currHead.isPresent(), "Repository has no HEAD, can't squash."); Preconditions.checkState(currHead.get() instanceof SymRef, "You must have a clean working tree and index to perform a squash."); Optional<ObjectId> ancestor = command(FindCommonAncestor.class).setLeft(since) .setRight(until).call(); Preconditions.checkArgument(ancestor.isPresent(), ImmutableSet<Ref> refs = command(ForEachRef.class).setPrefixFilter(Ref.HEADS_PREFIX).call(); Iterator<RevCommit> toSquash = command(LogOp.class).setSince(since.getParentIds().get(0)) .setUntil(until.getId()).setFirstParentOnly(true).call(); List<ObjectId> firstParents = Lists.newArrayList(); command(ResetOp.class).setCommit(Suppliers.ofInstance(newHead)).setMode(ResetMode.HARD) .call(); ObjectId newTreeId = newCommit.getTreeId(); command(UpdateRef.class).setName(currentBranch).setNewValue(newHead).call(); command(UpdateSymRef.class).setName(Ref.HEAD).setNewValue(currentBranch).call();