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"));
}
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;
}
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);
}
}
});
}
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());
}
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"));
}
Aggregations