ShellCommand (@Nullable VirtualFile repo, @NotNull @NonNls String operation, @Nullable List<@NonNls String> arguments, boolean ignoreDefaultOptions) { logCommand(operation, arguments); final List<String> cmdLine = new LinkedList<>(); cmdLine.add(HgExecutableManager.getInstance().getHgExecutable(myProject)); if (repo != null) { cmdLine.add("--repository"); cmdLine.add(repo.getPath()); } if (!ignoreDefaultOptions) { cmdLine.addAll(DEFAULT_OPTIONS); } cmdLine.add(operation); if (arguments != null && arguments.size() != 0) { cmdLine.addAll(arguments); } if (HgVcs.HGENCODING == null) { cmdLine.add("--encoding"); cmdLine.add(HgEncodingUtil.getNameFor(myCharset)); } String workingDir = repo != null ? repo.getPath() : null; return new ShellCommand(cmdLine, workingDir, myCharset); }