IDEA-100629 Subversion: external copy is not detected (not shown in Subversion working copies)

This commit is contained in:
irengrig
2013-02-07 15:59:54 +04:00
parent 09e4f64f00
commit 34adfcf080
15 changed files with 211 additions and 193 deletions
@@ -78,7 +78,7 @@ public class NestedCopiesBuilder implements StatusReceiver {
final File ioFile = new File(vf.getPath());
final RootUrlInfo info = myMapping.getWcRootForFilePath(ioFile);
if (info != null && FileUtil.filesEqual(ioFile, info.getIoFile()) && ! info.getAbsoluteUrlAsUrl().equals(url)) {
SvnVcs.getInstance(myProject).invokeRefreshSvnRoots(true);
SvnVcs.getInstance(myProject).invokeRefreshSvnRoots();
}
}
@@ -87,7 +87,7 @@ public class NestedCopiesBuilder implements StatusReceiver {
private SVNURL myUrl;
private WorkingCopyFormat myFormat;
private final NestedCopyType myType;
private final SVNURL myRootURL;
private SVNURL myRootURL;
MyPointInfo(@NotNull final VirtualFile file,
final SVNURL url,
@@ -149,6 +149,10 @@ public class NestedCopiesBuilder implements StatusReceiver {
public int hashCode() {
return key(myFile).hashCode();
}
public void setRootURL(final SVNURL value) {
myRootURL = value;
}
}
public Set<MyPointInfo> getSet() {
@@ -146,7 +146,7 @@ public class SvnAuthenticationNotifier extends GenericNotifierImpl<SvnAuthentica
private void onStateChangedToSuccess(final AuthenticationRequest obj) {
myCopiesPassiveResults.put(getKey(obj), true);
myVcs.invokeRefreshSvnRoots(false);
myVcs.invokeRefreshSvnRoots();
final List<SVNURL> outdatedRequests = new LinkedList<SVNURL>();
final Collection<SVNURL> keys = getAllCurrentKeys();
@@ -16,95 +16,43 @@
package org.jetbrains.idea.svn;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.RequestsMerger;
import com.intellij.util.Consumer;
import com.intellij.util.concurrency.Semaphore;
public class SvnCopiesRefreshManager {
private final CopiesRefresh myCopiesRefresh;
private final RequestsMerger myRequestsMerger;
private final Semaphore mySemaphore;
private Runnable myMappingCallback;
public SvnCopiesRefreshManager(final Project project, final SvnFileUrlMappingImpl mapping) {
myCopiesRefresh = new MyVeryRefresh();
final Runnable refresher = new MyRefresher(mapping);
final RequestsMerger requestsMerger = new RequestsMerger(refresher, new Consumer<Runnable>() {
public SvnCopiesRefreshManager(final SvnFileUrlMappingImpl mapping) {
mySemaphore = new Semaphore();
// svn mappings refresh inside also uses asynchronous pass -> we need to pass callback that will ping our "single-threaded" executor here
myMappingCallback = new Runnable() {
@Override
public void run() {
mySemaphore.up();
}
};
myRequestsMerger = new RequestsMerger(new Runnable() {
@Override
public void run() {
mySemaphore.down();
mapping.realRefresh(myMappingCallback);
mySemaphore.waitFor();
}
}, new Consumer<Runnable>() {
public void consume(final Runnable runnable) {
ApplicationManager.getApplication().executeOnPooledThread(runnable);
}
});
((MyVeryRefresh) myCopiesRefresh).setRequestMerger(requestsMerger);
}
public CopiesRefresh getCopiesRefresh() {
return myCopiesRefresh;
public void asynchRequest() {
myRequestsMerger.request();
}
private class MyVeryRefresh implements CopiesRefresh {
private static final long ourQueryInterval = 1000;
private RequestsMerger myRequestMerger;
private final ProgressManager myPm;
private MyVeryRefresh() {
myPm = ProgressManager.getInstance();
}
public void setRequestMerger(RequestsMerger requestMerger) {
myRequestMerger = requestMerger;
}
public void ensureInit() {
synchRequest(myPm.getProgressIndicator(), true);
}
public void asynchRequest() {
myRequestMerger.request();
}
public void synchRequest() {
synchRequest(myPm.getProgressIndicator(), false);
}
private void synchRequest(final ProgressIndicator pi, final boolean isOnlyInit) {
final Semaphore semaphore = new Semaphore();
final Runnable waiter = new Runnable() {
public void run() {
semaphore.up();
}
};
semaphore.down();
if (isOnlyInit) {
myRequestMerger.ensureInitialization(waiter);
} else {
myRequestMerger.waitRefresh(waiter);
}
while (true) {
if (semaphore.waitFor(ourQueryInterval)) break;
if (pi != null) {
pi.checkCanceled();
}
}
}
}
private static class MyRefresher implements Runnable {
private final SvnFileUrlMappingImpl myMapping;
private MyRefresher(final SvnFileUrlMappingImpl mapping) {
myMapping = mapping;
}
public void run() {
try {
myMapping.realRefresh();
}
catch (ProcessCanceledException e) {
//
}
}
public void waitRefresh(final Runnable runnable) {
myRequestsMerger.waitRefresh(runnable);
}
}
@@ -221,7 +221,7 @@ public class SvnFileUrlMappingImpl implements SvnFileUrlMapping, PersistentState
}
}
public void realRefresh() {
public void realRefresh(final Runnable callback) {
final SvnVcs vcs = SvnVcs.getInstance(myProject);
final VirtualFile[] roots = myHelper.executeDefended(myProject);
@@ -232,7 +232,7 @@ public class SvnFileUrlMappingImpl implements SvnFileUrlMapping, PersistentState
}
});
// do not send additional request for nested copies when in init state
copiesDetector.detectCopyRoots(roots, init());
copiesDetector.detectCopyRoots(roots, init(), callback);
}
private class CopiesApplier {
@@ -292,7 +292,7 @@ public class SvnFileUrlMappingImpl implements SvnFileUrlMapping, PersistentState
myRepositoryRoots = new RepositoryRoots(myVcs);
}
public void detectCopyRoots(final VirtualFile[] roots, final boolean clearState) {
public void detectCopyRoots(final VirtualFile[] roots, final boolean clearState, Runnable callback) {
final Getter<Boolean> cancelGetter = new Getter<Boolean>() {
public Boolean get() {
return myVcs.getProject().isDisposed();
@@ -300,6 +300,7 @@ public class SvnFileUrlMappingImpl implements SvnFileUrlMapping, PersistentState
};
for (final VirtualFile vcsRoot : roots) {
// go into nested = false => only find a working copys below passed roots, but not nested
final List<Real> foundRoots = ForNestedRootChecker.getAllNestedWorkingCopies(vcsRoot, myVcs, false, cancelGetter);
if (foundRoots.isEmpty()) {
myLonelyRoots.add(vcsRoot);
@@ -317,10 +318,10 @@ public class SvnFileUrlMappingImpl implements SvnFileUrlMapping, PersistentState
}
}
addNestedRoots(clearState);
addNestedRoots(clearState, callback);
}
private void addNestedRoots(final boolean clearState) {
private void addNestedRoots(final boolean clearState, final Runnable callback) {
final List<VirtualFile> basicVfRoots = ObjectsConvertor.convert(myTopRoots, new Convertor<RootUrlInfo, VirtualFile>() {
public VirtualFile convert(final RootUrlInfo real) {
return real.getVirtualFile();
@@ -343,7 +344,7 @@ public class SvnFileUrlMappingImpl implements SvnFileUrlMapping, PersistentState
final File infoFile = new File(info.getFile().getPath());
boolean copyFound = false;
for (RootUrlInfo topRoot : myTopRoots) {
if (topRoot.getIoFile().equals(infoFile)) {
if (FileUtil.filesEqual(topRoot.getIoFile(), infoFile)) {
topRoot.setType(info.getType());
copyFound = true;
break;
@@ -357,6 +358,9 @@ public class SvnFileUrlMappingImpl implements SvnFileUrlMapping, PersistentState
if (svnStatus.getURL() == null) continue;
info.setUrl(svnStatus.getURL());
info.setFormat(WorkingCopyFormat.getInstance(svnStatus.getWorkingCopyFormat()));
if (svnStatus.getRepositoryRootURL() != null) {
info.setRootURL(svnStatus.getRepositoryRootURL());
}
}
catch (Exception e) {
continue;
@@ -365,7 +369,7 @@ public class SvnFileUrlMappingImpl implements SvnFileUrlMapping, PersistentState
for (RootUrlInfo topRoot : myTopRoots) {
if (VfsUtil.isAncestor(topRoot.getVirtualFile(), info.getFile(), true)) {
SVNURL repoRoot = info.getRootURL();
repoRoot = repoRoot == null ? myRepositoryRoots.ask(info.getUrl(), true) : repoRoot;
repoRoot = repoRoot == null ? myRepositoryRoots.ask(info.getUrl(), info.getFile()) : repoRoot;
if (repoRoot != null) {
final RootUrlInfo rootInfo = new RootUrlInfo(repoRoot, info.getUrl(), info.getFormat(), info.getFile(), topRoot.getRoot());
rootInfo.setType(info.getType());
@@ -380,6 +384,8 @@ public class SvnFileUrlMappingImpl implements SvnFileUrlMapping, PersistentState
myTopRoots.addAll(nestedRoots);
myApplier.apply(myVcs, myTopRoots, myLonelyRoots);
callback.run();
}
}, InvokeAfterUpdateMode.SILENT_CALLBACK_POOLED, null, new Consumer<VcsDirtyScopeManager>() {
public void consume(VcsDirtyScopeManager vcsDirtyScopeManager) {
@@ -404,22 +410,16 @@ public class SvnFileUrlMappingImpl implements SvnFileUrlMapping, PersistentState
myRoots.add(url);
}
public SVNURL ask(final SVNURL url, boolean allowRemote) {
public SVNURL ask(final SVNURL url, VirtualFile file) {
for (SVNURL root : myRoots) {
if (root.equals(SVNURLUtil.getCommonURLAncestor(root, url))) {
return root;
}
}
final SVNURL newUrl;
try {
newUrl = SvnUtil.getRepositoryRoot(myVcs, url, allowRemote);
if (newUrl != null) {
myRoots.add(newUrl);
return newUrl;
}
}
catch (SVNException e) {
//
final SVNURL newUrl = SvnUtil.getRepositoryRoot(myVcs, new File(file.getPath()));
if (newUrl != null) {
myRoots.add(newUrl);
return newUrl;
}
return null;
}
@@ -422,10 +422,6 @@ public class SvnUtil {
@Nullable
public static SVNURL getRepositoryRoot(final SvnVcs vcs, final SVNURL url, boolean allowRemote) throws SVNException {
final SVNWCClient client = vcs.createWCClient();
SVNInfo localInfo = client.doInfo(url, SVNRevision.UNDEFINED, SVNRevision.WORKING);
if (localInfo != null && localInfo.getRepositoryRootURL() != null || ! allowRemote) {
return localInfo == null ? null : localInfo.getRepositoryRootURL();
}
SVNInfo info = client.doInfo(url, SVNRevision.UNDEFINED, SVNRevision.HEAD);
return (info == null) ? null : info.getRepositoryRootURL();
}
@@ -29,7 +29,6 @@ import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.DumbAwareRunnable;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.startup.StartupManager;
@@ -263,7 +262,7 @@ public class SvnVcs extends AbstractVcs<CommittedChangeList> {
myVcsListener = new VcsListener() {
@Override
public void directoryMappingChanged() {
invokeRefreshSvnRoots(true);
invokeRefreshSvnRoots();
}
};
}
@@ -289,7 +288,7 @@ public class SvnVcs extends AbstractVcs<CommittedChangeList> {
public void postStartup() {
if (myProject.isDefault()) return;
myCopiesRefreshManager = new SvnCopiesRefreshManager(myProject, (SvnFileUrlMappingImpl) getSvnFileUrlMapping());
myCopiesRefreshManager = new SvnCopiesRefreshManager((SvnFileUrlMappingImpl) getSvnFileUrlMapping());
if (! myConfiguration.isCleanupRun()) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
@@ -299,54 +298,49 @@ public class SvnVcs extends AbstractVcs<CommittedChangeList> {
}
}, ModalityState.NON_MODAL, myProject.getDisposed());
} else {
invokeRefreshSvnRoots(true);
invokeRefreshSvnRoots();
}
myWorkingCopiesContent.activate();
}
private void cleanup17copies() {
new CleanupWorker(new VirtualFile[]{}, myProject, "action.Subversion.cleanup.progress.title") {
@Override
protected void chanceToFillRoots() {
myCopiesRefreshManager.getCopiesRefresh().synchRequest();
final List<WCInfo> infos = getAllWcInfos();
final LocalFileSystem lfs = LocalFileSystem.getInstance();
final List<VirtualFile> roots = new ArrayList<VirtualFile>(infos.size());
for (WCInfo info : infos) {
if (WorkingCopyFormat.ONE_DOT_SEVEN.equals(info.getFormat())) {
final VirtualFile file = lfs.refreshAndFindFileByIoFile(new File(info.getPath()));
if (file == null) {
LOG.info("Wasn't able to find virtual file for wc root: " + info.getPath());
} else {
roots.add(file);
final Runnable callCleanupWorker = new Runnable() {
public void run() {
new CleanupWorker(new VirtualFile[]{}, myProject, "action.Subversion.cleanup.progress.title") {
@Override
protected void chanceToFillRoots() {
final List<WCInfo> infos = getAllWcInfos();
final LocalFileSystem lfs = LocalFileSystem.getInstance();
final List<VirtualFile> roots = new ArrayList<VirtualFile>(infos.size());
for (WCInfo info : infos) {
if (WorkingCopyFormat.ONE_DOT_SEVEN.equals(info.getFormat())) {
final VirtualFile file = lfs.refreshAndFindFileByIoFile(new File(info.getPath()));
if (file == null) {
LOG.info("Wasn't able to find virtual file for wc root: " + info.getPath());
} else {
roots.add(file);
}
}
}
myRoots = roots.toArray(new VirtualFile[roots.size()]);
}
}
myRoots = roots.toArray(new VirtualFile[roots.size()]);
}.execute();
}
}.execute();
};
myCopiesRefreshManager.waitRefresh(new Runnable() {
@Override
public void run() {
callCleanupWorker.run();
}
});
}
public void invokeRefreshSvnRoots(final boolean asynchronous) {
public void invokeRefreshSvnRoots() {
REFRESH_LOG.debug("refresh: ", new Throwable());
if (myCopiesRefreshManager != null) {
if (asynchronous) {
myCopiesRefreshManager.getCopiesRefresh().asynchRequest();
}
else {
if (ApplicationManager.getApplication().isDispatchThread()) {
ProgressManager.getInstance().runProcessWithProgressSynchronously(new Runnable() {
@Override
public void run() {
myCopiesRefreshManager.getCopiesRefresh().synchRequest();
}
}, SvnBundle.message("refreshing.working.copies.roots.progress.text"), true, myProject);
}
else {
myCopiesRefreshManager.getCopiesRefresh().synchRequest();
}
}
myCopiesRefreshManager.asynchRequest();
}
}
@@ -171,7 +171,7 @@ public class ShareProjectAction extends BasicAction {
} catch (SVNException e) {
error[0] = e;
} finally {
activeVcs.invokeRefreshSvnRoots(true);
activeVcs.invokeRefreshSvnRoots();
SvnWorkingCopyFormatHolder.setPresetFormat(null);
}
}
@@ -154,7 +154,7 @@ public class CopiesPanel {
@Override
public void linkSelected(LinkLabel aSource, Object aLinkData) {
if (myRefreshLabel.isEnabled()) {
myVcs.invokeRefreshSvnRoots(true);
myVcs.invokeRefreshSvnRoots();
myRefreshLabel.setEnabled(false);
}
}
@@ -38,6 +38,7 @@ import com.intellij.openapi.vcs.VcsShowConfirmationOption;
import com.intellij.openapi.vcs.changes.*;
import com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx;
import com.intellij.openapi.vcs.update.CommonUpdateProjectAction;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.openapi.vfs.newvfs.BulkFileListener;
@@ -49,6 +50,7 @@ import com.intellij.testFramework.vcs.AbstractJunitVcsTestCase;
import com.intellij.testFramework.vcs.MockChangeListManagerGate;
import com.intellij.testFramework.vcs.MockChangelistBuilder;
import com.intellij.testFramework.vcs.TestClientRunner;
import com.intellij.util.concurrency.Semaphore;
import com.intellij.util.io.ZipUtil;
import com.intellij.util.ui.UIUtil;
import junit.framework.Assert;
@@ -85,6 +87,7 @@ public abstract class SvnTestCase extends AbstractJunitVcsTestCase {
private File myRepoRoot;
private File myWcRoot;
private ChangeListManagerGate myGate;
protected String myAnotherRepoUrl;
protected SvnTestCase(@NotNull String testDataDir) {
PlatformTestCase.initPlatformLangPrefix();
@@ -164,10 +167,8 @@ public abstract class SvnTestCase extends AbstractJunitVcsTestCase {
myGate = new MockChangeListManagerGate(ChangeListManager.getInstance(myProject));
final SvnVcs vcs = SvnVcs.getInstance(myProject);
((StartupManagerImpl) StartupManager.getInstance(myProject)).runPostStartupActivities();
((SvnFileUrlMappingImpl) vcs.getSvnFileUrlMapping()).realRefresh();
refreshSvnMappingsSynchronously();
}
catch (Exception e) {
throw new RuntimeException(e);
@@ -183,6 +184,19 @@ public abstract class SvnTestCase extends AbstractJunitVcsTestCase {
}
}
protected void refreshSvnMappingsSynchronously() {
final SvnVcs vcs = SvnVcs.getInstance(myProject);
final Semaphore semaphore = new Semaphore();
semaphore.down();
((SvnFileUrlMappingImpl) vcs.getSvnFileUrlMapping()).realRefresh(new Runnable() {
@Override
public void run() {
semaphore.up();
}
});
semaphore.waitFor();
}
@Override
protected void projectCreated() {
if (myUseNativeAcceleration) {
@@ -325,22 +339,29 @@ public abstract class SvnTestCase extends AbstractJunitVcsTestCase {
verify(runSvn("copy", "-q", "-m", "coppy", mainUrl, branchUrl));
clManager.forceGoInTestMode();
vcs.invokeRefreshSvnRoots(false);
clManager.ensureUpToDate(false);
clManager.ensureUpToDate(false);
refreshSvnMappingsSynchronously();
//clManager.ensureUpToDate(false);
//clManager.ensureUpToDate(false);
return branchUrl;
}
public void prepareExternal() throws Exception {
prepareExternal(true, true);
prepareExternal(true, true, false);
}
public void prepareExternal(final boolean commitExternalDefinition, final boolean updateExternal) throws Exception {
public void prepareExternal(final boolean commitExternalDefinition, final boolean updateExternal,
final boolean anotherRepository) throws Exception {
final ChangeListManagerImpl clManager = (ChangeListManagerImpl)ChangeListManager.getInstance(myProject);
final SvnVcs vcs = SvnVcs.getInstance(myProject);
final String mainUrl = myRepoUrl + "/root/source";
final String externalURL = myRepoUrl + "/root/target";
final String externalURL;
if (anotherRepository) {
createAnotherRepo();
externalURL = myAnotherRepoUrl + "/root/target";
} else {
externalURL = myRepoUrl + "/root/target";
}
final SubTree subTree = new SubTree(myWorkingCopyDir);
checkin();
@@ -374,9 +395,24 @@ public abstract class SvnTestCase extends AbstractJunitVcsTestCase {
// start change list manager again
clManager.forceGoInTestMode();
vcs.invokeRefreshSvnRoots(false);
clManager.ensureUpToDate(false);
clManager.ensureUpToDate(false);
refreshSvnMappingsSynchronously();
//clManager.ensureUpToDate(false);
//clManager.ensureUpToDate(false);
}
private void createAnotherRepo() throws Exception {
final File repo = FileUtil.createTempDirectory("anotherRepo", "");
FileUtil.delete(repo);
FileUtil.copyDir(myRepoRoot, repo);
myAnotherRepoUrl = (SystemInfo.isWindows ? "file:///" : "file://") + FileUtil.toSystemIndependentName(repo.getPath());
final File tmpWc = FileUtil.createTempDirectory("hhh", "");
verify(runSvn("co", myAnotherRepoUrl, tmpWc.getPath()));
final VirtualFile tmpWcVf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(tmpWc);
Assert.assertNotNull(tmpWcVf);
final SubTree tree = new SubTree(tmpWcVf);
verify(myRunner.runClient("svn", null, tmpWc, "add", "root"));
verify(myRunner.runClient("svn", null, tmpWc, "ci", "-m", "fff"));
FileUtil.delete(tmpWc);
}
protected static void imitUpdate(final Project project) {
@@ -57,7 +57,7 @@ public class SvnCommittedViewTest extends Svn17TestCase {
checkin();
final SvnVcs vcs = SvnVcs.getInstance(myProject);
vcs.invokeRefreshSvnRoots(false);
vcs.invokeRefreshSvnRoots();
final CommittedChangesProvider<SvnChangeList,ChangeBrowserSettings> committedChangesProvider = vcs.getCommittedChangesProvider();
final List<SvnChangeList> changeListList =
committedChangesProvider.getCommittedChanges(committedChangesProvider.createDefaultSettings(),
@@ -89,7 +89,7 @@ public class SvnCommittedViewTest extends Svn17TestCase {
checkin();
final SvnVcs vcs = SvnVcs.getInstance(myProject);
vcs.invokeRefreshSvnRoots(false);
vcs.invokeRefreshSvnRoots();
final CommittedChangesProvider<SvnChangeList,ChangeBrowserSettings> committedChangesProvider = vcs.getCommittedChangesProvider();
final List<SvnChangeList> changeListList =
committedChangesProvider.getCommittedChanges(committedChangesProvider.createDefaultSettings(),
@@ -121,7 +121,7 @@ public class SvnCommittedViewTest extends Svn17TestCase {
checkin();
final SvnVcs vcs = SvnVcs.getInstance(myProject);
vcs.invokeRefreshSvnRoots(false);
vcs.invokeRefreshSvnRoots();
final CommittedChangesProvider<SvnChangeList,ChangeBrowserSettings> committedChangesProvider = vcs.getCommittedChangesProvider();
final List<SvnChangeList> changeListList =
committedChangesProvider.getCommittedChanges(committedChangesProvider.createDefaultSettings(),
@@ -150,7 +150,7 @@ public class SvnCommittedViewTest extends Svn17TestCase {
checkin();
final SvnVcs vcs = SvnVcs.getInstance(myProject);
vcs.invokeRefreshSvnRoots(false);
vcs.invokeRefreshSvnRoots();
final CommittedChangesProvider<SvnChangeList,ChangeBrowserSettings> committedChangesProvider = vcs.getCommittedChangesProvider();
final List<SvnChangeList> changeListList =
committedChangesProvider.getCommittedChanges(committedChangesProvider.createDefaultSettings(),
@@ -182,7 +182,7 @@ public class SvnCommittedViewTest extends Svn17TestCase {
checkin();
final SvnVcs vcs = SvnVcs.getInstance(myProject);
vcs.invokeRefreshSvnRoots(false);
vcs.invokeRefreshSvnRoots();
final CommittedChangesProvider<SvnChangeList,ChangeBrowserSettings> committedChangesProvider = vcs.getCommittedChangesProvider();
final List<SvnChangeList> changeListList =
committedChangesProvider.getCommittedChanges(committedChangesProvider.createDefaultSettings(),
@@ -207,7 +207,7 @@ public class SvnCommittedViewTest extends Svn17TestCase {
verify(runSvn("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch"));
final SvnVcs vcs = SvnVcs.getInstance(myProject);
vcs.invokeRefreshSvnRoots(false);
vcs.invokeRefreshSvnRoots();
final CommittedChangesProvider<SvnChangeList,ChangeBrowserSettings> committedChangesProvider = vcs.getCommittedChangesProvider();
final List<SvnChangeList> changeListList =
committedChangesProvider.getCommittedChanges(committedChangesProvider.createDefaultSettings(),
@@ -237,7 +237,7 @@ public class SvnCommittedViewTest extends Svn17TestCase {
checkin();
final SvnVcs vcs = SvnVcs.getInstance(myProject);
vcs.invokeRefreshSvnRoots(false);
vcs.invokeRefreshSvnRoots();
final CommittedChangesProvider<SvnChangeList,ChangeBrowserSettings> committedChangesProvider = vcs.getCommittedChangesProvider();
final List<SvnChangeList> changeListList =
committedChangesProvider.getCommittedChanges(committedChangesProvider.createDefaultSettings(),
@@ -134,7 +134,7 @@ public class SvnExternalCommitNoticedTest extends Svn17TestCase {
final String branchUrl = prepareBranchesStructure();
final SubTree tree = new SubTree(myWorkingCopyDir);
myVcs.invokeRefreshSvnRoots(false);
myVcs.invokeRefreshSvnRoots();
clManager.ensureUpToDate(false);
clManager.ensureUpToDate(false);
SvnFileUrlMapping workingCopies = myVcs.getSvnFileUrlMapping();
@@ -64,12 +64,25 @@ public class SvnExternalTests extends Svn17TestCase {
@Test
public void testExternalCopyIsDetected() throws Exception {
prepareExternal();
externalCopyIsDetectedImpl();
}
@Test
public void testExternalCopyIsDetectedAnotherRepo() throws Exception {
prepareExternal(true, true, true);
externalCopyIsDetectedImpl();
}
private void externalCopyIsDetectedImpl() {
final SvnFileUrlMapping workingCopies = myVcs.getSvnFileUrlMapping();
final List<RootUrlInfo> infos = workingCopies.getAllWcInfos();
Assert.assertEquals(2, infos.size());
final Set<String> expectedUrls = new HashSet<String>();
expectedUrls.add(StringUtil.toLowerCase(myExternalURL));
if (myAnotherRepoUrl != null) {
expectedUrls.add(StringUtil.toLowerCase(myAnotherRepoUrl + "/root/target"));
} else {
expectedUrls.add(StringUtil.toLowerCase(myExternalURL));
}
expectedUrls.add(StringUtil.toLowerCase(myMainUrl));
for (RootUrlInfo info : infos) {
@@ -100,9 +113,9 @@ public class SvnExternalTests extends Svn17TestCase {
// start change list manager again
clManager.forceGoInTestMode();
myVcs.invokeRefreshSvnRoots(false);
clManager.ensureUpToDate(false);
clManager.ensureUpToDate(false);
refreshSvnMappingsSynchronously();
//clManager.ensureUpToDate(false);
//clManager.ensureUpToDate(false);
}
@Test
@@ -128,6 +141,16 @@ public class SvnExternalTests extends Svn17TestCase {
@Test
public void testSimpleExternalsStatus() throws Exception {
prepareExternal();
simpleExternalStatusImpl();
}
@Test
public void testSimpleExternalsAnotherStatus() throws Exception {
prepareExternal(true, true, true);
simpleExternalStatusImpl();
}
private void simpleExternalStatusImpl() {
final File sourceFile = new File(myWorkingCopyDir.getPath(), "source" + File.separator + "s1.txt");
final File externalFile = new File(myWorkingCopyDir.getPath(), "source" + File.separator + "external" + File.separator + "t12.txt");
@@ -159,7 +182,17 @@ public class SvnExternalTests extends Svn17TestCase {
@Test
public void testUpdatedCreatedExternalFromIDEA() throws Exception {
prepareExternal(false, false);
prepareExternal(false, false, false);
updatedCreatedExternalFromIDEAImpl();
}
@Test
public void testUpdatedCreatedExternalFromIDEAAnother() throws Exception {
prepareExternal(false, false, true);
updatedCreatedExternalFromIDEAImpl();
}
private void updatedCreatedExternalFromIDEAImpl() {
final File sourceDir = new File(myWorkingCopyDir.getPath(), "source");
ProjectLevelVcsManager.getInstance(myProject).setDirectoryMappings(
Arrays.asList(new VcsDirectoryMapping(FileUtil.toSystemIndependentName(sourceDir.getPath()), myVcs.getName())));
@@ -172,8 +205,17 @@ public class SvnExternalTests extends Svn17TestCase {
@Test
public void testUncommittedExternalStatus() throws Exception {
prepareExternal(false, true);
prepareExternal(false, true, false);
uncommittedExternalStatusImpl();
}
@Test
public void testUncommittedExternalStatusAnother() throws Exception {
prepareExternal(false, true, true);
uncommittedExternalStatusImpl();
}
private void uncommittedExternalStatusImpl() {
final File sourceDir = new File(myWorkingCopyDir.getPath(), "source");
final File externalFile = new File(sourceDir, "external/t11.txt");
final VirtualFile externalVf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(externalFile);
@@ -190,25 +232,23 @@ public class SvnExternalTests extends Svn17TestCase {
@Test
public void testUncommittedExternalCopyIsDetected() throws Exception {
prepareExternal(false, false);
prepareExternal(false, false, false);
uncommittedExternalCopyIsDetectedImpl();
}
@Test
public void testUncommittedExternalCopyIsDetectedAnother() throws Exception {
prepareExternal(false, false, true);
uncommittedExternalCopyIsDetectedImpl();
}
private void uncommittedExternalCopyIsDetectedImpl() {
final File sourceDir = new File(myWorkingCopyDir.getPath(), "source");
ProjectLevelVcsManager.getInstance(myProject).setDirectoryMappings(
Arrays.asList(new VcsDirectoryMapping(FileUtil.toSystemIndependentName(sourceDir.getPath()), myVcs.getName())));
imitUpdate(myProject);
myVcs.invokeRefreshSvnRoots(false);
clManager.ensureUpToDate(false);
clManager.ensureUpToDate(false);
refreshSvnMappingsSynchronously();
final SvnFileUrlMapping workingCopies = myVcs.getSvnFileUrlMapping();
final List<RootUrlInfo> infos = workingCopies.getAllWcInfos();
Assert.assertEquals(2, infos.size());
final Set<String> expectedUrls = new HashSet<String>();
expectedUrls.add(StringUtil.toLowerCase(myExternalURL));
expectedUrls.add(StringUtil.toLowerCase(myMainUrl));
for (RootUrlInfo info : infos) {
expectedUrls.remove(StringUtil.toLowerCase(info.getAbsoluteUrl()));
}
Assert.assertTrue(expectedUrls.isEmpty());
externalCopyIsDetectedImpl();
}
}
@@ -59,7 +59,7 @@ public class SvnCommittedViewTest extends Svn16TestCase {
checkin();
final SvnVcs vcs = SvnVcs.getInstance(myProject);
vcs.invokeRefreshSvnRoots(false);
vcs.invokeRefreshSvnRoots();
final CommittedChangesProvider<SvnChangeList,ChangeBrowserSettings> committedChangesProvider = vcs.getCommittedChangesProvider();
final List<SvnChangeList> changeListList =
committedChangesProvider.getCommittedChanges(committedChangesProvider.createDefaultSettings(),
@@ -91,7 +91,7 @@ public class SvnCommittedViewTest extends Svn16TestCase {
checkin();
final SvnVcs vcs = SvnVcs.getInstance(myProject);
vcs.invokeRefreshSvnRoots(false);
vcs.invokeRefreshSvnRoots();
final CommittedChangesProvider<SvnChangeList,ChangeBrowserSettings> committedChangesProvider = vcs.getCommittedChangesProvider();
final List<SvnChangeList> changeListList =
committedChangesProvider.getCommittedChanges(committedChangesProvider.createDefaultSettings(),
@@ -120,7 +120,7 @@ public class SvnCommittedViewTest extends Svn16TestCase {
checkin();
final SvnVcs vcs = SvnVcs.getInstance(myProject);
vcs.invokeRefreshSvnRoots(false);
vcs.invokeRefreshSvnRoots();
final CommittedChangesProvider<SvnChangeList,ChangeBrowserSettings> committedChangesProvider = vcs.getCommittedChangesProvider();
final List<SvnChangeList> changeListList =
committedChangesProvider.getCommittedChanges(committedChangesProvider.createDefaultSettings(),
@@ -149,7 +149,7 @@ public class SvnCommittedViewTest extends Svn16TestCase {
checkin();
final SvnVcs vcs = SvnVcs.getInstance(myProject);
vcs.invokeRefreshSvnRoots(false);
vcs.invokeRefreshSvnRoots();
final CommittedChangesProvider<SvnChangeList,ChangeBrowserSettings> committedChangesProvider = vcs.getCommittedChangesProvider();
final List<SvnChangeList> changeListList =
committedChangesProvider.getCommittedChanges(committedChangesProvider.createDefaultSettings(),
@@ -181,7 +181,7 @@ public class SvnCommittedViewTest extends Svn16TestCase {
checkin();
final SvnVcs vcs = SvnVcs.getInstance(myProject);
vcs.invokeRefreshSvnRoots(false);
vcs.invokeRefreshSvnRoots();
final CommittedChangesProvider<SvnChangeList,ChangeBrowserSettings> committedChangesProvider = vcs.getCommittedChangesProvider();
final List<SvnChangeList> changeListList =
committedChangesProvider.getCommittedChanges(committedChangesProvider.createDefaultSettings(),
@@ -206,7 +206,7 @@ public class SvnCommittedViewTest extends Svn16TestCase {
verify(runSvn("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch"));
final SvnVcs vcs = SvnVcs.getInstance(myProject);
vcs.invokeRefreshSvnRoots(false);
vcs.invokeRefreshSvnRoots();
final CommittedChangesProvider<SvnChangeList,ChangeBrowserSettings> committedChangesProvider = vcs.getCommittedChangesProvider();
final List<SvnChangeList> changeListList =
committedChangesProvider.getCommittedChanges(committedChangesProvider.createDefaultSettings(),
@@ -236,7 +236,7 @@ public class SvnCommittedViewTest extends Svn16TestCase {
checkin();
final SvnVcs vcs = SvnVcs.getInstance(myProject);
vcs.invokeRefreshSvnRoots(false);
vcs.invokeRefreshSvnRoots();
final CommittedChangesProvider<SvnChangeList,ChangeBrowserSettings> committedChangesProvider = vcs.getCommittedChangesProvider();
final List<SvnChangeList> changeListList =
committedChangesProvider.getCommittedChanges(committedChangesProvider.createDefaultSettings(),
@@ -138,7 +138,7 @@ public class SvnExternalCommitNoticedTest extends Svn17TestCase {
final String branchUrl = prepareBranchesStructure();
final SubTree tree = new SubTree(myWorkingCopyDir);
myVcs.invokeRefreshSvnRoots(false);
myVcs.invokeRefreshSvnRoots();
clManager.ensureUpToDate(false);
clManager.ensureUpToDate(false);
SvnFileUrlMapping workingCopies = myVcs.getSvnFileUrlMapping();
@@ -97,9 +97,9 @@ public class SvnExternalTests extends Svn17TestCase {
// start change list manager again
clManager.forceGoInTestMode();
myVcs.invokeRefreshSvnRoots(false);
clManager.ensureUpToDate(false);
clManager.ensureUpToDate(false);
refreshSvnMappingsSynchronously();
//clManager.ensureUpToDate(false);
//clManager.ensureUpToDate(false);
}
@Test