本文整理汇总了Java中org.eclipse.jgit.api.RebaseResult类的典型用法代码示例。如果您正苦于以下问题:Java RebaseResult类的具体用法?Java RebaseResult怎么用?Java RebaseResult使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RebaseResult类属于org.eclipse.jgit.api包,在下文中一共展示了RebaseResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createResult
import org.eclipse.jgit.api.RebaseResult; //导入依赖的package包/类
private GitRebaseResult createResult (RebaseResult res) {
String currHead;
Repository repository = getRepository();
File workTree = repository.getWorkTree();
try {
currHead = repository.resolve(Constants.HEAD).name();
} catch (IOException ex) {
currHead = Constants.HEAD;
}
List<File> conflicts;
if (res.getStatus() == RebaseResult.Status.STOPPED) {
conflicts = getConflicts(res.getCurrentCommit());
} else {
conflicts = Collections.<File>emptyList();
}
return getClassFactory().createRebaseResult(res, conflicts, getFailures(res), currHead);
}
示例2: update
import org.eclipse.jgit.api.RebaseResult; //导入依赖的package包/类
private void update(Git git) throws GitAPIException {
PullResult pullResult = git.pull().setRebase(true).call();
RebaseResult rebaseResult = pullResult.getRebaseResult();
if(!pullResult.isSuccessful()) {
if(rebaseResult.getStatus() == RebaseResult.Status.CONFLICTS) {
logger.warn("Git `pull` reported conflicts - will reset and try again next pass!");
git.reset().setMode(ResetCommand.ResetType.HARD).call();
return;
}
logger.warn("Git `pull` was unsuccessful :(");
return;
}
if(rebaseResult.getStatus() == RebaseResult.Status.UP_TO_DATE) {
logger.debug("Git `pull` reported that repository is already up-to-date");
return;
}
logger.debug("Git repo is now at commit '{}'", rebaseResult.getCurrentCommit());
}
示例3: process
import org.eclipse.jgit.api.RebaseResult; //导入依赖的package包/类
@Override
public RebaseResponse process(Repository repository, String message) throws GitAPIException, IOException {
try (Git git = Git.wrap(repository)) {
git.commit()
.setMessage(stripCommentLines(message))
.setAmend(true).setNoVerify(true).call();
getRebaseFile(repository, MESSAGE_SQUASH).delete();
getRebaseFile(repository, MESSAGE_FIXUP).delete();
createFile(repository, MESSAGE, message);
RebaseResult result = git.rebase()
.setOperation(RebaseCommand.Operation.SKIP)
.runInteractively(handler)
.call();
return new RebaseResponse(result);
}
}
示例4: process
import org.eclipse.jgit.api.RebaseResult; //导入依赖的package包/类
@Override
public RebaseResponse process(Repository repository, String message) throws GitAPIException {
try (Git git = Git.wrap(repository)) {
git.commit()
.setAll(true)
.setAmend(true)
.setNoVerify(true)
.setMessage(message)
.call();
RebaseResult result = git.rebase()
.setOperation(RebaseCommand.Operation.CONTINUE)
.runInteractively(handler)
.call();
// 如果 conflict and edit,amend 后 continue 会返回 NOTHING_TO_COMMIT
// so skip this commit
if (result.getStatus().equals(RebaseResult.Status.NOTHING_TO_COMMIT)) {
result = git.rebase().setOperation(RebaseCommand.Operation.SKIP).call();
}
return new RebaseResponse(result);
}
}
示例5: process
import org.eclipse.jgit.api.RebaseResult; //导入依赖的package包/类
@Override
public RebaseResponse process(Repository repository, String message) throws GitAPIException, IOException {
try (Git git = Git.wrap(repository)) {
git.commit()
.setMessage(message)
.setAmend(true)
.setNoVerify(true)
.call();
RebaseResult result = git.rebase()
.setOperation(RebaseCommand.Operation.SKIP)
.runInteractively(handler)
.call();
return new RebaseResponse(result);
}
}
示例6: rebase
import org.eclipse.jgit.api.RebaseResult; //导入依赖的package包/类
@Override
public boolean rebase(String upStreamBranchName) {
RebaseCommand command = _git.rebase();
RebaseResult result = null;
try {
command.setUpstream(upStreamBranchName);
result = command.call();
// if there are merge conflicts (rebase interactive) - reset the repository
if (!result.getStatus().isSuccessful()) {
_git.rebase().setOperation(Operation.ABORT).call();
}
} catch (Throwable e) {
throw new RuntimeException(String.format(
"Failed to rebase with upstream [%s]",
upStreamBranchName), e);
}
return result.getStatus().isSuccessful();
}
示例7: colocarEmSAFE
import org.eclipse.jgit.api.RebaseResult; //导入依赖的package包/类
private void colocarEmSAFE() throws GitAPIException, IOException {
RebaseResult rebaseResult = git
.rebase()
.setStrategy(THEIRS)
.setOperation(ABORT)
.call();
Marker marker = append("git.state", git.getRepository().getRepositoryState().toString())
.and(append("git.branch", git.getRepository().getBranch()))
.and(append("pull.rebase.result", rebaseResult.getStatus().toString()));
log.info(marker, "git rebase em {}", git.getRepository().getBranch());
Ref resetResult = git.reset().setMode(HARD).setRef(R_HEADS + MASTER).call();
marker = append("reset.result", resetResult.getName());
log.info(marker, "git reset --hard em {}", git.getRepository().getBranch());
}
示例8: applyBefore
import org.eclipse.jgit.api.RebaseResult; //导入依赖的package包/类
public static Boolean applyBefore(final Git git) {
Boolean result = Boolean.FALSE;
try {
PullCommand pc = git.pull().setRemote(REMOTE).setRebase(Boolean.TRUE);
PullResult pullRes = pc.call();
RebaseResult rr = pullRes.getRebaseResult();
if (rr.getStatus().equals(RebaseResult.Status.UP_TO_DATE) || rr.getStatus().equals(RebaseResult.Status.FAST_FORWARD)) {
result = Boolean.TRUE;
}
if (rr.getStatus().equals(RebaseResult.Status.UNCOMMITTED_CHANGES)) {
PullResult pr = git.pull().call();
if (pr.isSuccessful()) {
result = Boolean.TRUE;
} else {
result = Boolean.FALSE;
}
}
} catch (Exception e) {
logger.error(e.getMessage());
}
return result;
}
示例9: GitRebaseResult
import org.eclipse.jgit.api.RebaseResult; //导入依赖的package包/类
GitRebaseResult (RebaseResult result, List<File> rebaseConflicts, List<File> failures, String currentHead) {
this.rebaseStatus = parseRebaseStatus(result.getStatus());
this.currentHead = currentHead;
if (result.getCurrentCommit() == null) {
this.currentCommit = null;
} else {
this.currentCommit = result.getCurrentCommit().getId().getName();
}
this.conflicts = rebaseConflicts;
this.failures = failures;
}
示例10: parseRebaseStatus
import org.eclipse.jgit.api.RebaseResult; //导入依赖的package包/类
static RebaseStatus parseRebaseStatus (RebaseResult.Status rebaseStatus) {
switch (rebaseStatus) {
case EDIT:
return RebaseStatus.STOPPED;
case UNCOMMITTED_CHANGES:
return RebaseStatus.FAILED;
case INTERACTIVE_PREPARED:
return RebaseStatus.STOPPED;
case STASH_APPLY_CONFLICTS:
return RebaseStatus.CONFLICTS;
}
return GitRebaseResult.RebaseStatus.valueOf(rebaseStatus.name());
}
示例11: rebaseOnTargetBranch
import org.eclipse.jgit.api.RebaseResult; //导入依赖的package包/类
private void rebaseOnTargetBranch(Git git, final List<Commit> commits) throws Exception {
RebaseCommand rebase = git.rebase();
rebase.setUpstream(request.getTarget().getBranch());
rebase.setProgressMonitor(new NotificationProgressMonitor(request, notification, progress));
rebase.runInteractively(new GitUtil.InteractiveRebase(notification, request.getKey(), commits));
RebaseResult result = rebase.call();
if(!result.getStatus().isSuccessful()) {
throw new RuntimeException("Rebase not successful, status " + result.getStatus());
}
}
示例12: synchronize
import org.eclipse.jgit.api.RebaseResult; //导入依赖的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");
}
示例13: createRebaseResult
import org.eclipse.jgit.api.RebaseResult; //导入依赖的package包/类
public abstract GitRebaseResult createRebaseResult (RebaseResult rebaseResult, List<File> rebaseConflicts, List<File> failures,
String newHead);
示例14: createRebaseResult
import org.eclipse.jgit.api.RebaseResult; //导入依赖的package包/类
@Override
public GitRebaseResult createRebaseResult (RebaseResult rebaseResult, List<File> rebaseConflicts, List<File> failures,
String newHead) {
return new GitRebaseResult(rebaseResult, rebaseConflicts, failures, newHead);
}
示例15: testRebaseStatus
import org.eclipse.jgit.api.RebaseResult; //导入依赖的package包/类
public void testRebaseStatus () {
for (RebaseResult.Status status : RebaseResult.Status.values()) {
assertNotNull(GitRebaseResult.parseRebaseStatus(status));
}
}