diff --git a/plugins/svn4idea/src/META-INF/plugin.xml b/plugins/svn4idea/src/META-INF/plugin.xml
index 27cc78249ba1..91272191afc3 100644
--- a/plugins/svn4idea/src/META-INF/plugin.xml
+++ b/plugins/svn4idea/src/META-INF/plugin.xml
@@ -122,6 +122,8 @@
serviceImplementation="org.jetbrains.idea.svn.history.LoadedRevisionsCache"/>
+
myConfigurationMap = new HashMap();
+ public Map myConfigurationMap = new TreeMap();
/**
* version of "support SVN in IDEA". for features tracking. should grow
*/
@@ -122,7 +124,6 @@ public class SvnBranchConfigurationManager implements PersistentStateComponent> oldMap = configToConvert.getBranchMap();
for (String branchUrl : configToConvert.getBranchUrls()) {
- List items = oldMap.get(branchUrl);
- items = ((items == null) || (items.isEmpty())) ? new ArrayList() : items;
- whatToInit.add(new Pair(root, newConfig));
- newConfig.addBranches(branchUrl, new InfoStorage>(items,
- (items.isEmpty()) ? InfoReliability.defaultValues : InfoReliability.setByUser));
+ List stored = getStored(branchUrl);
+ if (stored != null && ! stored.isEmpty()) {
+ newConfig.addBranches(branchUrl, new InfoStorage>(stored, InfoReliability.setByUser));
+ } else {
+ whatToInit.add(new Pair(root, newConfig));
+ newConfig.addBranches(branchUrl, new InfoStorage>(new ArrayList(), InfoReliability.empty));
+ }
}
myBunch.updateForRoot(root, new InfoStorage(newConfig, InfoReliability.setByUser), null);
@@ -227,6 +229,14 @@ public class SvnBranchConfigurationManager implements PersistentStateComponent getStored(String branchUrl) {
+ Collection collection = myStorage.get(branchUrl);
+ if (collection == null) return null;
+ final List items = new ArrayList(collection);
+ Collections.sort(items);
+ return items;
+ }
+
private static class UrlSerializationHelper {
private final SvnVcs myVcs;
@@ -248,24 +258,9 @@ public class SvnBranchConfigurationManager implements PersistentStateComponent> map = configuration.getBranchMap();
- final Map> newMap = new HashMap>(map.size(), 1.0f);
- for (Map.Entry> entry : map.entrySet()) {
- final List items = entry.getValue();
- if (items != null) {
- final List newItems = new ArrayList();
- for (SvnBranchItem item : items) {
- newItems.add(new SvnBranchItem(serializeUrl(item.getUrl(), withUserInfo), new java.util.Date(item.getCreationDateMillis()),
- item.getRevision()));
- }
- newMap.put(serializeUrl(entry.getKey(), withUserInfo), newItems);
- }
- }
-
final SvnBranchConfiguration result = new SvnBranchConfiguration();
result.setTrunkUrl(trunkUrl);
result.setBranchUrls(newBranchesList);
- result.setBranchMap(newMap);
result.setUserinfoInUrl(withUserInfo.isNull() ? false : withUserInfo.get());
return result;
}
@@ -286,24 +281,9 @@ public class SvnBranchConfigurationManager implements PersistentStateComponent> map = configuration.getBranchMap();
- final Map> newMap = new HashMap>(map.size(), 1.0f);
- for (Map.Entry> entry : map.entrySet()) {
- final List items = entry.getValue();
- if (items != null) {
- final List newItems = new ArrayList();
- for (SvnBranchItem item : items) {
- newItems.add(new SvnBranchItem(deserializeUrl(item.getUrl(), userInfo), new java.util.Date(item.getCreationDateMillis()),
- item.getRevision()));
- }
- newMap.put(deserializeUrl(entry.getKey(), userInfo), newItems);
- }
- }
-
final SvnBranchConfiguration result = new SvnBranchConfiguration();
result.setTrunkUrl(newTrunkUrl);
result.setBranchUrls(newBranchesList);
- result.setBranchMap(newMap);
result.setUserinfoInUrl(userInfo != null && userInfo.length() > 0);
return result;
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBranchMapperManager.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBranchMapperManager.java
index f099c99adaa4..32fe9c01b47f 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBranchMapperManager.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBranchMapperManager.java
@@ -28,6 +28,9 @@ import org.jetbrains.idea.svn.branchConfig.SvnBranchConfigurationNew;
import java.io.File;
import java.util.*;
+/**
+ * Holds what working copies we have for URLs
+ */
@State(
name = "SvnBranchMapperManager",
storages = {
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties
index cdc41173293c..bb03dc312d59 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties
@@ -433,7 +433,7 @@ compare.with.branch.diff.title=Compare with Branch
compare.with.branch.error.title=Compare with Branch
compare.with.branch.popup.title=Compare with Branch
getting.branch.configuration.error=Error retrieving branch configuration: {0}
-compare.with.branch.location.error=Couldn''t find repository location for file ''{0}'' under branch ''{1}''
+compare.with.branch.location.error=Couldn''t find repository location for file ''{0}'' under branch ''{1}''\nPlease check your branch configuration.
compare.with.branch.list.error=Error Loading Branches
create.branch.invalid.revision.error=Invalid revision ''{0}''
create.branch.no.working.copy.error=No working copy found at {0}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnLoadedBrachesStorage.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnLoadedBrachesStorage.java
new file mode 100644
index 000000000000..803485242e0a
--- /dev/null
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnLoadedBrachesStorage.java
@@ -0,0 +1,153 @@
+/*
+ * Copyright 2000-2011 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.idea.svn;
+
+import com.intellij.openapi.application.PathManager;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.vcs.persistent.SmallMapSerializer;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.util.io.DataExternalizer;
+import com.intellij.util.io.EnumeratorStringDescriptor;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.svn.branchConfig.InfoReliability;
+import org.jetbrains.idea.svn.branchConfig.InfoStorage;
+import org.jetbrains.idea.svn.branchConfig.SvnBranchConfigurationNew;
+import org.jetbrains.idea.svn.integrate.SvnBranchItem;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.File;
+import java.io.IOException;
+import java.util.*;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Irina.Chernushina
+ * Date: 8/24/11
+ * Time: 1:21 PM
+ */
+public class SvnLoadedBrachesStorage {
+ private final Object myLock;
+ private SmallMapSerializer>> myState;
+ private final File myFile;
+ private final Project myProject;
+
+ public SvnLoadedBrachesStorage(final Project project) {
+ myProject = project;
+ final File vcsFile = new File(PathManager.getSystemPath(), "vcs");
+ File file = new File(vcsFile, "svn_branches");
+ file.mkdirs();
+ myFile = new File(file, project.getLocationHash());
+ myLock = new Object();
+ }
+
+ @Nullable
+ public Collection get(final String url) {
+ synchronized (myLock) {
+ if (myState == null) return null;
+ Map> map = myState.get("");
+ return map == null ? null : map.get(SvnBranchConfigurationNew.ensureEndSlash(url));
+ }
+ }
+
+ public void put(final String url, final Collection items) {
+ synchronized (myLock) {
+ if (myState == null) return;
+ Map> map = myState.get("");
+ if (map == null) {
+ map = new HashMap>();
+ myState.put("", map);
+ }
+ map.put(url, items);
+ }
+ }
+
+ public void activate() {
+ synchronized (myLock) {
+ myState = new SmallMapSerializer>>(myFile, new EnumeratorStringDescriptor(), createExternalizer());
+ }
+ }
+
+
+ public void deactivate() {
+ SvnBranchConfigurationManager manager = SvnBranchConfigurationManager.getInstance(myProject);
+ Map mapCopy = manager.getSvnBranchConfigManager().getMapCopy();
+ for (Map.Entry entry : mapCopy.entrySet()) {
+ Map>> branchMap = entry.getValue().getBranchMap();
+ for (Map.Entry>> storageEntry : branchMap.entrySet()) {
+ put(storageEntry.getKey(), storageEntry.getValue().getValue());
+ }
+ }
+ synchronized (myLock) {
+ myState.force();
+ myState = null;
+ }
+ }
+
+ private DataExternalizer