mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-49025 Subversion: CreateBranch or Tag dialog: impossible to select BaseURL for branch/tag if the mapped vcs root is above working copy
This commit is contained in:
@@ -21,7 +21,6 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
|
||||
import com.intellij.openapi.vcs.ProjectLevelVcsManager;
|
||||
import com.intellij.openapi.vcs.VcsException;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.ui.AnActionButton;
|
||||
@@ -167,7 +166,7 @@ public class BranchConfigurationDialog extends DialogWrapper {
|
||||
}
|
||||
|
||||
public static void configureBranches(final Project project, final VirtualFile file, final boolean isRoot) {
|
||||
final VirtualFile vcsRoot = (isRoot) ? file : ProjectLevelVcsManager.getInstance(project).getVcsRootFor(file);
|
||||
final VirtualFile vcsRoot = (isRoot) ? file : getRoot(project, file);
|
||||
if (vcsRoot == null) {
|
||||
return;
|
||||
}
|
||||
@@ -205,6 +204,11 @@ public class BranchConfigurationDialog extends DialogWrapper {
|
||||
}
|
||||
}
|
||||
|
||||
private static VirtualFile getRoot(Project project, VirtualFile file) {
|
||||
RootUrlInfo path = SvnVcs.getInstance(project).getSvnFileUrlMapping().getWcRootForFilePath(new File(file.getPath()));
|
||||
return path == null ? null : path.getVirtualFile();
|
||||
}
|
||||
|
||||
private static class MyListModel extends AbstractListModel {
|
||||
private final SvnBranchConfigurationNew myConfiguration;
|
||||
private List<String> myBranchUrls;
|
||||
|
||||
@@ -23,14 +23,13 @@ import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
|
||||
import com.intellij.openapi.vcs.ProjectLevelVcsManager;
|
||||
import com.intellij.openapi.vcs.VcsException;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.ui.ComboboxWithBrowseButton;
|
||||
import com.intellij.ui.DocumentAdapter;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.idea.svn.RootUrlInfo;
|
||||
import org.jetbrains.idea.svn.SvnBranchConfigurationManager;
|
||||
import org.jetbrains.idea.svn.SvnBundle;
|
||||
import org.jetbrains.idea.svn.SvnVcs;
|
||||
@@ -86,7 +85,7 @@ public class CopyDialog extends DialogWrapper {
|
||||
private SvnBranchConfigurationNew myBranchConfiguration;
|
||||
private final VirtualFile mySrcVirtualFile;
|
||||
|
||||
public CopyDialog(final Project project, boolean canBeParent, File file) {
|
||||
public CopyDialog(final Project project, boolean canBeParent, File file) throws VcsException {
|
||||
super(project, canBeParent);
|
||||
mySrcFile = file;
|
||||
myProject = project;
|
||||
@@ -130,8 +129,15 @@ public class CopyDialog extends DialogWrapper {
|
||||
}
|
||||
});
|
||||
|
||||
VirtualFile srcVirtualFile = LocalFileSystem.getInstance().findFileByIoFile(file);
|
||||
srcVirtualFile = ProjectLevelVcsManager.getInstance(project).getVcsRootFor(srcVirtualFile);
|
||||
VirtualFile srcVirtualFile;
|
||||
RootUrlInfo root = SvnVcs.getInstance(myProject).getSvnFileUrlMapping().getWcRootForFilePath(file);
|
||||
if (root == null) {
|
||||
throw new VcsException("Can not find working copy for file: " + file.getPath());
|
||||
}
|
||||
srcVirtualFile = root.getVirtualFile();
|
||||
if (srcVirtualFile == null) {
|
||||
throw new VcsException("Can not find working copy for file: " + file.getPath());
|
||||
}
|
||||
this.mySrcVirtualFile = srcVirtualFile;
|
||||
|
||||
myRevisionPanel.setRoot(mySrcVirtualFile);
|
||||
@@ -173,7 +179,7 @@ public class CopyDialog extends DialogWrapper {
|
||||
});
|
||||
myBranchTagBaseComboBox.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
BranchConfigurationDialog.configureBranches(project, mySrcVirtualFile);
|
||||
BranchConfigurationDialog.configureBranches(project, mySrcVirtualFile, true);
|
||||
updateBranchTagBases();
|
||||
updateControls();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user