Search in sources :

Example 1 with WCInfoWithBranches

use of org.jetbrains.idea.svn.dialogs.WCInfoWithBranches in project intellij-community by JetBrains.

the class SvnMergeInfoTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    myTrunkUrl = myRepoUrl + "/trunk";
    myBranchUrl = myRepoUrl + "/branch";
    myBranchVcsRoot = new File(myTempDirFixture.getTempDirPath(), "branch");
    myBranchVcsRoot.mkdir();
    myProjectLevelVcsManager = (ProjectLevelVcsManagerImpl) ProjectLevelVcsManager.getInstance(myProject);
    myProjectLevelVcsManager.setDirectoryMapping(myBranchVcsRoot.getAbsolutePath(), SvnVcs.VCS_NAME);
    VirtualFile vcsRoot = LocalFileSystem.getInstance().findFileByIoFile(myBranchVcsRoot);
    Node node = new Node(vcsRoot, SVNURL.parseURIEncoded(myBranchUrl), SVNURL.parseURIEncoded(myRepoUrl));
    RootUrlInfo root = new RootUrlInfo(node, WorkingCopyFormat.ONE_DOT_SIX, vcsRoot, null);
    myWCInfo = new WCInfo(root, true, Depth.INFINITY);
    myMergeContext = new MergeContext(SvnVcs.getInstance(myProject), myTrunkUrl, myWCInfo, SVNPathUtil.tail(myTrunkUrl), vcsRoot);
    myOneShotMergeInfoHelper = new OneShotMergeInfoHelper(myMergeContext);
    myVcs = SvnVcs.getInstance(myProject);
    myVcs.getSvnConfiguration().setCheckNestedForQuickMerge(true);
    enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
    enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE);
    final String repoUrl = SVNURL.parseURIDecoded(myRepoUrl).toString();
    myWCInfoWithBranches = new WCInfoWithBranches(myWCInfo, Collections.emptyList(), vcsRoot, new WCInfoWithBranches.Branch(repoUrl + "/trunk"));
    myMergeChecker = new BranchInfo(myVcs, myWCInfoWithBranches, new WCInfoWithBranches.Branch(repoUrl + "/branch"));
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) WCInfo(org.jetbrains.idea.svn.dialogs.WCInfo) BranchInfo(org.jetbrains.idea.svn.mergeinfo.BranchInfo) Node(org.jetbrains.idea.svn.Node) RootUrlInfo(org.jetbrains.idea.svn.RootUrlInfo) MergeContext(org.jetbrains.idea.svn.integrate.MergeContext) OneShotMergeInfoHelper(org.jetbrains.idea.svn.mergeinfo.OneShotMergeInfoHelper) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) WCInfoWithBranches(org.jetbrains.idea.svn.dialogs.WCInfoWithBranches)

Example 2 with WCInfoWithBranches

use of org.jetbrains.idea.svn.dialogs.WCInfoWithBranches in project intellij-community by JetBrains.

the class RootsAndBranches method prepareData.

private JPanel prepareData(final Map<String, SvnMergeInfoRootPanelManual> panels, final Map<String, MergeInfoHolder> holders, List<WCInfoWithBranches> roots) {
    final JPanel mainPanel = new JPanel(new GridBagLayout());
    boolean onlyOneRoot = roots.size() == 1;
    final GridBagConstraints gb = new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0);
    mainPanel.add(myToolbarComponent, gb);
    ++gb.gridy;
    for (final WCInfoWithBranches root : roots) {
        if (root == null) {
            continue;
        }
        final SvnMergeInfoRootPanelManual panel = new SvnMergeInfoRootPanelManual(myProject, wcInfoWithBranches -> {
            final WCInfoWithBranches newInfo = myDataLoader.reloadInfo(wcInfoWithBranches);
            if (newInfo == null) {
                myProject.getMessageBus().syncPublisher(SvnVcs.WC_CONVERTED).run();
                return wcInfoWithBranches;
            }
            return newInfo;
        }, () -> {
            final MergeInfoHolder holder = getHolder(root.getPath());
            if (holder != null) {
                holder.refresh(false);
            }
        }, onlyOneRoot, root);
        panels.put(root.getPath(), panel);
        holders.put(root.getPath(), createHolder(panel));
        final JPanel contentPanel = panel.getContentPanel();
        mainPanel.add(contentPanel, gb);
        ++gb.gridy;
    }
    if (panels.size() == 1) {
        for (SvnMergeInfoRootPanelManual panel : panels.values()) {
            panel.setOnlyOneRoot(true);
        }
    }
    return mainPanel;
}
Also used : WCInfoWithBranches(org.jetbrains.idea.svn.dialogs.WCInfoWithBranches) MergeInfoHolder(org.jetbrains.idea.svn.mergeinfo.MergeInfoHolder)

