.setName(plugin.getTag()) .setMessage("add " + plugin.getTag()) .call();
Ref tag = git.tag().setName("tag_for_testing").call(); System.out.println("Created/moved tag " + tag + " to repository at " + repository.getDirectory()); try (RevWalk walk = new RevWalk(repository)) { RevCommit commit = walk.parseCommit(id); tag = git.tag().setObjectId(commit).setName("tag_for_testing").call(); System.out.println("Created/moved tag " + tag + " to repository at " + repository.getDirectory()); tag = git.tag().setName("tag_for_testing").setAnnotated(true).call(); System.out.println("Created/moved tag " + tag + " to repository at " + repository.getDirectory());
TagCommand tagCmd = new TagCommand(); tagCmd.setTag(tag); tagCmd.setOverrideExistingTag(true);
private void addTagToCommit(RevCommit commit) throws GitAPIException { pull(); if (!tagPrefix.isEmpty()) { String tagName = tagPrefix + getNextTagId(); git.tag().setObjectId(commit).setName(tagName).call(); } }
/** {@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); } }
public Ref saveAtHEAD(Git git) throws GitAPIException { String json = message.toJSONString(); ref = git.tag().setName(name()).setAnnotated(true).setMessage(json).call(); return ref; }
RevCommit commit = prepareCommit(fork, "[PATCH] initialization").call(); fork.tag() .setName("patch-management") .setObjectId(commit) .call();
/** * Return a command object to execute a {@code Tag} command * * @see <a href= * "http://www.kernel.org/pub/software/scm/git/docs/git-tag.html" >Git * documentation about Tag</a> * @return a {@link org.eclipse.jgit.api.TagCommand} used to collect all * optional parameters and to finally execute the {@code Tag} * command */ public TagCommand tag() { return new TagCommand(repo); }
@Override public TagRef tagRepo(String tagName, CommitRef ref) { try { if (repository == null) { initRepository(); } AnyObjectId commitRef = repository.resolve(ref.getStringRepresentation()); if (commitRef == null) { LOGGER.debug("Couldnt resolve reference {} in repository", ref.getStringRepresentation()); return null; } RevWalk walk = new RevWalk(repository); RevCommit revCommit = walk.parseCommit(commitRef); TagCommand tag = new Git(repository).tag(); tag.setName(tagName).setObjectId(revCommit); LOGGER.debug("Tagging revision {} with name '{}'", ref.getStringRepresentation(), tagName); return new GitTagRef(tag.call()); } catch (Exception e) { throw new ScmException(e); } }
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); } }
protected void doCreateTag(Exchange exchange, String operation) throws Exception { if (ObjectHelper.isEmpty(endpoint.getTagName())) { throw new IllegalArgumentException("Tag Name must be specified to execute " + operation); } try { git.tag().setName(endpoint.getTagName()).call(); } catch (Exception e) { LOG.error("There was an error in Git {} operation", operation); throw e; } }
/** * Returns a command object to execute a {@code Tag} command * * @see <a * href="http://www.kernel.org/pub/software/scm/git/docs/git-tag.html" * >Git documentation about Tag</a> * @return a {@link TagCommand} used to collect all optional parameters and * to finally execute the {@code Tag} command */ public TagCommand tag() { return new TagCommand(repo); }
public Bundle createNewVersion(Bundle bundle) throws NoHeadException, ConcurrentRefUpdateException, InvalidTagNameException, IOException { Preconditions.checkNotNull(bundle, "bundle is null"); Preconditions.checkArgument(bundle.isSnapshot(), "can't release a non-snapshot version"); Bundle current = getBundle(bundle.getName()); Preconditions.checkArgument(bundle.equals(current), "Bundle specifier (%s:%s) is stale. Latest version is %s:%s", bundle.getName(), bundle.getVersion(), bundle.getName(), current.getVersion()); int version = bundle.getVersion(); RevCommit commit = GitUtils.getCommit(git.getRepository(), getBranch(git.getRepository(), bundle.getName())); git.tag().setObjectId(commit) .setName(bundle.getName() + "-" + version) .call(); return new Bundle(bundle.getName(), version, false); }
@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())); } } } }
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; }
Ref tag = git.tag().setName("tag_for_testing").call(); System.out.println("Created/moved tag " + tag + " to repository at " + repository.getDirectory()); try (RevWalk walk = new RevWalk(repository)) { RevCommit commit = walk.parseCommit(id); tag = git.tag().setObjectId(commit).setName("tag_for_testing").call(); System.out.println("Created/moved tag " + tag + " to repository at " + repository.getDirectory()); tag = git.tag().setName("tag_for_testing").setAnnotated(true).call(); System.out.println("Created/moved tag " + tag + " to repository at " + repository.getDirectory());
/** * Return a command object to execute a {@code Tag} command * * @see <a href= * "http://www.kernel.org/pub/software/scm/git/docs/git-tag.html" >Git * documentation about Tag</a> * @return a {@link org.eclipse.jgit.api.TagCommand} used to collect all * optional parameters and to finally execute the {@code Tag} * command */ public TagCommand tag() { return new TagCommand(repo); }
RevCommit commit = trackBaselineRepository(fork, baselineDistribution, version); fork.tag() .setName(String.format(EnvType.FABRIC_FUSE.getBaselineTagFormat(), version)) .setObjectId(commit) .call(); RevCommit commit = trackBaselineRepository(fork, baselineDistribution, version); fork.tag() .setName(String.format(EnvType.FABRIC_AMQ.getBaselineTagFormat(), version)) .setObjectId(commit) .call();