本文整理匯總了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);
}
}