Example 3 with WCInfoWithBranches

use of org.jetbrains.idea.svn.dialogs.WCInfoWithBranches in project intellij-community by JetBrains.

the class RootsAndBranches method reloadPanels.

public void reloadPanels() {
    final Map<Couple<String>, SvnMergeInfoRootPanelManual.InfoHolder> states = new HashMap<>();
    for (Map.Entry<String, SvnMergeInfoRootPanelManual> entry : myMergePanels.entrySet()) {
        final String localPath = entry.getKey();
        final WCInfoWithBranches wcInfo = entry.getValue().getWcInfo();
        states.put(Couple.of(localPath, wcInfo.getUrl().toString()), entry.getValue().getInfo());
    }
    createPanels(myLocation, () -> {
        for (Map.Entry<String, SvnMergeInfoRootPanelManual> entry : myMergePanels.entrySet()) {
            final String localPath = entry.getKey();
            final WCInfoWithBranches wcInfo = entry.getValue().getWcInfo();
            final Couple<String> key = Couple.of(localPath, wcInfo.getUrl().toString());
            final SvnMergeInfoRootPanelManual.InfoHolder infoHolder = states.get(key);
            if (infoHolder != null) {
                entry.getValue().initSelection(infoHolder);
            }
        }
    });
}
Also used : HashMap(java.util.HashMap) Couple(com.intellij.openapi.util.Couple) MergeInfoHolder(org.jetbrains.idea.svn.mergeinfo.MergeInfoHolder) HashMap(java.util.HashMap) Map(java.util.Map) WCInfoWithBranches(org.jetbrains.idea.svn.dialogs.WCInfoWithBranches)

Example 4 with WCInfoWithBranches

use of org.jetbrains.idea.svn.dialogs.WCInfoWithBranches in project intellij-community by JetBrains.

the class WcInfoLoader method createInfoWithBranches.

@NotNull
private WCInfoWithBranches createInfoWithBranches(@NotNull WCInfo info, @NotNull RootUrlInfo rootUrlInfo) {
    SvnBranchConfigurationNew configuration = SvnBranchConfigurationManager.getInstance(myVcs.getProject()).get(rootUrlInfo.getVirtualFile());
    Ref<WCInfoWithBranches.Branch> workingCopyBranch = Ref.create();
    List<WCInfoWithBranches.Branch> branches = ContainerUtil.newArrayList();
    String url = info.getUrl().toString();
    // TODO: Probably could utilize SvnBranchConfigurationNew.UrlListener and SvnBranchConfigurationNew.iterateUrls() behavior
    String trunkUrl = configuration.getTrunkUrl();
    if (trunkUrl != null) {
        add(url, trunkUrl, branches, workingCopyBranch);
    }
    for (String branchUrl : configuration.getBranchUrls()) {
        for (SvnBranchItem branchItem : configuration.getBranches(branchUrl)) {
            add(url, branchItem.getUrl(), branches, workingCopyBranch);
        }
    }
    Collections.sort(branches, (o1, o2) -> Comparing.compare(o1.getUrl(), o2.getUrl()));
    return new WCInfoWithBranches(info, branches, rootUrlInfo.getRoot(), workingCopyBranch.get());
}
Also used : SvnBranchItem(org.jetbrains.idea.svn.branchConfig.SvnBranchItem) SvnBranchConfigurationNew(org.jetbrains.idea.svn.branchConfig.SvnBranchConfigurationNew) WCInfoWithBranches(org.jetbrains.idea.svn.dialogs.WCInfoWithBranches) NotNull(org.jetbrains.annotations.NotNull)

