.setMessage("add " + plugin.getTag()) .call();
public Ref saveAtHEAD(Git git) throws GitAPIException { String json = message.toJSONString(); ref = git.tag().setName(name()).setAnnotated(true).setMessage(json).call(); return ref; }
public boolean tag(String tagname, String comment) throws Exception { try{ git.fetch().setTagOpt(TagOpt.FETCH_TAGS).call(); } catch(Exception e) { log.debug("Fetch from origin failed.", e); } List<RevTag> tags = git.tagList().call(); if(tags != null && tags.size() > 0) { for(RevTag tag : tags) { if(tag.getTagName().equals(tagname)) { throw new Exception("Tag already exists."); } } } boolean success = git.tag().setMessage(comment).setName(tagname).call() != null; try{ git.push().setPushTags().call(); } catch(Exception e){ log.debug("Failed to push changes.", e); } return success; }
public void tag(String tagName, String tagRevision, PersonIdent taggerIdent, @Nullable String tagMessage) { try { TagCommand tag = git().tag(); tag.setName(tagName); if (tagMessage != null) tag.setMessage(tagMessage); tag.setTagger(taggerIdent); tag.setObjectId(getRevCommit(tagRevision)); tag.call(); cacheObjectId(GitUtils.tag2ref(tagName), tag.getObjectId()); } catch (GitAPIException e) { throw new RuntimeException(e); } }
@Override public String snapshot(String name, String comment) throws ConfigurationPersistenceException { boolean noComment = (comment ==null || comment.isEmpty()); String message = noComment ? SNAPSHOT_PREFIX + FORMATTER.format(LocalDateTime.now()) : comment; String tagName = (name ==null || name.isEmpty()) ? SNAPSHOT_PREFIX + FORMATTER.format(LocalDateTime.now()) : name; try (Git git = gitRepository.getGit()) { Status status = git.status().call(); List<Ref> tags = git.tagList().call(); String refTagName = R_TAGS + tagName; for(Ref tag : tags) { if(refTagName.equals(tag.getName())) { throw MGMT_OP_LOGGER.snapshotAlreadyExistError(tagName); } } //if comment is not null if(status.hasUncommittedChanges() || !noComment) { git.commit().setMessage(message).setAll(true).setNoVerify(true).call(); } git.tag().setName(tagName).setMessage(message).call(); } catch (GitAPIException ex) { throw MGMT_OP_LOGGER.failedToPersistConfiguration(ex, message, ex.getMessage()); } return message; }
@Override public String snapshot(String name, String comment) throws ConfigurationPersistenceException { boolean noComment = (comment ==null || comment.isEmpty()); String message = noComment ? SNAPSHOT_PREFIX + FORMATTER.format(LocalDateTime.now()) : comment; String tagName = (name ==null || name.isEmpty()) ? SNAPSHOT_PREFIX + FORMATTER.format(LocalDateTime.now()) : name; try (Git git = gitRepository.getGit()) { Status status = git.status().call(); List<Ref> tags = git.tagList().call(); String refTagName = R_TAGS + tagName; for(Ref tag : tags) { if(refTagName.equals(tag.getName())) { throw MGMT_OP_LOGGER.snapshotAlreadyExistError(tagName); } } //if comment is not null if(status.hasUncommittedChanges() || !noComment) { git.commit().setMessage(message).setAll(true).setNoVerify(true).call(); } git.tag().setName(tagName).setMessage(message).call(); } catch (GitAPIException ex) { throw MGMT_OP_LOGGER.failedToPersistConfiguration(ex, message, ex.getMessage()); } return message; }
/** {@inheritDoc} */ @Override public void tag(String name, String message) throws GitException { try (Repository repo = getRepository()) { git(repo).tag().setName(name).setMessage(message).setForceUpdate(true).call(); } catch (GitAPIException e) { throw new GitException(e); } }
.setMessage(tag.getFullMessage()) .setName(newBranchname) .setObjectId(tag.getObject())
.setMessage(tag.getFullMessage()) .setName(newBranchname) .setObjectId(tag.getObject())
@Override protected void run() throws Exception { Git git = new Git(db); if (tagName != null) { TagCommand command = git.tag().setForceUpdate(force) .setMessage(message).setName(tagName); if (object != null) { RevWalk walk = new RevWalk(db); command.setObjectId(walk.parseAny(object)); } try { command.call(); } catch (RefAlreadyExistsException e) { throw die(MessageFormat.format(CLIText.get().tagAlreadyExists, tagName)); } } else { ListTagCommand command = git.tagList(); List<Ref> list = command.call(); for (Ref ref : list) { outw.println(Repository.shortenRefName(ref.getName())); } } } }
Ref tagRef = git.tag().setName( escapedTagName ).setMessage( tagMessage ).setForceUpdate( false ).call();
Ref tagRef = git.tag().setName( escapedTagName ).setMessage( tagMessage ).setForceUpdate( false ).call();
protected void doTag(String branchToTag, String tagMessage, MergeResult resultToLog, BranchMergingExtension extension) throws GitAPIException, JGitFlowGitAPIException, JGitFlowExtensionException { runExtensionCommands(extension.beforeTag()); git.checkout().setName(branchToTag).call(); String tagName = gfConfig.getPrefixValue(JGitFlowConstants.PREFIXES.VERSIONTAG.configKey()) + getBranchName(); if (!GitHelper.tagExists(git, tagName)) { reporter.infoText( getCommandName(), String.format( "tagging with name: <%s>. merge status (%s)", tagName, resultToLog.getMergeStatus() ) ); git.tag().setName(tagName).setMessage(getScmMessagePrefix() + tagMessage + getScmMessageSuffix()).call(); } runExtensionCommands(extension.afterTag()); }
protected void doTag(String branchToTag, String tagMessage, MergeResult resultToLog, BranchMergingExtension extension) throws GitAPIException, JGitFlowGitAPIException, JGitFlowExtensionException { runExtensionCommands(extension.beforeTag()); git.checkout().setName(branchToTag).call(); String tagName = gfConfig.getPrefixValue(JGitFlowConstants.PREFIXES.VERSIONTAG.configKey()) + getBranchName(); if (!GitHelper.tagExists(git, tagName)) { reporter.infoText( getCommandName(), String.format( "tagging with name: <%s>. merge status (%s)", tagName, resultToLog.getMergeStatus() ) ); git.tag().setName(tagName).setMessage(getScmMessagePrefix() + tagMessage + getScmMessageSuffix()).call(); } runExtensionCommands(extension.afterTag()); }
if (rootTag == null) { getGit().commit().setMessage("First Commit").setCommitter("fabric", "user@fabric").call(); getGit().tag().setName(GitHelpers.ROOT_TAG).setMessage("Tag the root commit").call();
if (rootTag == null) { getGit().commit().setMessage("First Commit").setCommitter("fabric", "user@fabric").call(); getGit().tag().setName(GitHelpers.ROOT_TAG).setMessage("Tag the root commit").call();
git.tag().setName(tagName).setMessage(getScmMessagePrefix() + message).setObjectId(hotfixCommit).call();
git.tag().setName(tagName).setMessage(getScmMessagePrefix() + message).call();