mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[hg] rename Head and Changesets Commnd execution
* all these commands always were executed on currentThread
This commit is contained in:
@@ -42,7 +42,7 @@ public abstract class HgChangesetsCommand {
|
||||
this.command = command;
|
||||
}
|
||||
|
||||
public List<HgRevisionNumber> execute(VirtualFile repo) {
|
||||
public List<HgRevisionNumber> executeInCurrentThread(VirtualFile repo) {
|
||||
return getRevisions(repo);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public abstract class HgChangesetsCommand {
|
||||
|
||||
addArguments(args);
|
||||
|
||||
HgCommandResult result = executeCommand(repo, args);
|
||||
HgCommandResult result = executeCommandInCurrentThread(repo, args);
|
||||
|
||||
if (result == null) {
|
||||
return Collections.emptyList();
|
||||
@@ -83,7 +83,7 @@ public abstract class HgChangesetsCommand {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected HgCommandResult executeCommand(VirtualFile repo, List<String> args) {
|
||||
protected HgCommandResult executeCommandInCurrentThread(VirtualFile repo, List<String> args) {
|
||||
final HgCommandExecutor executor = new HgCommandExecutor(project);
|
||||
executor.setSilent(isSilentCommand());
|
||||
return executor.executeInCurrentThread(repo, command, args);
|
||||
|
||||
@@ -30,12 +30,12 @@ public class HgHeadsCommand {
|
||||
this.repo = repo;
|
||||
}
|
||||
|
||||
public List<HgRevisionNumber> execute() {
|
||||
return execute(".");
|
||||
public List<HgRevisionNumber> executeInCurrentThread() {
|
||||
return executeInCurrentThread(".");
|
||||
}
|
||||
|
||||
public List<HgRevisionNumber> execute(String branch) {
|
||||
return new HeadsCommand(project, branch).execute(repo);
|
||||
public List<HgRevisionNumber> executeInCurrentThread(String branch) {
|
||||
return new HeadsCommand(project, branch).executeInCurrentThread(repo);
|
||||
}
|
||||
|
||||
private class HeadsCommand extends HgChangesetsCommand {
|
||||
|
||||
@@ -62,7 +62,7 @@ public abstract class HgRemoteChangesetsCommand extends HgChangesetsCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected HgCommandResult executeCommand(VirtualFile repo, List<String> args) {
|
||||
protected HgCommandResult executeCommandInCurrentThread(VirtualFile repo, List<String> args) {
|
||||
String repositoryURL = getRepositoryUrl(repo);
|
||||
if (repositoryURL == null) {
|
||||
LOG.info("executeCommand no default path configured");
|
||||
|
||||
@@ -63,7 +63,7 @@ public class HgRegularUpdater implements HgUpdater {
|
||||
}
|
||||
|
||||
|
||||
List<HgRevisionNumber> branchHeadsBeforePull = new HgHeadsCommand(project, repoRoot).execute();
|
||||
List<HgRevisionNumber> branchHeadsBeforePull = new HgHeadsCommand(project, repoRoot).executeInCurrentThread();
|
||||
|
||||
if (branchHeadsBeforePull.size() > 1) {
|
||||
reportWarning(warnings, HgVcsMessages.message("hg4idea.update.warning.multipleHeadsBeforeUpdate", repoRoot.getPath()));
|
||||
@@ -91,7 +91,7 @@ public class HgRegularUpdater implements HgUpdater {
|
||||
|
||||
indicator.setText2(HgVcsMessages.message("hg4idea.progress.countingHeads"));
|
||||
|
||||
List<HgRevisionNumber> branchHeadsAfterPull = new HgHeadsCommand(project, repoRoot).execute();
|
||||
List<HgRevisionNumber> branchHeadsAfterPull = new HgHeadsCommand(project, repoRoot).executeInCurrentThread();
|
||||
List<HgRevisionNumber> pulledBranchHeads = determinePulledBranchHeads(branchHeadsBeforePull, branchHeadsAfterPull);
|
||||
List<HgRevisionNumber> remainingOriginalBranchHeads =
|
||||
determingRemainingOriginalBranchHeads(branchHeadsBeforePull, branchHeadsAfterPull);
|
||||
@@ -172,7 +172,7 @@ public class HgRegularUpdater implements HgUpdater {
|
||||
|
||||
private @Nullable HgRevisionNumber findCommonParent(HgRevisionNumber newHead, HgRevisionNumber parentBeforeUpdate) {
|
||||
// hg log -r 0:source --prune dest --limit 1
|
||||
final List<HgRevisionNumber> pulledRevisions = new HgMergePreviewCommand(project, newHead, parentBeforeUpdate, 1).execute(repoRoot);
|
||||
final List<HgRevisionNumber> pulledRevisions = new HgMergePreviewCommand(project, newHead, parentBeforeUpdate, 1).executeInCurrentThread(repoRoot);
|
||||
if (pulledRevisions == null || pulledRevisions.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -115,10 +115,10 @@ public class HgRemoteStatusUpdater implements HgUpdater {
|
||||
final List<HgRevisionNumber> changesets = new LinkedList<HgRevisionNumber>();
|
||||
for (VirtualFile root : roots) {
|
||||
if (incoming) {
|
||||
changesets.addAll(new HgIncomingCommand(project).execute(root));
|
||||
changesets.addAll(new HgIncomingCommand(project).executeInCurrentThread(root));
|
||||
}
|
||||
else {
|
||||
changesets.addAll(new HgOutgoingCommand(project).execute(root));
|
||||
changesets.addAll(new HgOutgoingCommand(project).executeInCurrentThread(root));
|
||||
}
|
||||
}
|
||||
status.setChanges(changesets.size(), new ChangesetFormatter(status, changesets));
|
||||
|
||||
@@ -99,23 +99,23 @@ public class HgUpdateTest extends HgCollaborativeTest {
|
||||
|
||||
//create multiple heads locally
|
||||
HgUpdateCommand updateCommand = new HgUpdateCommand(myProject, projectRepoVirtualFile);
|
||||
HgRevisionNumber parent = new HgParentsCommand(myProject).execute(projectRepoVirtualFile).get(0);
|
||||
HgRevisionNumber parent = new HgParentsCommand(myProject).executeInCurrentThread(projectRepoVirtualFile).get(0);
|
||||
HgParentsCommand parentsCommand = new HgParentsCommand(myProject);
|
||||
parentsCommand.setRevision(parent);
|
||||
List<HgRevisionNumber> parents = parentsCommand.execute(projectRepoVirtualFile);
|
||||
List<HgRevisionNumber> parents = parentsCommand.executeInCurrentThread(projectRepoVirtualFile);
|
||||
updateCommand.setRevision(parents.get(0).getChangeset());
|
||||
updateCommand.execute();
|
||||
|
||||
createFileInCommand(projectRepoVirtualFile.findChild("com"),"c.txt", "updated content");
|
||||
runHg(projectRepo, "commit", "-m", "creating new local head");
|
||||
|
||||
List<HgRevisionNumber> branchHeads = new HgHeadsCommand(myProject, projectRepoVirtualFile).execute();
|
||||
List<HgRevisionNumber> branchHeads = new HgHeadsCommand(myProject, projectRepoVirtualFile).executeInCurrentThread();
|
||||
assertEquals(branchHeads.size(), 2);
|
||||
|
||||
HgRevisionNumber parentBeforeUpdate = new HgWorkingCopyRevisionsCommand(myProject).identify(projectRepoVirtualFile).getFirst();
|
||||
assertUpdateThroughPluginFails();
|
||||
HgRevisionNumber parentAfterUpdate = new HgWorkingCopyRevisionsCommand(myProject).identify(projectRepoVirtualFile).getFirst();
|
||||
List<HgRevisionNumber> branchHeadsAfterUpdate = new HgHeadsCommand(myProject, projectRepoVirtualFile).execute();
|
||||
List<HgRevisionNumber> branchHeadsAfterUpdate = new HgHeadsCommand(myProject, projectRepoVirtualFile).executeInCurrentThread();
|
||||
|
||||
assertEquals(branchHeadsAfterUpdate.size(), 3);
|
||||
assertEquals(parentBeforeUpdate, parentAfterUpdate);
|
||||
@@ -143,7 +143,7 @@ public class HgUpdateTest extends HgCollaborativeTest {
|
||||
List<VcsException> nonFatalWarnings = updateThroughPlugin();
|
||||
|
||||
assertTrue(nonFatalWarnings.isEmpty());
|
||||
HgRevisionNumber parentAfterUpdate = new HgParentsCommand(myProject).execute(projectRepoVirtualFile).get(0);
|
||||
HgRevisionNumber parentAfterUpdate = new HgParentsCommand(myProject).executeInCurrentThread(projectRepoVirtualFile).get(0);
|
||||
assertEquals(incomingHead, parentAfterUpdate);
|
||||
|
||||
assertIsChanged(HgFileStatusEnum.MODIFIED, "com", "b.txt");
|
||||
@@ -163,7 +163,7 @@ public class HgUpdateTest extends HgCollaborativeTest {
|
||||
|
||||
assertUpdateThroughPluginFails();
|
||||
|
||||
List<HgRevisionNumber> branchHeads = new HgHeadsCommand(myProject, projectRepoVirtualFile).execute();
|
||||
List<HgRevisionNumber> branchHeads = new HgHeadsCommand(myProject, projectRepoVirtualFile).executeInCurrentThread();
|
||||
assertEquals(branchHeads.size(), 2);
|
||||
|
||||
|
||||
@@ -184,12 +184,12 @@ public class HgUpdateTest extends HgCollaborativeTest {
|
||||
}
|
||||
|
||||
private void assertCurrentHeadIsMerge(HgRevisionNumber incomingHead, HgRevisionNumber headBeforeUpdate) {
|
||||
List<HgRevisionNumber> newHeads = new HgHeadsCommand(myProject, projectRepoVirtualFile).execute();
|
||||
List<HgRevisionNumber> newHeads = new HgHeadsCommand(myProject, projectRepoVirtualFile).executeInCurrentThread();
|
||||
assertEquals(newHeads.size(), 1, "After updating, there should be only one head because the remote heads should have been merged");
|
||||
HgRevisionNumber newHead = newHeads.get(0);
|
||||
HgParentsCommand parents = new HgParentsCommand(myProject);
|
||||
parents.setRevision(newHead);
|
||||
List<HgRevisionNumber> parentRevisions = parents.execute(projectRepoVirtualFile);
|
||||
List<HgRevisionNumber> parentRevisions = parents.executeInCurrentThread(projectRepoVirtualFile);
|
||||
assertEquals(parentRevisions.size(), 2);
|
||||
assertTrue(parentRevisions.contains(incomingHead));
|
||||
assertTrue(parentRevisions.contains(headBeforeUpdate));
|
||||
@@ -233,8 +233,8 @@ public class HgUpdateTest extends HgCollaborativeTest {
|
||||
|
||||
assertUpdateThroughPluginFails();
|
||||
|
||||
assertEquals( new HgHeadsCommand( myProject, projectRepoVirtualFile ).execute().size(), 2,
|
||||
"Remote head should have been pulled in" );
|
||||
assertEquals(new HgHeadsCommand( myProject, projectRepoVirtualFile ).executeInCurrentThread().size(), 2,
|
||||
"Remote head should have been pulled in" );
|
||||
|
||||
assertEquals( new HgWorkingCopyRevisionsCommand( myProject ).parents( projectRepoVirtualFile ).size(), 1,
|
||||
"No merge should have been attempted" );
|
||||
@@ -293,8 +293,8 @@ public class HgUpdateTest extends HgCollaborativeTest {
|
||||
}
|
||||
|
||||
public PreUpdateInformation getPreUpdateInformation() {
|
||||
List<HgRevisionNumber> currentHeads = new HgHeadsCommand(myProject, projectRepoVirtualFile).execute();
|
||||
List<HgRevisionNumber> incomingChangesets = new HgIncomingCommand(myProject).execute(projectRepoVirtualFile);
|
||||
List<HgRevisionNumber> currentHeads = new HgHeadsCommand(myProject, projectRepoVirtualFile).executeInCurrentThread();
|
||||
List<HgRevisionNumber> incomingChangesets = new HgIncomingCommand(myProject).executeInCurrentThread(projectRepoVirtualFile);
|
||||
|
||||
assertEquals(currentHeads.size(), 1);
|
||||
assertEquals(incomingChangesets.size(), 1);
|
||||
|
||||
Reference in New Issue
Block a user