本文整理汇总了Java中org.eclipse.jgit.api.PullResult.getFetchResult方法的典型用法代码示例。如果您正苦于以下问题:Java PullResult.getFetchResult方法的具体用法?Java PullResult.getFetchResult怎么用?Java PullResult.getFetchResult使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jgit.api.PullResult
的用法示例。
在下文中一共展示了PullResult.getFetchResult方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doExecute
import org.eclipse.jgit.api.PullResult; //导入方法依赖的package包/类
@Override
public void doExecute() {
try {
PullCommand pullCommand = git.pull().setRebase(rebase);
if (getProgressMonitor() != null) {
pullCommand.setProgressMonitor(getProgressMonitor());
}
setupCredentials(pullCommand);
PullResult pullResult = pullCommand.call();
if (!pullResult.isSuccessful()) {
FetchResult fetchResult = pullResult.getFetchResult();
GitTaskUtils.validateTrackingRefUpdates(MESSAGE_PULLED_FAILED, fetchResult.getTrackingRefUpdates());
MergeStatus mergeStatus = pullResult.getMergeResult().getMergeStatus();
if (!mergeStatus.isSuccessful()) {
throw new BuildException(String.format(MESSAGE_PULLED_FAILED_WITH_STATUS, mergeStatus.name()));
}
}
}
catch (Exception e) {
throw new GitBuildException(String.format(MESSAGE_PULLED_FAILED_WITH_URI, getUri()), e);
}
}
示例2: synchronize
import org.eclipse.jgit.api.PullResult; //导入方法依赖的package包/类
protected void synchronize() {
//
// Grab our working repository
//
Path repoPath = ((XacmlAdminUI)getUI()).getUserGitPath();
try {
final Git git = Git.open(repoPath.toFile());
PullResult result = git.pull().call();
FetchResult fetch = result.getFetchResult();
MergeResult merge = result.getMergeResult();
RebaseResult rebase = result.getRebaseResult();
if (result.isSuccessful()) {
//
// TODO add more notification
//
this.textAreaResults.setValue("Successful!");
} else {
//
// TODO
//
this.textAreaResults.setValue("Failed.");
}
} catch (IOException | GitAPIException e) {
e.printStackTrace();
}
this.buttonSynchronize.setCaption("Ok");
}
示例3: execute
import org.eclipse.jgit.api.PullResult; //导入方法依赖的package包/类
@Override
public void execute(Wandora wandora, Context context) {
try {
Git git = getGit();
if(git != null) {
if(isNotEmpty(getGitRemoteUrl())) {
PullCommand pull = git.pull();
String user = getUsername();
if(user == null) {
if(pullUI == null) {
pullUI = new PullUI();
}
pullUI.setUsername(getUsername());
pullUI.setPassword(getPassword());
pullUI.setRemoteUrl(getGitRemoteUrl());
pullUI.openInDialog();
if(pullUI.wasAccepted()) {
setUsername(pullUI.getUsername());
setPassword(pullUI.getPassword());
// setGitRemoteUrl(pullUI.getRemoteUrl());
// pull.setRemote(pullUI.getRemoteUrl());
if(isNotEmpty(getUsername())) {
CredentialsProvider credentialsProvider = new UsernamePasswordCredentialsProvider( getUsername(), getPassword() );
pull.setCredentialsProvider(credentialsProvider);
}
}
else {
return;
}
}
setDefaultLogger();
setLogTitle("Git pull");
log("Pulling changes from remote repository...");
PullResult result = pull.call();
FetchResult fetchResult = result.getFetchResult();
MergeResult mergeResult = result.getMergeResult();
MergeStatus mergeStatus = mergeResult.getMergeStatus();
String fetchResultMessages = fetchResult.getMessages();
if(isNotEmpty(fetchResultMessages)) {
log(fetchResult.getMessages());
}
log(mergeStatus.toString());
if(mergeStatus.equals(MergeStatus.MERGED)) {
int a = WandoraOptionPane.showConfirmDialog(wandora, "Reload Wandora project after pull?", "Reload Wandora project after pull?", WandoraOptionPane.YES_NO_OPTION);
if(a == WandoraOptionPane.YES_OPTION) {
reloadWandoraProject();
}
}
log("Ready.");
}
else {
log("Repository has no remote origin and can't be pulled. "
+ "Initialize repository by cloning remote repository to set the remote origin.");
}
}
else {
logAboutMissingGitRepository();
}
}
catch(GitAPIException gae) {
log(gae.toString());
}
catch(NoWorkTreeException nwte) {
log(nwte.toString());
}
catch(Exception e) {
log(e);
}
setState(WAIT);
}