mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-100740 Can not execute hg command with long argument list. Fix For merge commit action.
*If it's merge commit, so myFiles in HgCommitCommand is Empty. Need to commit all files in changeList,but can't call setFiles() method. see HgCheckinEnviroment->commit() method *Check if filePaths is empty, then try to commit without chunk. *May produce ShellCommand error if there are many merged files. Need to fix this case.
This commit is contained in:
@@ -18,8 +18,6 @@ import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vcs.VcsException;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.messages.MessageBus;
|
||||
import com.intellij.vcsUtil.VcsFileUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -33,7 +31,10 @@ import org.zmlx.hg4idea.util.HgUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.zmlx.hg4idea.HgErrorHandler.ensureSuccess;
|
||||
|
||||
@@ -62,16 +63,23 @@ public class HgCommitCommand {
|
||||
throw new HgCommandException(HgVcsMessages.message("hg4idea.commit.error.messageEmpty"));
|
||||
}
|
||||
List<String> relativePaths = HgUtil.getRelativePathsByRepository(myFiles).get(myRoot);
|
||||
//if it's merge commit, so myFiles is Empty. Need to commit all files in changeList, can't call setFiles() method.
|
||||
// see HgCheckinEnviroment->commit() method
|
||||
if (relativePaths == null) {
|
||||
return; // relativePaths for root shouldn't be empty;
|
||||
}
|
||||
for (List<String> chunk : VcsFileUtil.chunkRelativePaths(relativePaths)) {
|
||||
List<String> parameters = new LinkedList<String>();
|
||||
parameters.add("--logfile");
|
||||
parameters.add(saveCommitMessage().getAbsolutePath());
|
||||
parameters.addAll(chunk);
|
||||
ensureSuccess(new HgCommandExecutor(myProject).executeInCurrentThread(myRoot, "commit", parameters));
|
||||
}
|
||||
else {
|
||||
for (List<String> chunk : VcsFileUtil.chunkRelativePaths(relativePaths)) {
|
||||
List<String> parameters = new LinkedList<String>();
|
||||
parameters.add("--logfile");
|
||||
parameters.add(saveCommitMessage().getAbsolutePath());
|
||||
parameters.addAll(chunk);
|
||||
ensureSuccess(new HgCommandExecutor(myProject).executeInCurrentThread(myRoot, "commit", parameters));
|
||||
}
|
||||
}
|
||||
final MessageBus messageBus = myProject.getMessageBus();
|
||||
messageBus.syncPublisher(HgVcs.REMOTE_TOPIC).update(myProject, null);
|
||||
messageBus.syncPublisher(HgVcs.BRANCH_TOPIC).update(myProject, null);
|
||||
|
||||
Reference in New Issue
Block a user