public Ref getRef(String refSpec) { Optional<Ref> ref = getContext().command(RefParse.class).setName(refSpec).call(); checkState(ref.isPresent(), "Ref %s not found", refSpec); return ref.get(); }
public TestData remove(String... featureIds) { WorkingTree workingTree = getContext().workingTree(); workingTree.delete(Arrays.asList(featureIds).iterator(), new DefaultProgressListener()); return this; }
public TestData branchDelete(String branch) { Optional<? extends Ref> ref = getContext().command(BranchDeleteOp.class).setName(branch) .call(); checkState(ref.isPresent()); return this; }
public TestData add() { getContext().command(AddOp.class).call(); return this; }
public TestData resumeTransaction(UUID transactionId) { checkState(transaction == null, "There's a transaction already running"); Optional<GeogigTransaction> tx = getContext().command(TransactionResolve.class) .setId(transactionId).call(); checkState(tx.isPresent(), "Transaction %s does not exist", transactionId); setTransaction(tx.get()); return this; }
private TestData commit(String commitMessage, boolean allowEmpty) { RevCommit commit = getContext().command(CommitOp.class).setAllowEmpty(allowEmpty) .setMessage(commitMessage).call(); LOG.debug(commit.toString()); return this; }
public TestData startTransaction() { checkState(transaction == null, "There's a transaction already running"); GeogigTransaction tx = getContext().command(TransactionBegin.class).call(); setTransaction(tx); return this; }
public TestData branch(String newBranch) { Ref ref = getContext().command(BranchCreateOp.class).setName(newBranch).call(); checkState(newBranch.equals(ref.localName())); return this; }
public Iterator<RevCommit> log(String refSpec) { ObjectId tip = getContext().command(RevParse.class).setRefSpec(refSpec).call().get(); Iterator<RevCommit> iterator = getContext().command(LogOp.class).setUntil(tip).call(); return iterator; }
public TestData checkout(String branch) { getContext().command(CheckoutOp.class).setSource(branch).call(); Ref head = getContext().command(RefParse.class).setName(Ref.HEAD).call().get(); if (head instanceof SymRef) { String target = ((SymRef) head).getTarget(); head = getContext().command(RefParse.class).setName(target).call().get(); } String headBranch = head.localName(); checkState(branch.equals(headBranch), "expected %s, got %s", branch, headBranch); return this; }
public TestData branch(String newBranch) { Ref ref = getContext().command(BranchCreateOp.class).setName(newBranch).call(); checkState(newBranch.equals(ref.localName())); return this; }
private TestData commit(String commitMessage, boolean allowEmpty) { RevCommit commit = getContext().command(CommitOp.class).setAllowEmpty(allowEmpty) .setMessage(commitMessage).call(); LOG.debug(commit.toString()); return this; }
public TestData checkout(String branch) { getContext().command(CheckoutOp.class).setSource(branch).call(); Ref head = getContext().command(RefParse.class).setName(Ref.HEAD).call().get(); if (head instanceof SymRef) { String target = ((SymRef) head).getTarget(); head = getContext().command(RefParse.class).setName(target).call().get(); } String headBranch = head.localName(); checkState(branch.equals(headBranch), "expected %s, got %s", branch, headBranch); return this; }
public Map<String, NodeRef> getFeatureNodes(@NonNull String treeIsh) { Iterator<NodeRef> refs = getContext().command(LsTreeOp.class).setReference(treeIsh) .setStrategy(Strategy.DEPTHFIRST_ONLY_FEATURES).call(); return Maps.uniqueIndex(refs, n -> n.path()); }
public TestData mergeNoFF(String branchToMerge, String mergeCommitMessage) { ObjectId branchHead = getContext().command(RefParse.class).setName(branchToMerge).call() .get().getObjectId(); MergeReport report = getContext().command(MergeOp.class).setNoFastForward(true) .setMessage(mergeCommitMessage).addCommit(branchHead).call(); RevCommit mergeCommit = report.getMergeCommit(); checkState(mergeCommit.getParentIds().size() == 2); LOG.debug(mergeCommit.toString()); return this; }
public TestData mergeNoFF(String branchToMerge, String mergeCommitMessage) { ObjectId branchHead = getContext().command(RefParse.class).setName(branchToMerge).call() .get().getObjectId(); MergeReport report = getContext().command(MergeOp.class).setNoFastForward(true) .setMessage(mergeCommitMessage).addCommit(branchHead).call(); RevCommit mergeCommit = report.getMergeCommit(); checkState(mergeCommit.getParentIds().size() == 2); LOG.debug(mergeCommit.toString()); return this; }
public Map<String, RevFeatureType> getFeatureTypes(@NonNull String rootTreeIsh) { Context context = getContext(); List<NodeRef> treeNodes = context.command(FindFeatureTypeTrees.class) .setRootTreeRef(rootTreeIsh).call(); Iterator<RevFeatureType> types = context.objectDatabase().getAll( Iterables.transform(treeNodes, n -> n.getMetadataId()), BulkOpListener.NOOP_LISTENER, RevFeatureType.class); return Maps.uniqueIndex(types, t -> t.getName().getLocalPart()); }
public TestData resetHard(ObjectId id) { getContext().command(ResetOp.class).setCommit(id).setMode(ResetMode.HARD).call(); return this; }
public TestData remove(SimpleFeature... features) { WorkingTree workingTree = getContext().workingTree(); for (SimpleFeature sf : features) { String parentTreePath = sf.getType().getName().getLocalPart(); workingTree.delete(parentTreePath, sf.getID()); } return this; }
public TestData remove(SimpleFeature... features) { WorkingTree workingTree = getContext().workingTree(); for (SimpleFeature sf : features) { String parentTreePath = sf.getType().getName().getLocalPart(); workingTree.delete(parentTreePath, sf.getID()); } return this; }