mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[hg]: execute Qnew in current thread and rename hg commit type command execution methods
This commit is contained in:
@@ -87,7 +87,7 @@ public class HgTaskHandler extends DvcsTaskHandler<HgRepository> {
|
||||
Project project = repository.getProject();
|
||||
VirtualFile repositoryRoot = repository.getRoot();
|
||||
try {
|
||||
new HgCommitCommand(project, repository, "Automated merge with " + branch).execute();
|
||||
new HgCommitCommand(project, repository, "Automated merge with " + branch).executeInCurrentThread();
|
||||
new HgBookmarkCommand(project, repositoryRoot, branch).deleteBookmark();
|
||||
}
|
||||
catch (HgCommandException e) {
|
||||
|
||||
@@ -76,7 +76,7 @@ public abstract class HgCommitTypeCommand {
|
||||
}
|
||||
|
||||
|
||||
public void execute() throws HgCommandException, VcsException {
|
||||
public void executeInCurrentThread() throws HgCommandException, VcsException {
|
||||
if (StringUtil.isEmptyOrSpaces(myMessage)) {
|
||||
throw new HgCommandException(HgVcsMessages.message("hg4idea.commit.error.messageEmpty"));
|
||||
}
|
||||
|
||||
@@ -47,13 +47,13 @@ public class HgQNewCommand extends HgCommitTypeCommand {
|
||||
@Override
|
||||
protected void executeChunked(@NotNull List<List<String>> chunkedCommits) throws HgCommandException, VcsException {
|
||||
if (chunkedCommits.isEmpty()) {
|
||||
executeQNew(ContainerUtil.<String>emptyList());
|
||||
executeQNewInCurrentThread(ContainerUtil.emptyList());
|
||||
}
|
||||
else {
|
||||
int size = chunkedCommits.size();
|
||||
int i = 0;
|
||||
if (!myAmend) {
|
||||
executeQNew(chunkedCommits.get(0));
|
||||
executeQNewInCurrentThread(chunkedCommits.get(0));
|
||||
i = 1;
|
||||
}
|
||||
for (; i < size; i++) {
|
||||
@@ -82,7 +82,7 @@ public class HgQNewCommand extends HgCommitTypeCommand {
|
||||
});
|
||||
}
|
||||
|
||||
private void executeQNew(@NotNull List<String> chunkFiles) throws VcsException {
|
||||
private void executeQNewInCurrentThread(@NotNull List<String> chunkFiles) throws VcsException {
|
||||
List<String> args = ContainerUtil.newArrayList();
|
||||
args.add("-l");
|
||||
args.add(saveCommitMessage().getAbsolutePath());
|
||||
@@ -91,14 +91,10 @@ public class HgQNewCommand extends HgCommitTypeCommand {
|
||||
args.add(patchName);
|
||||
args.addAll(chunkFiles);
|
||||
HgCommandExecutor executor = new HgCommandExecutor(myProject);
|
||||
executor.execute(myRepository.getRoot(), "qnew", args, new HgCommandResultHandler() {
|
||||
@Override
|
||||
public void process(@Nullable HgCommandResult result) {
|
||||
if (HgErrorUtil.hasErrorsInCommandExecution(result)) {
|
||||
new HgCommandResultNotifier(myProject)
|
||||
.notifyError(result, "Qnew Failed", "Could not create mq patch for selected changes");
|
||||
}
|
||||
}
|
||||
});
|
||||
HgCommandResult result = executor.executeInCurrentThread(myRepository.getRoot(), "qnew", args);
|
||||
if (HgErrorUtil.hasErrorsInCommandExecution(result)) {
|
||||
new HgCommandResultNotifier(myProject)
|
||||
.notifyError(result, "Qnew Failed", "Could not create mq patch for selected changes");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ public class HgCheckinEnvironment implements CheckinEnvironment {
|
||||
command.setFiles(selectedFiles);
|
||||
}
|
||||
try {
|
||||
command.execute();
|
||||
command.executeInCurrentThread();
|
||||
}
|
||||
catch (HgCommandException e) {
|
||||
exceptions.add(new VcsException(e));
|
||||
|
||||
@@ -192,7 +192,7 @@ public class HgRegularUpdater implements HgUpdater {
|
||||
LOG.warn("Couldn't find repository info for " + repoRoot.getName());
|
||||
return;
|
||||
}
|
||||
new HgCommitCommand(project, hgRepository, "Automated merge").execute();
|
||||
new HgCommitCommand(project, hgRepository, "Automated merge").executeInCurrentThread();
|
||||
}
|
||||
catch (HgCommandException e) {
|
||||
throw new VcsException(e);
|
||||
|
||||
@@ -43,7 +43,7 @@ public class HgEncodingTest extends HgPlatformTest {
|
||||
echo("file.txt", "lalala");
|
||||
HgRepository hgRepo = HgRepositoryImpl.getInstance(myRepository, myProject, myProject);
|
||||
HgCommitCommand commitCommand = new HgCommitCommand(myProject, hgRepo, "сообщение");
|
||||
commitCommand.execute();
|
||||
commitCommand.executeInCurrentThread();
|
||||
}
|
||||
|
||||
//test SpecialCharacters in commit message for default EncodingProject settings
|
||||
@@ -55,7 +55,7 @@ public class HgEncodingTest extends HgPlatformTest {
|
||||
String comment = "öäüß";
|
||||
HgRepository hgRepo = HgRepositoryImpl.getInstance(myRepository, myProject, myProject);
|
||||
HgCommitCommand commitCommand = new HgCommitCommand(myProject, hgRepo, comment);
|
||||
commitCommand.execute();
|
||||
commitCommand.executeInCurrentThread();
|
||||
HgLogCommand logCommand = new HgLogCommand(myProject);
|
||||
myRepository.refresh(false, true);
|
||||
VirtualFile file = myRepository.findChild(fileName);
|
||||
|
||||
@@ -55,7 +55,7 @@ public class HgCommitTest extends HgPlatformTest {
|
||||
List<HgFileRevision> revisions = logCommand.execute(hgFile, -1, false);
|
||||
HgRepository hgRepo = HgRepositoryImpl.getInstance(myRepository, myProject, myProject);
|
||||
HgCommitCommand commit = new HgCommitCommand(myProject, hgRepo, changedCommit, true);
|
||||
commit.execute();
|
||||
commit.executeInCurrentThread();
|
||||
List<HgFileRevision> revisionsAfterAmendCommit = logCommand.execute(hgFile, -1, false);
|
||||
assertTrue(revisions.size() == revisionsAfterAmendCommit.size());
|
||||
assertEquals(revisionsAfterAmendCommit.get(0).getCommitMessage(), changedCommit);
|
||||
|
||||
@@ -85,7 +85,7 @@ public class MqPatchTest extends HgPlatformTest {
|
||||
cd(myRepository);
|
||||
append(FILENAME, "modify");
|
||||
myRepository.refresh(false,true);
|
||||
new HgQNewCommand(myProject, myHgRepository, MESSAGE, false).execute();
|
||||
new HgQNewCommand(myProject, myHgRepository, MESSAGE, false).executeInCurrentThread();
|
||||
myRepository.refresh(false,true);
|
||||
MqPatchDetails patchDetails = updateAndGetDetails();
|
||||
assertEqualsCommitInfo(null, patchDetails);
|
||||
|
||||
Reference in New Issue
Block a user