/** * Executes the commit command using the provided options. */ @Override public void runInternal(GeogigCLI cli) throws IOException { checkParameter((message != null && !message.trim().isEmpty()) || nameAndCommit.isEmpty() || delete, "No tag message provided"); checkParameter(nameAndCommit.size() < 2 || (nameAndCommit.size() == 2 && !delete), "Too many parameters provided"); if (nameAndCommit.isEmpty()) { // looks like an attempt to create a tag with a message but forgot the tag name checkParameter(message == null, "A tag name must be provided"); listTags(cli); return; } String name = nameAndCommit.get(0); String commit = nameAndCommit.size() > 1 ? nameAndCommit.get(1) : Ref.HEAD; Console console = cli.getConsole(); final GeoGIG geogig = cli.getGeogig(); if (delete) { geogig.command(TagRemoveOp.class).setName(name).call(); console.println("Deleted tag " + name); } else { Optional<ObjectId> commitId = geogig.command(RevParse.class).setRefSpec(commit).call(); checkParameter(commitId.isPresent(), "Wrong reference: " + commit); RevTag tag = geogig.command(TagCreateOp.class).setName(name).setMessage(message) .setCommitId(commitId.get()).call(); console.println("Created tag " + name + " -> " + tag.getCommitId()); } }
/** * Executes the commit command using the provided options. */ @Override public void runInternal(GeogigCLI cli) throws IOException { checkParameter((message != null && !message.trim().isEmpty()) || nameAndCommit.isEmpty() || delete, "No tag message provided"); checkParameter(nameAndCommit.size() < 2 || (nameAndCommit.size() == 2 && !delete), "Too many parameters provided"); if (nameAndCommit.isEmpty()) { // looks like an attempt to create a tag with a message but forgot the tag name checkParameter(message == null, "A tag name must be provided"); listTags(cli); return; } String name = nameAndCommit.get(0); String commit = nameAndCommit.size() > 1 ? nameAndCommit.get(1) : Ref.HEAD; Console console = cli.getConsole(); final GeoGIG geogig = cli.getGeogig(); if (delete) { geogig.command(TagRemoveOp.class).setName(name).call(); console.println("Deleted tag " + name); } else { Optional<ObjectId> commitId = geogig.command(RevParse.class).setRefSpec(commit).call(); checkParameter(commitId.isPresent(), "Wrong reference: " + commit); RevTag tag = geogig.command(TagCreateOp.class).setName(name).setMessage(message) .setCommitId(commitId.get()).call(); console.println("Created tag " + name + " -> " + tag.getCommitId()); } }
/** * Executes the commit command using the provided options. */ @Override public void runInternal(GeogigCLI cli) throws IOException { checkParameter((message != null && !message.trim().isEmpty()) || nameAndCommit.isEmpty() || delete, "No tag message provided"); checkParameter(nameAndCommit.size() < 2 || (nameAndCommit.size() == 2 && !delete), "Too many parameters provided"); if (nameAndCommit.isEmpty()) { // looks like an attempt to create a tag with a message but forgot the tag name checkParameter(message == null, "A tag name must be provided"); listTags(cli); return; } String name = nameAndCommit.get(0); String commit = nameAndCommit.size() > 1 ? nameAndCommit.get(1) : Ref.HEAD; Console console = cli.getConsole(); final GeoGIG geogig = cli.getGeogig(); if (delete) { geogig.command(TagRemoveOp.class).setName(name).call(); console.println("Deleted tag " + name); } else { Optional<ObjectId> commitId = geogig.command(RevParse.class).setRefSpec(commit).call(); checkParameter(commitId.isPresent(), "Wrong reference: " + commit); RevTag tag = geogig.command(TagCreateOp.class).setName(name).setMessage(message) .setCommitId(commitId.get()).call(); console.println("Created tag " + name + " -> " + tag.getCommitId()); } }
@Given("^There is a tag called \"([^\"]*)\" on the \"([^\"]*)\" repo pointing to \"([^\"]*)\" with the \"([^\"]*)\" message$") public void There_is_a_tag(String tagName, String repoName, String target, String message) { Repository repo = context.getRepo(repoName); target = context.replaceVariables(target); repo.command(TagCreateOp.class).setName(tagName).setCommitId(ObjectId.valueOf(target)) .setMessage(message).call(); // add the repo to the set so it can be closed openedRepos.add(repoName); }
@Given("^I have a remote tag called \"([^\"]*)\"$") public void i_have_a_remote_tag_called(String expected) throws Throwable { localRepo.geogigCLI.getGeogig(Hints.readWrite()) // .command(TagCreateOp.class) // .setName(expected) // .setMessage("Tagged " + expected) // .setCommitId(ObjectId.NULL) // .call(); }
@Given("^I have a remote tag called \"([^\"]*)\"$") public void i_have_a_remote_tag_called(String expected) throws Throwable { localRepo.geogigCLI.getGeogig(Hints.readWrite()) // .command(TagCreateOp.class) // .setName(expected) // .setMessage("Tagged " + expected) // .setCommitId(ObjectId.NULL) // .call(); }
@Given("^I have a remote tag called \"([^\"]*)\"$") public void i_have_a_remote_tag_called(String expected) throws Throwable { localRepo.geogigCLI.getGeogig(Hints.readWrite()) // .command(TagCreateOp.class) // .setName(expected) // .setMessage("Tagged " + expected) // .setCommitId(ObjectId.NULL) // .call(); }
throw new CommandSpecException("'" + commit + "' could not be resolved."); final RevTag tag = geogig.command(TagCreateOp.class).setName(name).setMessage(message) .setCommitId(commitId.get()).call(); context.setResponseContent(new CommandResponse() {
.setMessage("TestTag") //
.setMessage("TestTag") //
.setMessage("TestTag") //
.setMessage("TestTag") //