本文整理汇总了Java中org.eclipse.jgit.lib.Repository.updateRef方法的典型用法代码示例。如果您正苦于以下问题:Java Repository.updateRef方法的具体用法?Java Repository.updateRef怎么用?Java Repository.updateRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jgit.lib.Repository
的用法示例。
在下文中一共展示了Repository.updateRef方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import org.eclipse.jgit.lib.Repository; //导入方法依赖的package包/类
@Override
protected void run () throws GitException {
Repository repository = getRepository();
Ref currentRef = repository.getTags().get(tagName);
if (currentRef == null) {
throw new GitException.MissingObjectException(tagName, GitObjectType.TAG);
}
String fullName = currentRef.getName();
try {
RefUpdate update = repository.updateRef(fullName);
update.setRefLogMessage("tag deleted", false);
update.setForceUpdate(true);
Result deleteResult = update.delete();
switch (deleteResult) {
case IO_FAILURE:
case LOCK_FAILURE:
case REJECTED:
throw new GitException.RefUpdateException("Cannot delete tag " + tagName, GitRefUpdateResult.valueOf(deleteResult.name()));
}
} catch (IOException ex) {
throw new GitException(ex);
}
}
示例2: updateMasterRecord
import org.eclipse.jgit.lib.Repository; //导入方法依赖的package包/类
/**
*
* @param repo
* @param objectId
* @throws IOException
*/
public static void updateMasterRecord(Repository repo, ObjectId objectId) throws IOException {
RefUpdate refUpdate = repo.updateRef(Constants.HEAD);
refUpdate.setNewObjectId(objectId);
final RefUpdate.Result result = refUpdate.forceUpdate();
switch (result) {
case NEW:
System.out.println("New commit!\n");
break;
case FORCED:
System.out.println("Forced change commit!\n");
break;
default: {
System.out.println(result.name());
}
}
}
示例3: getRefUpdate
import org.eclipse.jgit.lib.Repository; //导入方法依赖的package包/类
public static RefUpdate getRefUpdate(Repository repository, String refName) {
try {
return repository.updateRef(refName);
} catch (IOException e) {
throw new RuntimeException(e);
}
}