mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-129637 mercurial updates to wrong revision if there tag and branch with the same name
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user