Example 5 with WCInfoWithBranches

use of org.jetbrains.idea.svn.dialogs.WCInfoWithBranches in project intellij-community by JetBrains.

the class SvnMergeInfoTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    myTrunkUrl = myRepoUrl + "/trunk";
    myBranchUrl = myRepoUrl + "/branch";
    myBranchVcsRoot = new File(myTempDirFixture.getTempDirPath(), "branch");
    myBranchVcsRoot.mkdir();
    myProjectLevelVcsManager = (ProjectLevelVcsManagerImpl) ProjectLevelVcsManager.getInstance(myProject);
    myProjectLevelVcsManager.setDirectoryMapping(myBranchVcsRoot.getAbsolutePath(), SvnVcs.VCS_NAME);
    VirtualFile vcsRoot = LocalFileSystem.getInstance().findFileByIoFile(myBranchVcsRoot);
    Node node = new Node(vcsRoot, SVNURL.parseURIEncoded(myBranchUrl), SVNURL.parseURIEncoded(myRepoUrl));
    RootUrlInfo root = new RootUrlInfo(node, WorkingCopyFormat.ONE_DOT_SIX, vcsRoot, null);
    myWCInfo = new WCInfo(root, true, Depth.INFINITY);
    myMergeContext = new MergeContext(SvnVcs.getInstance(myProject), myTrunkUrl, myWCInfo, SVNPathUtil.tail(myTrunkUrl), vcsRoot);
    myOneShotMergeInfoHelper = new OneShotMergeInfoHelper(myMergeContext);
    myVcs = SvnVcs.getInstance(myProject);
    myVcs.getSvnConfiguration().setCheckNestedForQuickMerge(true);
    enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
    enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE);
    final String repoUrl = SVNURL.parseURIDecoded(myRepoUrl).toString();
    myWCInfoWithBranches = new WCInfoWithBranches(myWCInfo, Collections.emptyList(), vcsRoot, new WCInfoWithBranches.Branch(repoUrl + "/trunk"));
    myMergeChecker = new BranchInfo(myVcs, myWCInfoWithBranches, new WCInfoWithBranches.Branch(repoUrl + "/branch"));
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) WCInfo(org.jetbrains.idea.svn.dialogs.WCInfo) BranchInfo(org.jetbrains.idea.svn.mergeinfo.BranchInfo) MergeContext(org.jetbrains.idea.svn.integrate.MergeContext) OneShotMergeInfoHelper(org.jetbrains.idea.svn.mergeinfo.OneShotMergeInfoHelper) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) WCInfoWithBranches(org.jetbrains.idea.svn.dialogs.WCInfoWithBranches)

Aggregations

WCInfoWithBranches (org.jetbrains.idea.svn.dialogs.WCInfoWithBranches)6 MergeInfoHolder (org.jetbrains.idea.svn.mergeinfo.MergeInfoHolder)3 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 File (java.io.File)2 HashMap (java.util.HashMap)2 NotNull (org.jetbrains.annotations.NotNull)2 WCInfo (org.jetbrains.idea.svn.dialogs.WCInfo)2 MergeContext (org.jetbrains.idea.svn.integrate.MergeContext)2 BranchInfo (org.jetbrains.idea.svn.mergeinfo.BranchInfo)2 OneShotMergeInfoHelper (org.jetbrains.idea.svn.mergeinfo.OneShotMergeInfoHelper)2 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 Task (com.intellij.openapi.progress.Task)1 MultiLineLabelUI (com.intellij.openapi.ui.MultiLineLabelUI)1 Couple (com.intellij.openapi.util.Couple)1 Map (java.util.Map)1 Node (org.jetbrains.idea.svn.Node)1 RootUrlInfo (org.jetbrains.idea.svn.RootUrlInfo)1 SvnBranchConfigurationNew (org.jetbrains.idea.svn.branchConfig.SvnBranchConfigurationNew)1 SvnBranchItem (org.jetbrains.idea.svn.branchConfig.SvnBranchItem)1