本文整理汇总了Java中org.eclipse.jgit.api.errors.JGitInternalException类的典型用法代码示例。如果您正苦于以下问题:Java JGitInternalException类的具体用法?Java JGitInternalException怎么用?Java JGitInternalException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JGitInternalException类属于org.eclipse.jgit.api.errors包,在下文中一共展示了JGitInternalException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import org.eclipse.jgit.api.errors.JGitInternalException; //导入依赖的package包/类
@Override
protected void run () throws GitException {
Repository repository = getRepository();
File workTree = repository.getWorkTree();
org.eclipse.jgit.api.SubmoduleStatusCommand cmd = new Git(repository).submoduleStatus();
for (String path : Utils.getRelativePaths(workTree, roots)) {
cmd.addPath(path);
}
try {
Map<String, SubmoduleStatus> result = cmd.call();
GitClassFactory fac = getClassFactory();
for (Map.Entry<String, SubmoduleStatus> e : result.entrySet()) {
File root = new File(workTree, e.getKey());
statuses.put(root, fac.createSubmoduleStatus(e.getValue(), root));
}
} catch (GitAPIException | JGitInternalException ex) {
throw new GitException(ex);
}
}
示例2: run
import org.eclipse.jgit.api.errors.JGitInternalException; //导入依赖的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);
}
}
示例3: cloneRepository
import org.eclipse.jgit.api.errors.JGitInternalException; //导入依赖的package包/类
@Override
public GitMaterial cloneRepository(GitMaterial gitMaterial) {
try {
CredentialsProvider credentials = this.handleCredentials(gitMaterial);
Git.cloneRepository()
.setURI(gitMaterial.getRepositoryUrl())
.setCredentialsProvider(credentials)
.setDirectory(new File(gitMaterial.getDestination()))
.setCloneSubmodules(true)
.call();
gitMaterial.setErrorMessage("");
return null;
} catch (GitAPIException | JGitInternalException e) {
gitMaterial.setErrorMessage(e.getMessage());
return gitMaterial;
}
}
示例4: main
import org.eclipse.jgit.api.errors.JGitInternalException; //导入依赖的package包/类
public static void main(String args[]) throws IOException, JGitInternalException, GitAPIException, URISyntaxException{
String in = "������³˹��³˹������˹����˹��³˹������˹�Ǹ�����";
String str = "��³˹������˹";
int lastIndexOf = blackAction.lastIndexOf(str, in);
System.out.println(lastIndexOf);
// String path = "d://test//git//test01";
// String path2 = "C://Users//Administrator//Documents//blacktest//2017.01.133";
// String[] s = new String[]{"refs/heads/nov","refs/heads/master"};
//
// ArrayList<RevCommit> commits = gitTool.getCommitsFromBranch(path, s);
// for(RevCommit r:commits){
// System.out.println(r.getFullMessage());
// }
//
//
//
}
示例5: forceUpdate
import org.eclipse.jgit.api.errors.JGitInternalException; //导入依赖的package包/类
private void forceUpdate(final RefUpdate ru,
final ObjectId id) throws java.io.IOException, ConcurrentRefUpdateException {
final RefUpdate.Result rc = ru.forceUpdate();
switch (rc) {
case NEW:
case FORCED:
case FAST_FORWARD:
break;
case REJECTED:
case LOCK_FAILURE:
throw new ConcurrentRefUpdateException(JGitText.get().couldNotLockHEAD,
ru.getRef(),
rc);
default:
throw new JGitInternalException(MessageFormat.format(JGitText.get().updatingRefFailed,
Constants.HEAD,
id.toString(),
rc));
}
}
示例6: execute
import org.eclipse.jgit.api.errors.JGitInternalException; //导入依赖的package包/类
public OpNotification execute() throws Exception {
Log.d(TAG, "Starting execute... directory=" + directory);
ensureFolderExists(directory.getParentFile());
try {
cloneRepository()
.setBare(bare)
.setDirectory(directory)
.setURI(sourceUri.toPrivateString())
.setProgressMonitor(messagingProgressMonitor)
.setTransportConfigCallback(transportConfigCallback)
.setCredentialsProvider(credentialsProvider)
.call();
Log.d(TAG, "Completed checkout!");
} catch (JGitInternalException e) {
throw exceptionWithFriendlyMessageFor(e);
} finally {
repoUpdateBroadcaster.broadcastUpdate();
}
return new OpNotification(stat_sys_download_done, "Cloned "
+ sourceUri.getHumanishName(), "Clone completed",
sourceUri.toString());
}
示例7: setCustomTemplateInRepo
import org.eclipse.jgit.api.errors.JGitInternalException; //导入依赖的package包/类
@Override
public void setCustomTemplateInRepo(String repositoryUrl, String cloneRepo) {
File tmpDir = Files.createTempDir();
log.info("Creating clone in {}", tmpDir.getPath());
try {
Git git;
if (cloneRepo == null) {
git = copyDefaultTemplate(tmpDir);
} else {
git = cloneRepo(cloneRepo, tmpDir);
}
pushClonedRepoToOurRepository(repositoryUrl, git);
} catch (IOException | JGitInternalException | GitAPIException | URISyntaxException e) {
log.error("Could not instantiate repo", e);
throw new DevHubException("Could not instantiate repo", e);
} finally {
boolean deleted = FileUtils.deleteQuietly(tmpDir);
log.debug("Temporary template deletion succes = {}", deleted);
}
}
示例8: call
import org.eclipse.jgit.api.errors.JGitInternalException; //导入依赖的package包/类
@Override
public String call() throws GitAPIException {
try {
DirCache index = repo.lockDirCache();
DirCacheEntry entry = index.getEntry(fileName);
if (entry != null) {
entry.setAssumeValid(assumeUnchanged);
index.write();
index.commit();
return entry.getPathString();
}
} catch (IOException e) {
throw new JGitInternalException(e.getMessage(), e);
}
return null;
}
示例9: call
import org.eclipse.jgit.api.errors.JGitInternalException; //导入依赖的package包/类
@Override
public Ref call() throws GitAPIException, RefNotFoundException,
CheckoutConflictException, InvalidRefNameException,
RefAlreadyExistsException
{
this.checkCallable();
try {
this.processOptions();
this.checkoutStartPoint();
RefUpdate update = this.getRepository().updateRef(Constants.HEAD);
Result r = update.link(this.getBranchName());
if (EnumSet.of(Result.NEW, Result.FORCED).contains(r) == false) {
throw new JGitInternalException(MessageFormat.format(
JGitText.get().checkoutUnexpectedResult, r.name()));
}
this.setCallable(false);
return this.getRepository().getRef(Constants.HEAD);
}
catch (IOException e) {
throw new JGitInternalException(e.getMessage(), e);
}
}
示例10: run
import org.eclipse.jgit.api.errors.JGitInternalException; //导入依赖的package包/类
@Override
protected void run () throws GitException {
Repository repository = getRepository();
File workTree = repository.getWorkTree();
org.eclipse.jgit.api.SubmoduleInitCommand cmd = new Git(repository).submoduleInit();
for (String path : Utils.getRelativePaths(workTree, roots)) {
cmd.addPath(path);
}
try {
cmd.call();
statusCmd.run();
} catch (GitAPIException | JGitInternalException ex) {
throw new GitException(ex);
}
}
示例11: testCommit
import org.eclipse.jgit.api.errors.JGitInternalException; //导入依赖的package包/类
/**
* �����ύ����
*/
@Test
public void testCommit() throws IOException, GitAPIException,
JGitInternalException {
//git�ֿ��ַ
Git git = new Git(new FileRepository(localPath+"/.git"));
//�ύ����
git.commit().setMessage("������ļ�")
.setAuthor("������", "[email protected]")
//.setAll(true)
.call();
// git.commit().setMessage("д�����ļ�")
// .call();
}
示例12: testPush
import org.eclipse.jgit.api.errors.JGitInternalException; //导入依赖的package包/类
/**
* push���ش��뵽Զ�ֿ̲��ַ
*/
@Test
public void testPush() throws IOException, JGitInternalException,
GitAPIException {
UsernamePasswordCredentialsProvider usernamePasswordCredentialsProvider =new
UsernamePasswordCredentialsProvider(username,password);
//git�ֿ��ַ
Git git = new Git(new FileRepository(localPath+"/.git"));
git.push().setRemote(remotePath).setCredentialsProvider(usernamePasswordCredentialsProvider)
.setPushAll()
.call();
}
示例13: getCauseDescription
import org.eclipse.jgit.api.errors.JGitInternalException; //导入依赖的package包/类
private String getCauseDescription(Throwable cause) {
if (cause == null) {
return "";
} else if (JGitInternalException.class.isAssignableFrom(cause.getClass())) {
Throwable innerCause = cause.getCause();
return innerCause != null ? getCauseDescription(cause.getCause()) : "JGit internal error";
} else {
return getDecamelisedName(cause);
}
}
示例14: commit
import org.eclipse.jgit.api.errors.JGitInternalException; //导入依赖的package包/类
@SneakyThrows
public void commit(Path caminho, String mensagem, UserProfile profile) {
PersonIdent ident = new PersonIdent(profile.getName(), profile.getEmail());
try {
RevCommit result = git.commit()
.setMessage(mensagem)
.setCommitter(ident)
.setAuthor(ident)
.setOnly(caminho.toString())
.call();
Marker marker = append("commit", result.getName())
.and(append("commit.message", mensagem))
.and(append("commit.author", ident.getName()))
.and(append("commit.email", ident.getEmailAddress()))
.and(append("commit.path", caminho.toString()))
.and(append("git.branch", git.getRepository().getBranch()))
.and(append("git.state", git.getRepository().getRepositoryState().toString()));
log.info(marker, "git commit {}", caminho);
} catch (JGitInternalException e) {
if (e.getMessage().equals(JGitText.get().emptyCommit)) {
log.info("Commit não possui alterações em {}", caminho);
} else {
throw e;
}
}
}
示例15: push
import org.eclipse.jgit.api.errors.JGitInternalException; //导入依赖的package包/类
public void push(String projectName, String branchName, String username, String password) throws IOException, JGitInternalException,
GitAPIException {
CredentialsProvider cp = new UsernamePasswordCredentialsProvider(username, password);
Iterable<PushResult> pushResult = getGitObject(projectName, branchName).getGitInstance().push().setCredentialsProvider(cp).call();
System.out.println("Push result: ");
for(PushResult res : pushResult) {
System.out.println(res.toString());
}
}