From 32d3c096a713bbf541adfffa3e9dfc93c9266f05 Mon Sep 17 00:00:00 2001 From: Nadya Zabrodina Date: Wed, 2 Mar 2016 19:07:01 +0300 Subject: [PATCH] [hg] rename Head and Changesets Commnd execution * all these commands always were executed on currentThread --- .../hg4idea/command/HgChangesetsCommand.java | 6 ++--- .../zmlx/hg4idea/command/HgHeadsCommand.java | 8 +++---- .../command/HgRemoteChangesetsCommand.java | 2 +- .../provider/update/HgRegularUpdater.java | 6 ++--- .../hg4idea/status/HgRemoteStatusUpdater.java | 4 ++-- .../org/zmlx/hg4idea/test/HgUpdateTest.java | 24 +++++++++---------- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgChangesetsCommand.java b/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgChangesetsCommand.java index 22e9f3508499..24bb80b97687 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgChangesetsCommand.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgChangesetsCommand.java @@ -42,7 +42,7 @@ public abstract class HgChangesetsCommand { this.command = command; } - public List execute(VirtualFile repo) { + public List 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 args) { + protected HgCommandResult executeCommandInCurrentThread(VirtualFile repo, List args) { final HgCommandExecutor executor = new HgCommandExecutor(project); executor.setSilent(isSilentCommand()); return executor.executeInCurrentThread(repo, command, args); diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgHeadsCommand.java b/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgHeadsCommand.java index b10bfab05891..471592f201a4 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgHeadsCommand.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgHeadsCommand.java @@ -30,12 +30,12 @@ public class HgHeadsCommand { this.repo = repo; } - public List execute() { - return execute("."); + public List executeInCurrentThread() { + return executeInCurrentThread("."); } - public List execute(String branch) { - return new HeadsCommand(project, branch).execute(repo); + public List executeInCurrentThread(String branch) { + return new HeadsCommand(project, branch).executeInCurrentThread(repo); } private class HeadsCommand extends HgChangesetsCommand { diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgRemoteChangesetsCommand.java b/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgRemoteChangesetsCommand.java index 1406d5aee77c..efd349c0a196 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgRemoteChangesetsCommand.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgRemoteChangesetsCommand.java @@ -62,7 +62,7 @@ public abstract class HgRemoteChangesetsCommand extends HgChangesetsCommand { } @Override - protected HgCommandResult executeCommand(VirtualFile repo, List args) { + protected HgCommandResult executeCommandInCurrentThread(VirtualFile repo, List args) { String repositoryURL = getRepositoryUrl(repo); if (repositoryURL == null) { LOG.info("executeCommand no default path configured"); diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgRegularUpdater.java b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgRegularUpdater.java index 75efb52ca61d..143650662ccf 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgRegularUpdater.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgRegularUpdater.java @@ -63,7 +63,7 @@ public class HgRegularUpdater implements HgUpdater { } - List branchHeadsBeforePull = new HgHeadsCommand(project, repoRoot).execute(); + List 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 branchHeadsAfterPull = new HgHeadsCommand(project, repoRoot).execute(); + List branchHeadsAfterPull = new HgHeadsCommand(project, repoRoot).executeInCurrentThread(); List pulledBranchHeads = determinePulledBranchHeads(branchHeadsBeforePull, branchHeadsAfterPull); List 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 pulledRevisions = new HgMergePreviewCommand(project, newHead, parentBeforeUpdate, 1).execute(repoRoot); + final List pulledRevisions = new HgMergePreviewCommand(project, newHead, parentBeforeUpdate, 1).executeInCurrentThread(repoRoot); if (pulledRevisions == null || pulledRevisions.isEmpty()) { return null; } diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/status/HgRemoteStatusUpdater.java b/plugins/hg4idea/src/org/zmlx/hg4idea/status/HgRemoteStatusUpdater.java index 6beaebc07c41..b1125bda0395 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/status/HgRemoteStatusUpdater.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/status/HgRemoteStatusUpdater.java @@ -115,10 +115,10 @@ public class HgRemoteStatusUpdater implements HgUpdater { final List changesets = new LinkedList(); 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)); diff --git a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgUpdateTest.java b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgUpdateTest.java index 41fa9018d473..39fd77935e02 100644 --- a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgUpdateTest.java +++ b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgUpdateTest.java @@ -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 parents = parentsCommand.execute(projectRepoVirtualFile); + List 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 branchHeads = new HgHeadsCommand(myProject, projectRepoVirtualFile).execute(); + List 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 branchHeadsAfterUpdate = new HgHeadsCommand(myProject, projectRepoVirtualFile).execute(); + List branchHeadsAfterUpdate = new HgHeadsCommand(myProject, projectRepoVirtualFile).executeInCurrentThread(); assertEquals(branchHeadsAfterUpdate.size(), 3); assertEquals(parentBeforeUpdate, parentAfterUpdate); @@ -143,7 +143,7 @@ public class HgUpdateTest extends HgCollaborativeTest { List 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 branchHeads = new HgHeadsCommand(myProject, projectRepoVirtualFile).execute(); + List 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 newHeads = new HgHeadsCommand(myProject, projectRepoVirtualFile).execute(); + List 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 parentRevisions = parents.execute(projectRepoVirtualFile); + List 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 currentHeads = new HgHeadsCommand(myProject, projectRepoVirtualFile).execute(); - List incomingChangesets = new HgIncomingCommand(myProject).execute(projectRepoVirtualFile); + List currentHeads = new HgHeadsCommand(myProject, projectRepoVirtualFile).executeInCurrentThread(); + List incomingChangesets = new HgIncomingCommand(myProject).executeInCurrentThread(projectRepoVirtualFile); assertEquals(currentHeads.size(), 1); assertEquals(incomingChangesets.size(), 1);