Search in sources :

Example 1 with SvnBranchConfigurationNew

use of org.jetbrains.idea.svn.branchConfig.SvnBranchConfigurationNew 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 2 with SvnBranchConfigurationNew

use of org.jetbrains.idea.svn.branchConfig.SvnBranchConfigurationNew in project intellij-community by JetBrains.

the class SvnUtil method getBranchForUrl.

@Nullable
public static SVNURL getBranchForUrl(@NotNull SvnVcs vcs, @NotNull VirtualFile vcsRoot, @NotNull SVNURL url) {
    SVNURL result = null;
    SvnBranchConfigurationNew configuration = SvnBranchConfigurationManager.getInstance(vcs.getProject()).get(vcsRoot);
    try {
        result = configuration.getWorkingBranch(url);
    } catch (SvnBindException e) {
        LOG.debug(e);
    }
    return result;
}
Also used : SvnBindException(org.jetbrains.idea.svn.commandLine.SvnBindException) SVNURL(org.tmatesoft.svn.core.SVNURL) SvnBranchConfigurationNew(org.jetbrains.idea.svn.branchConfig.SvnBranchConfigurationNew) Nullable(org.jetbrains.annotations.Nullable)

Example 3 with SvnBranchConfigurationNew

use of org.jetbrains.idea.svn.branchConfig.SvnBranchConfigurationNew in project intellij-community by JetBrains.

the class SvnQuickMergeTest method setUp.

@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    myVcs = SvnVcs.getInstance(myProject);
    myChangeListManager = ChangeListManager.getInstance(myProject);
    myBranchUrl = prepareBranchesStructure();
    myBranchRoot = new File(myTempDirFixture.getTempDirPath(), "b1");
    runInAndVerifyIgnoreOutput("co", myBranchUrl, myBranchRoot.getPath());
    Assert.assertTrue(myBranchRoot.exists());
    myBranchVf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(myBranchRoot);
    Assert.assertNotNull(myBranchVf);
    myBranchTree = new SubTree(myBranchVf);
    myTree = new SubTree(myWorkingCopyDir);
    final SvnBranchConfigurationManager branchConfigurationManager = SvnBranchConfigurationManager.getInstance(myProject);
    final SvnBranchConfigurationNew configuration = new SvnBranchConfigurationNew();
    configuration.setTrunkUrl(myRepoUrl + "/trunk");
    configuration.addBranches(myRepoUrl + "/branches", new InfoStorage<>(new ArrayList<>(), InfoReliability.empty));
    branchConfigurationManager.setConfiguration(myWorkingCopyDir, configuration);
    //((ApplicationImpl) ApplicationManager.getApplication()).setRunPooledInTest(true);
    runInAndVerifyIgnoreOutput(virtualToIoFile(myWorkingCopyDir), "up");
    Thread.sleep(10);
}
Also used : ArrayList(java.util.ArrayList) VirtualFile(com.intellij.openapi.vfs.VirtualFile) VfsUtilCore.virtualToIoFile(com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile) File(java.io.File) SvnBranchConfigurationNew(org.jetbrains.idea.svn.branchConfig.SvnBranchConfigurationNew) SvnBranchConfigurationManager(org.jetbrains.idea.svn.branchConfig.SvnBranchConfigurationManager) Before(org.junit.Before)

Example 4 with SvnBranchConfigurationNew

use of org.jetbrains.idea.svn.branchConfig.SvnBranchConfigurationNew in project intellij-community by JetBrains.

the class SvnUpdateRootOptionsPanel method chooseBranch.

private void chooseBranch() {
    if (mySourceUrl == null) {
        myBranchField.setEnabled(false);
        return;
    }
    SelectBranchPopup.show(myVcs.getProject(), myRoot.getVirtualFile(), (project, configuration, url, revision) -> {
        // TODO: It seems that we could reuse configuration passed as parameter to this callback
        SvnBranchConfigurationNew branchConfiguration = getBranchConfiguration();
        String branchRelativeUrl = branchConfiguration != null ? branchConfiguration.getRelativeUrl(mySourceUrl.toString()) : null;
        if (mySourceUrl == null || branchRelativeUrl == null) {
            myBranchField.setText("");
        } else {
            try {
                myURLText.setText(SVNURL.parseURIEncoded(url).appendPath(branchRelativeUrl, true).toDecodedString());
            } catch (SVNException e) {
                LOG.error(e);
            }
            myBranchField.setText(SVNPathUtil.tail(url));
        }
    }, SvnBundle.message("select.branch.popup.general.title"), myPanel);
}
Also used : SVNException(org.tmatesoft.svn.core.SVNException) SvnBranchConfigurationNew(org.jetbrains.idea.svn.branchConfig.SvnBranchConfigurationNew)

Aggregations

SvnBranchConfigurationNew (org.jetbrains.idea.svn.branchConfig.SvnBranchConfigurationNew)4 VfsUtilCore.virtualToIoFile (com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 NotNull (org.jetbrains.annotations.NotNull)1 Nullable (org.jetbrains.annotations.Nullable)1 SvnBranchConfigurationManager (org.jetbrains.idea.svn.branchConfig.SvnBranchConfigurationManager)1 SvnBranchItem (org.jetbrains.idea.svn.branchConfig.SvnBranchItem)1 SvnBindException (org.jetbrains.idea.svn.commandLine.SvnBindException)1 WCInfoWithBranches (org.jetbrains.idea.svn.dialogs.WCInfoWithBranches)1 Before (org.junit.Before)1 SVNException (org.tmatesoft.svn.core.SVNException)1 SVNURL (org.tmatesoft.svn.core.SVNURL)1