本文整理汇总了Java中org.eclipse.jgit.api.TagCommand.setName方法的典型用法代码示例。如果您正苦于以下问题:Java TagCommand.setName方法的具体用法?Java TagCommand.setName怎么用?Java TagCommand.setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jgit.api.TagCommand
的用法示例。
在下文中一共展示了TagCommand.setName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import org.eclipse.jgit.api.TagCommand; //导入方法依赖的package包/类
@Override
protected void run () throws GitException {
Repository repository = getRepository();
try {
RevObject obj = Utils.findObject(repository, taggedObject);
TagCommand cmd = new Git(repository).tag();
cmd.setName(tagName);
cmd.setForceUpdate(forceUpdate);
cmd.setObjectId(obj);
cmd.setAnnotated(message != null && !message.isEmpty() || signed);
if (cmd.isAnnotated()) {
cmd.setMessage(message);
cmd.setSigned(signed);
}
cmd.call();
ListTagCommand tagCmd = new ListTagCommand(repository, getClassFactory(), false, new DelegatingGitProgressMonitor(monitor));
tagCmd.run();
Map<String, GitTag> tags = tagCmd.getTags();
tag = tags.get(tagName);
} catch (JGitInternalException | GitAPIException ex) {
throw new GitException(ex);
}
}
示例2: createTag
import org.eclipse.jgit.api.TagCommand; //导入方法依赖的package包/类
/**
* creates a tag in a repository
*
* @param repository
* @param objectId
* , the ref the tag points towards
* @param tagger
* , the person tagging the object
* @param tag
* , the string label
* @param message
* , the string message
* @return boolean, true if operation was successful, otherwise false
*/
public static boolean createTag(Repository repository, String objectId, PersonIdent tagger, String tag, String message) {
try {
Git gitClient = Git.open(repository.getDirectory());
TagCommand tagCommand = gitClient.tag();
tagCommand.setTagger(tagger);
tagCommand.setMessage(message);
if (objectId != null) {
RevObject revObj = getCommit(repository, objectId);
tagCommand.setObjectId(revObj);
}
tagCommand.setName(tag);
Ref call = tagCommand.call();
return call != null ? true : false;
} catch (Exception e) {
error(e, repository, "Failed to create tag {1} in repository {0}", objectId, tag);
}
return false;
}
示例3: call
import org.eclipse.jgit.api.TagCommand; //导入方法依赖的package包/类
public Git call(final GitOperationsStep gitOperationsStep, Git git,
CredentialsProvider cp, String gitRepoUrl, File gitRepoFolder)
throws IllegalArgumentException, IOException,
ConcurrentRefUpdateException, InvalidTagNameException,
NoHeadException, GitAPIException {
TagCommand tc = git.tag().setAnnotated(annotated)
.setForceUpdate(forceUpdate).setSigned(signed);
if (!Const.isEmpty(this.message)) {
tc = tc.setMessage(gitOperationsStep
.environmentSubstitute(this.message));
}
if (!Const.isEmpty(this.name)) {
tc = tc.setName(gitOperationsStep.environmentSubstitute(this.name));
}
tc.call();
return git;
}
示例4: createTag
import org.eclipse.jgit.api.TagCommand; //导入方法依赖的package包/类
/**
* creates a tag in a repository
*
* @param repository
* @param objectId, the ref the tag points towards
* @param tagger, the person tagging the object
* @param tag, the string label
* @param message, the string message
* @return boolean, true if operation was successful, otherwise false
*/
public static boolean createTag(Repository repository, String objectId, PersonIdent tagger, String tag, String message) {
try {
Git gitClient = Git.open(repository.getDirectory());
TagCommand tagCommand = gitClient.tag();
tagCommand.setTagger(tagger);
tagCommand.setMessage(message);
if (objectId != null) {
RevObject revObj = getCommit(repository, objectId);
tagCommand.setObjectId(revObj);
}
tagCommand.setName(tag);
Ref call = tagCommand.call();
return call != null ? true : false;
} catch (Exception e) {
error(e, repository, "Failed to create tag {1} in repository {0}", objectId, tag);
}
return false;
}
示例5: createTag
import org.eclipse.jgit.api.TagCommand; //导入方法依赖的package包/类
/**
* Create a new tag in the local git repository
* (git checkout tagname) and finally pushes new branch on the remote repository (git push)
*
* @param directory the directory in which the local git repository is located
* @param username the username to be used while pushing
* @param password the password matching with the provided username to be used
* for authentication
* @param message the commit message to be used
*/
public static void createTag(@NonNull File directory, String tagName, String username,
String password, String message) {
try {
final Git git = Git.open(directory);
final UsernamePasswordCredentialsProvider userCredential = new UsernamePasswordCredentialsProvider(
username, password);
TagCommand tagCommand = git.tag();
tagCommand.setName(tagName);
tagCommand.setMessage(message);
tagCommand.call();
log.info("Tag created");
// and then commit
final PersonIdent author = new PersonIdent(username, "");
git.commit().setCommitter(author).setMessage(message)
.setAuthor(author).call();
log.info(message);
git.push().setCredentialsProvider(userCredential).call();
log.info("Pushed the changes in remote Git repository...");
} catch (final GitAPIException | IOException e) {
log.error(e.getMessage(), e);
}
}