Skip to content

Commit

Permalink
Task #1178 revert the unused changes and code review.
Browse files Browse the repository at this point in the history
  • Loading branch information
ngat_di authored and ngat_di committed Apr 17, 2024
1 parent bea3bfa commit 9333065
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class GitVersioningBackendTest extends AVersioningBackendTest {
public static final String TEST_REPO_PATH_UPSTREAM = "SwtBotGitBackendUpstreamRepo";
public static final String TEST_REPO_PATH_LOCAL = "SwtBotGitBackendLocalRepo";
public static final String TEST_REPO_PATH_REMOTE = "SwtBotGitBackendRemoteRepo";
public static final String BACKEND_LOCAL_COMMIT_BEFORE_PULL = "Backend Local Commit Before Pull";

protected String upstreamRepoPathName;
protected String localRepoPathName;
Expand Down Expand Up @@ -149,8 +150,8 @@ protected String getCommitMessageFor(String repoName) {
String commitMessage = historyTableItem0.getText(1);

// If the commit message contains the phrase "Backend Local Commit Before Pull", extract the actual commit message
if (commitMessage.contains("Backend Local Commit Before Pull")) {
commitMessage = commitMessage.replace("Backend Local Commit Before Pull: ", "");
if (commitMessage.contains(BACKEND_LOCAL_COMMIT_BEFORE_PULL)) {
commitMessage = commitMessage.replace(BACKEND_LOCAL_COMMIT_BEFORE_PULL + ": ", "");
}

return commitMessage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,35 +27,34 @@
/**
* This class performs a git commit
*/

@SuppressWarnings("restriction")
public class GitCommitHandler extends AVersionControlCommitHandler {

@Override
protected IVirSatVersionControlBackend createVersionControlBackend() {
return new VirSatGitVersionControlBackend(new EGitCredentialsProvider());
}
@Override
protected void doCommit(IProject project, String message, IProgressMonitor monitor) throws Exception {
super.doCommit(project, message, monitor);
VirSatGitVersionControlBackend gitBackend = (VirSatGitVersionControlBackend) backend;

// Create an interim push operation result object for passing on to egit
PushOperationResult pushOperationResult = new PushOperationResult();
Iterable<PushResult> lastPushResults = gitBackend.getLastPushResults();
for (PushResult pushResult : lastPushResults) {
pushOperationResult.addOperationResult(pushResult.getURI(), pushResult);
}
// Create the actual egit dialog for showing push results
Repository gitRepository = RepositoryMapping.getMapping(project).getRepository();
String destination = lastPushResults.iterator().next().getURI().toString();
ShowPushResultAction showPushResultAction =
new ShowPushResultAction(gitRepository, pushOperationResult, destination, false, PushMode.UPSTREAM);
// Run it in the display thread since we will be showing UI
Display.getDefault().asyncExec(() -> showPushResultAction.run());
}
@Override
protected IVirSatVersionControlBackend createVersionControlBackend() {
return new VirSatGitVersionControlBackend(new EGitCredentialsProvider());
}
@Override
protected void doCommit(IProject project, String message, IProgressMonitor monitor) throws Exception {
super.doCommit(project, message, monitor);
VirSatGitVersionControlBackend gitBackend = (VirSatGitVersionControlBackend) backend;
// Create an interim push operation result object for passing on to egit
PushOperationResult pushOperationResult = new PushOperationResult();
Iterable<PushResult> lastPushResults = gitBackend.getLastPushResults();
for (PushResult pushResult : lastPushResults) {
pushOperationResult.addOperationResult(pushResult.getURI(), pushResult);
}
// Create the actual egit dialog for showing push results
Repository gitRepository = RepositoryMapping.getMapping(project).getRepository();
String destination = lastPushResults.iterator().next().getURI().toString();
ShowPushResultAction showPushResultAction =
new ShowPushResultAction(gitRepository, pushOperationResult, destination, false, PushMode.UPSTREAM);
// Run it in the display thread since we will be showing UI
Display.getDefault().asyncExec(() -> showPushResultAction.run());
}
}

0 comments on commit 9333065

Please sign in to comment.