IDEA-26360 (Performance and inconsistency issues with svn:externals and "Detect neste...
[fedora-idea.git] / plugins / svn4idea / src / org / jetbrains / idea / svn / dialogs / WCInfoWithBranches.java
blob3c04f247a524e25bf3a6533f364e4dee4b38d12d
1 /*
2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.jetbrains.idea.svn.dialogs;
18 import com.intellij.openapi.vfs.VirtualFile;
19 import org.jetbrains.idea.svn.NestedCopyType;
20 import org.jetbrains.idea.svn.WorkingCopyFormat;
21 import org.tmatesoft.svn.core.SVNURL;
22 import org.tmatesoft.svn.core.internal.util.SVNPathUtil;
24 import java.util.List;
26 public class WCInfoWithBranches extends WCInfo {
27 private final List<Branch> myBranches;
28 private final VirtualFile myRoot;
29 private final String myTrunkRoot;
31 public WCInfoWithBranches(final String path, final SVNURL url, final WorkingCopyFormat format, final String repositoryRoot, final boolean isWcRoot,
32 final List<Branch> branches,
33 final VirtualFile root,
34 final String trunkToot,
35 final NestedCopyType type) {
36 super(path, url, format, repositoryRoot, isWcRoot, type);
37 myBranches = branches;
38 myRoot = root;
39 myTrunkRoot = trunkToot;
42 // to be used in combo
43 @Override
44 public String toString() {
45 return getPath();
48 @Override
49 public VirtualFile getVcsRoot() {
50 return myRoot;
53 public List<Branch> getBranches() {
54 return myBranches;
57 public VirtualFile getRoot() {
58 return myRoot;
61 public String getTrunkRoot() {
62 return myTrunkRoot;
65 public static class Branch {
66 private final String myName;
67 private final String myUrl;
69 public Branch(final String url) {
70 myName = SVNPathUtil.tail(url);
71 myUrl = url;
74 public String getName() {
75 return myName;
78 public String getUrl() {
79 return myUrl;
82 @Override
83 public String toString() {
84 return myName;
87 @Override
88 public boolean equals(final Object o) {
89 if (this == o) return true;
90 if (o == null || getClass() != o.getClass()) return false;
92 final Branch branch = (Branch)o;
94 if (myUrl != null ? !myUrl.equals(branch.myUrl) : branch.myUrl != null) return false;
96 return true;
99 @Override
100 public int hashCode() {
101 return (myUrl != null ? myUrl.hashCode() : 0);