本文整理汇总了Java中org.eclipse.jgit.api.TagCommand.setTagger方法的典型用法代码示例。如果您正苦于以下问题:Java TagCommand.setTagger方法的具体用法?Java TagCommand.setTagger怎么用?Java TagCommand.setTagger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jgit.api.TagCommand
的用法示例。
在下文中一共展示了TagCommand.setTagger方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例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: tagCreate
import org.eclipse.jgit.api.TagCommand; //导入方法依赖的package包/类
@Override
public Tag tagCreate(TagCreateParams params) throws GitException {
String commit = params.getCommit();
if (commit == null) {
commit = HEAD;
}
try {
RevWalk revWalk = new RevWalk(repository);
RevObject revObject;
try {
revObject = revWalk.parseAny(repository.resolve(commit));
} finally {
revWalk.close();
}
TagCommand tagCommand =
getGit()
.tag()
.setName(params.getName())
.setObjectId(revObject)
.setMessage(params.getMessage())
.setForceUpdate(params.isForce());
GitUser tagger = getUser();
if (tagger != null) {
tagCommand.setTagger(new PersonIdent(tagger.getName(), tagger.getEmail()));
}
Ref revTagRef = tagCommand.call();
RevTag revTag = revWalk.parseTag(revTagRef.getLeaf().getObjectId());
return newDto(Tag.class).withName(revTag.getTagName());
} catch (IOException | GitAPIException exception) {
throw new GitException(exception.getMessage(), exception);
}
}