diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/action/HgMerge.java b/plugins/hg4idea/src/org/zmlx/hg4idea/action/HgMerge.java index 45ff24e382ce..d19be540fbca 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/action/HgMerge.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/action/HgMerge.java @@ -18,6 +18,7 @@ package org.zmlx.hg4idea.action; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.progress.Task; import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vcs.VcsException; import com.intellij.openapi.vcs.VcsNotifier; import com.intellij.openapi.vcs.update.UpdatedFiles; @@ -42,7 +43,7 @@ public class HgMerge extends HgAbstractGlobalSingleRepoAction { final HgMergeDialog mergeDialog = new HgMergeDialog(project, repos, selectedRepo); mergeDialog.show(); if (mergeDialog.isOK()) { - final String targetValue = mergeDialog.getTargetValue(); + final String targetValue = StringUtil.escapeBackSlashes(mergeDialog.getTargetValue()); final VirtualFile repoRoot = mergeDialog.getRepository().getRoot(); new Task.Backgroundable(project, "Merging changes...") { @Override diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/action/HgUpdateToAction.java b/plugins/hg4idea/src/org/zmlx/hg4idea/action/HgUpdateToAction.java index 415cd223bd1f..96178a5679b5 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/action/HgUpdateToAction.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/action/HgUpdateToAction.java @@ -16,6 +16,7 @@ import com.intellij.openapi.fileEditor.FileDocumentManager; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.progress.Task; import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -37,7 +38,7 @@ public class HgUpdateToAction extends HgAbstractGlobalSingleRepoAction { dialog.show(); if (dialog.isOK()) { FileDocumentManager.getInstance().saveAllDocuments(); - final String updateToValue = dialog.getTargetValue(); + final String updateToValue = StringUtil.escapeBackSlashes(dialog.getTargetValue()); boolean clean = dialog.isRemoveLocalChanges(); String title = HgVcsMessages.message("hg4idea.progress.updatingTo", updateToValue); runUpdateToInBackground(project, title, dialog.getRepository().getRoot(), updateToValue, clean); diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgCommonDialogWithChoices.java b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgCommonDialogWithChoices.java index 2c28d4c500ed..10c15522f78f 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgCommonDialogWithChoices.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgCommonDialogWithChoices.java @@ -82,7 +82,7 @@ public class HgCommonDialogWithChoices extends DialogWrapper { return hgRepositorySelectorComponent.getRepository(); } - public String getTag() { + private String getTag() { return (String)tagSelector.getSelectedItem(); } @@ -90,7 +90,7 @@ public class HgCommonDialogWithChoices extends DialogWrapper { return tagOption.isSelected(); } - public String getBranch() { + private String getBranch() { return (String)branchSelector.getSelectedItem(); } @@ -98,7 +98,11 @@ public class HgCommonDialogWithChoices extends DialogWrapper { return branchOption.isSelected(); } - public String getBookmark() { + private boolean isRevisionSelected() { + return revisionOption.isSelected(); + } + + private String getBookmark() { return (String)bookmarkSelector.getSelectedItem(); } @@ -106,7 +110,7 @@ public class HgCommonDialogWithChoices extends DialogWrapper { return bookmarkOption.isSelected(); } - public String getRevision() { + private String getRevision() { return revisionTxt.getText(); } @@ -141,11 +145,15 @@ public class HgCommonDialogWithChoices extends DialogWrapper { } public String getTargetValue() { - return isBranchSelected() ? getBranch() : isBookmarkSelected() ? getBookmark() : isTagSelected() ? getTag() : getRevision(); + return isBranchSelected() + ? "branch(\"" + getBranch() + "\")" + : isBookmarkSelected() + ? "bookmark(\"" + getBookmark() + "\")" + : isTagSelected() ? "tag(\"" + getTag() + "\")" : "\"" + getRevision() + "\""; } protected ValidationInfo doValidate() { String message = "You have to specify appropriate name or revision."; - return StringUtil.isEmptyOrSpaces(getTargetValue()) ? new ValidationInfo(message, myBranchesBorderPanel) : null; + return isRevisionSelected() && StringUtil.isEmptyOrSpaces(getRevision()) ? new ValidationInfo(message, myBranchesBorderPanel) : null; } }