From f8df1a2f0ea50ee5479f87a79b190835f4988db5 Mon Sep 17 00:00:00 2001 From: Konstantin Kolosovsky Date: Mon, 25 Jun 2018 19:04:43 +0300 Subject: [PATCH] svn: Provide common "SvnVcs" field in "SvnTestCase" --- .../jetbrains/idea/svn/ConflictCreator.java | 14 +++++------ .../org/jetbrains/idea/svn/SvnAddTest.java | 2 +- .../idea/svn/SvnAnnotationIsClosedTest.java | 24 +++++++++---------- .../idea/svn/SvnCommandLineStabilityTest.java | 1 - .../org/jetbrains/idea/svn/SvnCommitTest.java | 8 +++---- .../idea/svn/SvnCommittedViewTest.java | 7 ------ .../svn/SvnExternalCommitNoticedTest.java | 8 +++---- .../jetbrains/idea/svn/SvnExternalTest.java | 8 +++---- .../jetbrains/idea/svn/SvnHistoryTest.java | 10 ++++---- .../org/jetbrains/idea/svn/SvnIgnoreTest.java | 8 +++---- .../jetbrains/idea/svn/SvnMergeInfoTest.java | 13 ++++------ .../idea/svn/SvnNativeClientAuthTest.java | 18 +++++++------- .../idea/svn/SvnNativeListsTest.java | 2 +- .../jetbrains/idea/svn/SvnProtocolsTest.java | 19 +++++++-------- .../jetbrains/idea/svn/SvnQuickMergeTest.java | 20 +++++++--------- .../org/jetbrains/idea/svn/SvnRenameTest.java | 8 +++---- .../svn/SvnResolveTreeAcceptVariantsTest.java | 20 +++++++--------- .../jetbrains/idea/svn/SvnRollbackTest.java | 15 +++++------- .../org/jetbrains/idea/svn/SvnTestCase.java | 8 +++---- .../idea/svn/SvnTreeConflictDataTest.java | 4 ++-- .../idea/svn/history/FirstInBranchTest.java | 10 +++----- 21 files changed, 94 insertions(+), 133 deletions(-) diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/ConflictCreator.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/ConflictCreator.java index 922a14977ec4..e81e18148d78 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/ConflictCreator.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/ConflictCreator.java @@ -3,7 +3,6 @@ package org.jetbrains.idea.svn; import com.intellij.openapi.diff.impl.patch.*; import com.intellij.openapi.diff.impl.patch.formove.PatchApplier; -import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.vcs.changes.LocalChangeList; @@ -24,18 +23,18 @@ import java.util.List; import static org.junit.Assert.assertEquals; public class ConflictCreator { - private final Project myProject; + private final SvnVcs myVcs; private final VirtualFile myTheirsDir; private final VirtualFile myMineDir; private final TreeConflictData.Data myData; private final SvnClientRunner myClientRunner; - public ConflictCreator(final Project project, + public ConflictCreator(SvnVcs vcs, VirtualFile dir, VirtualFile mineDir, TreeConflictData.Data data, final SvnClientRunner clientRunner) { - myProject = project; + myVcs = vcs; myTheirsDir = dir; myMineDir = mineDir; myData = data; @@ -60,7 +59,8 @@ public class ConflictCreator { } if (! filePatchList.isEmpty()) { - PatchApplier applier = new PatchApplier<>(myProject, myTheirsDir, filePatchList, (LocalChangeList)null, null); + PatchApplier applier = + new PatchApplier<>(myVcs.getProject(), myTheirsDir, filePatchList, (LocalChangeList)null, null); applier.setIgnoreContentRootsCheck(); applier.execute(); assertEquals(0, applier.getRemainingPatches().size()); @@ -68,8 +68,6 @@ public class ConflictCreator { TimeoutUtil.sleep(10); - SvnVcs vcs = SvnVcs.getInstance(myProject); - for (TextFilePatch patch : patches) { if (patch.isNewFile() || ! Comparing.equal(patch.getAfterName(), patch.getBeforeName())) { final String afterName = patch.getAfterName(); @@ -77,7 +75,7 @@ public class ConflictCreator { String subPath = ""; for (String part : parts) { final String path = subPath + part; - Info info = vcs.getInfo(new File(myTheirsDir.getPath(), path)); + Info info = myVcs.getInfo(new File(myTheirsDir.getPath(), path)); if (info == null || info.getURL() == null) { myClientRunner.add(myTheirsDir, path); } diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnAddTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnAddTest.java index 46572f857239..6f935c6c9129 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnAddTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnAddTest.java @@ -55,7 +55,7 @@ public class SvnAddTest extends SvnTestCase { final List files = new ArrayList<>(); files.add(file); files.add(dir); - final List errors = SvnVcs.getInstance(myProject).getCheckinEnvironment().scheduleUnversionedFilesForAddition(files); + final List errors = vcs.getCheckinEnvironment().scheduleUnversionedFilesForAddition(files); Assert.assertEquals(0, errors.size()); } diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnAnnotationIsClosedTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnAnnotationIsClosedTest.java index c54dc5b0008c..7a6f86c0b80c 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnAnnotationIsClosedTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnAnnotationIsClosedTest.java @@ -25,7 +25,6 @@ import static org.junit.Assert.*; public class SvnAnnotationIsClosedTest extends SvnTestCase { private volatile boolean myIsClosed; private volatile boolean myIsClosed1; - private SvnVcs myVcs; private ChangeListManager myChangeListManager; private VcsDirtyScopeManager myDirtyScopeManager; @@ -33,7 +32,6 @@ public class SvnAnnotationIsClosedTest extends SvnTestCase { @Before public void setUp() throws Exception { super.setUp(); - myVcs = SvnVcs.getInstance(myProject); myChangeListManager = ChangeListManager.getInstance(myProject); myDirtyScopeManager = VcsDirtyScopeManager.getInstance(myProject); enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD); @@ -52,7 +50,7 @@ public class SvnAnnotationIsClosedTest extends SvnTestCase { checkin(); final VcsAnnotationLocalChangesListener listener = ProjectLevelVcsManager.getInstance(myProject).getAnnotationLocalChangesListener(); - final FileAnnotation annotation = createTestAnnotation(myVcs.getAnnotationProvider(), tree.myS1File); + final FileAnnotation annotation = createTestAnnotation(vcs.getAnnotationProvider(), tree.myS1File); annotation.setCloser(() -> { myIsClosed = true; listener.unregisterAnnotation(tree.myS1File, annotation); @@ -67,7 +65,7 @@ public class SvnAnnotationIsClosedTest extends SvnTestCase { final Change change = myChangeListManager.getChange(tree.myS1File); assertNotNull(change); - final List exceptions = myVcs.getCheckinEnvironment().commit(Collections.singletonList(change), "commit"); + final List exceptions = vcs.getCheckinEnvironment().commit(Collections.singletonList(change), "commit"); assertTrue(exceptions == null || exceptions.isEmpty()); myDirtyScopeManager.fileDirty(tree.myS1File); @@ -88,7 +86,7 @@ public class SvnAnnotationIsClosedTest extends SvnTestCase { runInAndVerifyIgnoreOutput("up", "-r", "2"); final VcsAnnotationLocalChangesListener listener = ProjectLevelVcsManager.getInstance(myProject).getAnnotationLocalChangesListener(); - final FileAnnotation annotation = createTestAnnotation(myVcs.getAnnotationProvider(), tree.myS1File); + final FileAnnotation annotation = createTestAnnotation(vcs.getAnnotationProvider(), tree.myS1File); annotation.setCloser(() -> { myIsClosed = true; listener.unregisterAnnotation(tree.myS1File, annotation); @@ -113,7 +111,7 @@ public class SvnAnnotationIsClosedTest extends SvnTestCase { runInAndVerifyIgnoreOutput("up", "-r", "2"); // take #2 final VcsAnnotationLocalChangesListener listener = ProjectLevelVcsManager.getInstance(myProject).getAnnotationLocalChangesListener(); - final FileAnnotation annotation = createTestAnnotation(myVcs.getAnnotationProvider(), tree.myS1File); + final FileAnnotation annotation = createTestAnnotation(vcs.getAnnotationProvider(), tree.myS1File); annotation.setCloser(() -> { myIsClosed = true; listener.unregisterAnnotation(tree.myS1File, annotation); @@ -140,7 +138,7 @@ public class SvnAnnotationIsClosedTest extends SvnTestCase { runInAndVerifyIgnoreOutput("up", "-r", "2"); // take #2 final VcsAnnotationLocalChangesListener listener = ProjectLevelVcsManager.getInstance(myProject).getAnnotationLocalChangesListener(); - final FileAnnotation annotation = createTestAnnotation(myVcs.getAnnotationProvider(), tree.myS1File); + final FileAnnotation annotation = createTestAnnotation(vcs.getAnnotationProvider(), tree.myS1File); annotation.setCloser(() -> { myIsClosed = true; listener.unregisterAnnotation(tree.myS1File, annotation); @@ -172,7 +170,7 @@ public class SvnAnnotationIsClosedTest extends SvnTestCase { checkin(); final VcsAnnotationLocalChangesListener listener = ProjectLevelVcsManager.getInstance(myProject).getAnnotationLocalChangesListener(); - final FileAnnotation annotation = createTestAnnotation(myVcs.getAnnotationProvider(), tree.myS1File); + final FileAnnotation annotation = createTestAnnotation(vcs.getAnnotationProvider(), tree.myS1File); annotation.setCloser(() -> { myIsClosed = true; listener.unregisterAnnotation(tree.myS1File, annotation); @@ -201,7 +199,7 @@ public class SvnAnnotationIsClosedTest extends SvnTestCase { VcsTestUtil.editFileInCommand(myProject, tree.myS1File, "1\n2\n3**\n4++\n"); final VcsAnnotationLocalChangesListener listener = ProjectLevelVcsManager.getInstance(myProject).getAnnotationLocalChangesListener(); - final FileAnnotation annotation = createTestAnnotation(myVcs.getAnnotationProvider(), tree.myS1File); + final FileAnnotation annotation = createTestAnnotation(vcs.getAnnotationProvider(), tree.myS1File); annotation.setCloser(() -> { myIsClosed = true; listener.unregisterAnnotation(tree.myS1File, annotation); @@ -226,7 +224,7 @@ public class SvnAnnotationIsClosedTest extends SvnTestCase { checkin(); //#3 final VcsAnnotationLocalChangesListener listener = ProjectLevelVcsManager.getInstance(myProject).getAnnotationLocalChangesListener(); - final FileAnnotation annotation = createTestAnnotation(myVcs.getAnnotationProvider(), tree.myS1File); + final FileAnnotation annotation = createTestAnnotation(vcs.getAnnotationProvider(), tree.myS1File); annotation.setCloser(() -> { myIsClosed = true; listener.unregisterAnnotation(tree.myS1File, annotation); @@ -281,7 +279,7 @@ public class SvnAnnotationIsClosedTest extends SvnTestCase { VcsTestUtil.editFileInCommand(myProject, vf2, "test externals 12344444" + System.currentTimeMillis()); runInAndVerifyIgnoreOutput("ci", "-m", "test", externalDir.getPath()); // #5 - final SvnDiffProvider diffProvider = (SvnDiffProvider) myVcs.getDiffProvider(); + final SvnDiffProvider diffProvider = (SvnDiffProvider)vcs.getDiffProvider(); assertRevision(vf1, diffProvider, 3); assertRevision(vf2, diffProvider, 5); @@ -294,14 +292,14 @@ public class SvnAnnotationIsClosedTest extends SvnTestCase { // then annotate both final VcsAnnotationLocalChangesListener listener = ProjectLevelVcsManager.getInstance(myProject).getAnnotationLocalChangesListener(); - final FileAnnotation annotation = createTestAnnotation(myVcs.getAnnotationProvider(), vf1); + final FileAnnotation annotation = createTestAnnotation(vcs.getAnnotationProvider(), vf1); annotation.setCloser(() -> { myIsClosed = true; listener.unregisterAnnotation(vf1, annotation); }); listener.registerAnnotation(vf1, annotation); - final FileAnnotation annotation1 = createTestAnnotation(myVcs.getAnnotationProvider(), vf2); + final FileAnnotation annotation1 = createTestAnnotation(vcs.getAnnotationProvider(), vf2); annotation1.setCloser(() -> { myIsClosed1 = true; listener.unregisterAnnotation(vf1, annotation1); diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCommandLineStabilityTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCommandLineStabilityTest.java index 2847993b4f91..78680e0e0be1 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCommandLineStabilityTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCommandLineStabilityTest.java @@ -33,7 +33,6 @@ public class SvnCommandLineStabilityTest extends SvnTestCase { @NotNull private CommandExecutor runInfo() throws SvnBindException { - SvnVcs vcs = SvnVcs.getInstance(myProject); File workingDirectory = VfsUtilCore.virtualToIoFile(myWorkingCopyDir); Command command = new Command(SvnCommandName.info); diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCommitTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCommitTest.java index 27394908cd96..a4cfd8f3fccf 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCommitTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCommitTest.java @@ -24,7 +24,6 @@ import java.util.List; import static org.junit.Assert.*; public class SvnCommitTest extends SvnTestCase { - private SvnVcs myVcs; private VcsDirtyScopeManager myDirtyScopeManager; private ChangeListManager myChangeListManager; @@ -32,7 +31,6 @@ public class SvnCommitTest extends SvnTestCase { @Before public void setUp() throws Exception { super.setUp(); - myVcs = SvnVcs.getInstance(myProject); myDirtyScopeManager = VcsDirtyScopeManager.getInstance(myProject); myChangeListManager = ChangeListManager.getInstance(myProject); } @@ -203,7 +201,7 @@ public class SvnCommitTest extends SvnTestCase { assertNotNull(change); changes.add(change); } - final List exceptions = myVcs.getCheckinEnvironment().commit(changes, "test comment list"); + final List exceptions = vcs.getCheckinEnvironment().commit(changes, "test comment list"); assertTrue(exceptions == null || exceptions.isEmpty()); myDirtyScopeManager.markEverythingDirty(); myChangeListManager.ensureUpToDate(false); @@ -222,7 +220,7 @@ public class SvnCommitTest extends SvnTestCase { changes.add(change); } final HashSet feedback = new HashSet<>(); - final List exceptions = myVcs.getCheckinEnvironment().commit(changes, "test comment list", o -> null, feedback); + final List exceptions = vcs.getCheckinEnvironment().commit(changes, "test comment list", o -> null, feedback); if (exceptions !=null && ! exceptions.isEmpty()) { exceptions.get(0).printStackTrace(); } @@ -241,7 +239,7 @@ public class SvnCommitTest extends SvnTestCase { final Change change = myChangeListManager.getChange(file); assertNotNull(change); assertEquals(status, change.getFileStatus()); - final List exceptions = myVcs.getCheckinEnvironment().commit(Collections.singletonList(change), "test comment"); + final List exceptions = vcs.getCheckinEnvironment().commit(Collections.singletonList(change), "test comment"); assertTrue(exceptions == null || exceptions.isEmpty()); myDirtyScopeManager.markEverythingDirty(); myChangeListManager.ensureUpToDate(false); diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCommittedViewTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCommittedViewTest.java index 4071af2fa652..6a196b7da464 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCommittedViewTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCommittedViewTest.java @@ -39,7 +39,6 @@ public class SvnCommittedViewTest extends SvnTestCase { // r1, addition without history checkin(); - final SvnVcs vcs = SvnVcs.getInstance(myProject); vcs.invokeRefreshSvnRoots(); final CommittedChangesProvider committedChangesProvider = vcs.getCommittedChangesProvider(); final List changeListList = @@ -71,7 +70,6 @@ public class SvnCommittedViewTest extends SvnTestCase { checkin(); - final SvnVcs vcs = SvnVcs.getInstance(myProject); vcs.invokeRefreshSvnRoots(); final CommittedChangesProvider committedChangesProvider = vcs.getCommittedChangesProvider(); final List changeListList = @@ -103,7 +101,6 @@ public class SvnCommittedViewTest extends SvnTestCase { checkin(); - final SvnVcs vcs = SvnVcs.getInstance(myProject); vcs.invokeRefreshSvnRoots(); final CommittedChangesProvider committedChangesProvider = vcs.getCommittedChangesProvider(); final List changeListList = @@ -132,7 +129,6 @@ public class SvnCommittedViewTest extends SvnTestCase { checkin(); - final SvnVcs vcs = SvnVcs.getInstance(myProject); vcs.invokeRefreshSvnRoots(); final CommittedChangesProvider committedChangesProvider = vcs.getCommittedChangesProvider(); final List changeListList = @@ -164,7 +160,6 @@ public class SvnCommittedViewTest extends SvnTestCase { checkin(); - final SvnVcs vcs = SvnVcs.getInstance(myProject); vcs.invokeRefreshSvnRoots(); final CommittedChangesProvider committedChangesProvider = vcs.getCommittedChangesProvider(); final List changeListList = @@ -189,7 +184,6 @@ public class SvnCommittedViewTest extends SvnTestCase { runInAndVerifyIgnoreOutput("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk"); runInAndVerifyIgnoreOutput("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch"); - final SvnVcs vcs = SvnVcs.getInstance(myProject); vcs.invokeRefreshSvnRoots(); final CommittedChangesProvider committedChangesProvider = vcs.getCommittedChangesProvider(); final List changeListList = @@ -219,7 +213,6 @@ public class SvnCommittedViewTest extends SvnTestCase { checkin(); - final SvnVcs vcs = SvnVcs.getInstance(myProject); vcs.invokeRefreshSvnRoots(); final CommittedChangesProvider committedChangesProvider = vcs.getCommittedChangesProvider(); final List changeListList = diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnExternalCommitNoticedTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnExternalCommitNoticedTest.java index aedb40503564..daaa9641536e 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnExternalCommitNoticedTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnExternalCommitNoticedTest.java @@ -21,7 +21,6 @@ import static org.jetbrains.idea.svn.SvnUtil.parseUrl; public class SvnExternalCommitNoticedTest extends SvnTestCase { private ChangeListManagerImpl clManager; - private SvnVcs myVcs; private VcsDirtyScopeManager myVcsDirtyScopeManager; @Override @@ -35,7 +34,6 @@ public class SvnExternalCommitNoticedTest extends SvnTestCase { enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD); enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE); - myVcs = SvnVcs.getInstance(myProject); } @Test @@ -110,10 +108,10 @@ public class SvnExternalCommitNoticedTest extends SvnTestCase { final String branchUrl = prepareBranchesStructure(); final SubTree tree = new SubTree(myWorkingCopyDir); - myVcs.invokeRefreshSvnRoots(); + vcs.invokeRefreshSvnRoots(); clManager.ensureUpToDate(false); clManager.ensureUpToDate(false); - SvnFileUrlMapping workingCopies = myVcs.getSvnFileUrlMapping(); + SvnFileUrlMapping workingCopies = vcs.getSvnFileUrlMapping(); List infos = workingCopies.getAllWcInfos(); Assert.assertEquals(1, infos.size()); Assert.assertEquals(parseUrl(myRepoUrl + "/trunk", false), infos.get(0).getUrl()); @@ -127,7 +125,7 @@ public class SvnExternalCommitNoticedTest extends SvnTestCase { clManager.ensureUpToDate(false); clManager.ensureUpToDate(false); //first run queries one more update - workingCopies = myVcs.getSvnFileUrlMapping(); + workingCopies = vcs.getSvnFileUrlMapping(); infos = workingCopies.getAllWcInfos(); Assert.assertEquals(1, infos.size()); Assert.assertEquals(parseUrl(branchUrl, false), infos.get(0).getUrl()); diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnExternalTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnExternalTest.java index 4c84623fb828..bde1b4d1c693 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnExternalTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnExternalTest.java @@ -24,7 +24,6 @@ import static org.junit.Assert.*; public class SvnExternalTest extends SvnTestCase { private ChangeListManagerImpl clManager; - private SvnVcs myVcs; private Url myMainUrl; private Url myExternalURL; @@ -36,7 +35,6 @@ public class SvnExternalTest extends SvnTestCase { enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD); enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE); - myVcs = SvnVcs.getInstance(myProject); myMainUrl = parseUrl(myRepoUrl + "/root/source", false); myExternalURL = parseUrl(myRepoUrl + "/root/target", false); } @@ -54,7 +52,7 @@ public class SvnExternalTest extends SvnTestCase { } private void externalCopyIsDetectedImpl() { - final SvnFileUrlMapping workingCopies = myVcs.getSvnFileUrlMapping(); + final SvnFileUrlMapping workingCopies = vcs.getSvnFileUrlMapping(); final List infos = workingCopies.getAllWcInfos(); assertEquals(2, infos.size()); Set expectedUrls = new HashSet<>(); @@ -79,7 +77,7 @@ public class SvnExternalTest extends SvnTestCase { public void testInnerCopyDetected() throws Exception { prepareInnerCopy(); - final SvnFileUrlMapping workingCopies = myVcs.getSvnFileUrlMapping(); + final SvnFileUrlMapping workingCopies = vcs.getSvnFileUrlMapping(); final List infos = workingCopies.getAllWcInfos(); assertEquals(2, infos.size()); Set expectedUrls = new HashSet<>(); @@ -161,7 +159,7 @@ public class SvnExternalTest extends SvnTestCase { private void setNewDirectoryMappings(final File sourceDir) { UIUtil.invokeAndWaitIfNeeded((Runnable)() -> ProjectLevelVcsManager.getInstance(myProject).setDirectoryMappings( - Arrays.asList(new VcsDirectoryMapping(FileUtil.toSystemIndependentName(sourceDir.getPath()), myVcs.getName())))); + Arrays.asList(new VcsDirectoryMapping(FileUtil.toSystemIndependentName(sourceDir.getPath()), vcs.getName())))); } @Test diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnHistoryTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnHistoryTest.java index f0b5bc617299..51b888c268fb 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnHistoryTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnHistoryTest.java @@ -28,7 +28,7 @@ public class SvnHistoryTest extends SvnTestCase { public void testRepositoryRootHistory() throws Exception { enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD); enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE); - final VcsHistoryProvider provider = SvnVcs.getInstance(myProject).getVcsHistoryProvider(); + final VcsHistoryProvider provider = vcs.getVcsHistoryProvider(); final SubTree tree = new SubTree(myWorkingCopyDir); checkin(); @@ -46,7 +46,7 @@ public class SvnHistoryTest extends SvnTestCase { public void testSimpleHistory() throws Exception { enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD); enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE); - final VcsHistoryProvider provider = SvnVcs.getInstance(myProject).getVcsHistoryProvider(); + final VcsHistoryProvider provider = vcs.getVcsHistoryProvider(); final SubTree tree = new SubTree(myWorkingCopyDir); checkin(); @@ -64,7 +64,7 @@ public class SvnHistoryTest extends SvnTestCase { public void testSimpleHistoryLocal() throws Exception { enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD); enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE); - final VcsHistoryProvider provider = SvnVcs.getInstance(myProject).getVcsHistoryProvider(); + final VcsHistoryProvider provider = vcs.getVcsHistoryProvider(); final SubTree tree = new SubTree(myWorkingCopyDir); checkin(); @@ -81,7 +81,7 @@ public class SvnHistoryTest extends SvnTestCase { public void testLocallyRenamedFileHistory() throws Exception { enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD); enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE); - final VcsHistoryProvider provider = SvnVcs.getInstance(myProject).getVcsHistoryProvider(); + final VcsHistoryProvider provider = vcs.getVcsHistoryProvider(); final SubTree tree = new SubTree(myWorkingCopyDir); checkin(); @@ -102,7 +102,7 @@ public class SvnHistoryTest extends SvnTestCase { public void testLocallyMovedToRenamedDirectory() throws Exception { enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD); enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE); - final VcsHistoryProvider provider = SvnVcs.getInstance(myProject).getVcsHistoryProvider(); + final VcsHistoryProvider provider = vcs.getVcsHistoryProvider(); final SubTree tree = new SubTree(myWorkingCopyDir); checkin(); diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnIgnoreTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnIgnoreTest.java index 264ba62e3c8d..4400ffef8afe 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnIgnoreTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnIgnoreTest.java @@ -21,14 +21,12 @@ import static org.jetbrains.idea.svn.SvnPropertyKeys.SVN_IGNORE; public class SvnIgnoreTest extends SvnTestCase { private ChangeListManager clManager; - private SvnVcs myVcs; @Override public void setUp() throws Exception { super.setUp(); clManager = ChangeListManager.getInstance(myProject); - myVcs = SvnVcs.getInstance(myProject); enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD); enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE); @@ -39,7 +37,7 @@ public class SvnIgnoreTest extends SvnTestCase { final VirtualFile versionedParent = createDirInCommand(myWorkingCopyDir, "versionedParent"); final String name = "ign123"; File file = virtualToIoFile(versionedParent); - myVcs.getFactory(file).createPropertyClient().setProperty(file, SVN_IGNORE, PropertyValue.create(name + "\n"), Depth.EMPTY, true); + vcs.getFactory(file).createPropertyClient().setProperty(file, SVN_IGNORE, PropertyValue.create(name + "\n"), Depth.EMPTY, true); checkin(); update(); @@ -69,8 +67,8 @@ public class SvnIgnoreTest extends SvnTestCase { final String name = "ign123"; final String name2 = "ign321"; File file = virtualToIoFile(versionedParent); - myVcs.getFactory().createPropertyClient() - .setProperty(file, SVN_IGNORE, PropertyValue.create(name + "\n" + name2 + "\n"), Depth.EMPTY, true); + vcs.getFactory().createPropertyClient() + .setProperty(file, SVN_IGNORE, PropertyValue.create(name + "\n" + name2 + "\n"), Depth.EMPTY, true); checkin(); update(); diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnMergeInfoTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnMergeInfoTest.java index 8138fa41caf5..568d2bea5e8d 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnMergeInfoTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnMergeInfoTest.java @@ -48,7 +48,6 @@ public class SvnMergeInfoTest extends SvnTestCase { private WCInfoWithBranches myWCInfoWithBranches; private OneShotMergeInfoHelper myOneShotMergeInfoHelper; - private SvnVcs myVcs; private BranchInfo myMergeChecker; private File trunk; @@ -78,11 +77,10 @@ public class SvnMergeInfoTest extends SvnTestCase { Node node = new Node(vcsRoot, createUrl(myBranchUrl), createUrl(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), parseUrl(myTrunkUrl, false), myWCInfo, Url.tail(myTrunkUrl), vcsRoot); + myMergeContext = new MergeContext(vcs, parseUrl(myTrunkUrl, false), myWCInfo, Url.tail(myTrunkUrl), vcsRoot); myOneShotMergeInfoHelper = new OneShotMergeInfoHelper(myMergeContext); - myVcs = SvnVcs.getInstance(myProject); - myVcs.getSvnConfiguration().setCheckNestedForQuickMerge(true); + vcs.getSvnConfiguration().setCheckNestedForQuickMerge(true); enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD); enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE); @@ -90,7 +88,7 @@ public class SvnMergeInfoTest extends SvnTestCase { Url repoUrl = createUrl(myRepoUrl, false); myWCInfoWithBranches = new WCInfoWithBranches(myWCInfo, Collections.emptyList(), vcsRoot, new WCInfoWithBranches.Branch(repoUrl.appendPath("trunk", false))); - myMergeChecker = new BranchInfo(myVcs, myWCInfoWithBranches, new WCInfoWithBranches.Branch(repoUrl.appendPath("branch", false))); + myMergeChecker = new BranchInfo(vcs, myWCInfoWithBranches, new WCInfoWithBranches.Branch(repoUrl.appendPath("branch", false))); } @Test @@ -248,7 +246,7 @@ public class SvnMergeInfoTest extends SvnTestCase { assertMergeInfo(myBranchVcsRoot, "/trunk:3"); - final Info f1info = myVcs.getInfo(new File(myBranchVcsRoot, "folder/f1.txt")); + final Info f1info = vcs.getInfo(new File(myBranchVcsRoot, "folder/f1.txt")); assert f1info.getRevision().getNumber() == 2; final List changeListList = getTrunkChangeLists(); @@ -286,7 +284,7 @@ public class SvnMergeInfoTest extends SvnTestCase { @NotNull private List getTrunkChangeLists() throws com.intellij.openapi.vcs.VcsException { - final CommittedChangesProvider provider = myVcs.getCommittedChangesProvider(); + final CommittedChangesProvider provider = vcs.getCommittedChangesProvider(); return provider.getCommittedChanges(provider.createDefaultSettings(), new SvnRepositoryLocation(parseUrl(myTrunkUrl, false)), 0); } @@ -342,7 +340,6 @@ public class SvnMergeInfoTest extends SvnTestCase { } private void assertMergeInfo(@NotNull File file, @NotNull String... values) throws SvnBindException { - SvnVcs vcs = SvnVcs.getInstance(myProject); PropertyValue propertyValue = vcs.getFactory(file).createPropertyClient().getProperty(Target.on(file), MERGE_INFO, false, Revision.WORKING); assert propertyValue != null; diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnNativeClientAuthTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnNativeClientAuthTest.java index c45d49e488ca..9aa60b1268c2 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnNativeClientAuthTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnNativeClientAuthTest.java @@ -31,7 +31,6 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; public class SvnNativeClientAuthTest extends SvnTestCase { - private SvnVcs myVcs; private AcceptResult myCertificateAnswer = AcceptResult.ACCEPTED_TEMPORARILY; private boolean myCredentialsCorrect = true; private boolean mySaveCredentials = false; @@ -55,13 +54,12 @@ public class SvnNativeClientAuthTest extends SvnTestCase { public void setUp() throws Exception { super.setUp(); final File certFile = new File(myPluginRoot, getTestDataDir() + "/svn/____.pfx"); - myVcs = SvnVcs.getInstance(myProject); // replace authentication provider so that pass credentials without dialogs final SvnConfiguration configuration = SvnConfiguration.getInstance(myProject); final File svnconfig = FileUtil.createTempDirectory("svnconfig", ""); configuration.setConfigurationDirParameters(false, svnconfig.getPath()); - final SvnAuthenticationManager interactiveManager = configuration.getInteractiveManager(myVcs); + final SvnAuthenticationManager interactiveManager = configuration.getInteractiveManager(vcs); final SvnTestInteractiveAuthentication authentication = new SvnTestInteractiveAuthentication() { @Override public AcceptResult acceptServerAuthentication(Url url, String realm, Object certificate, boolean canCache) { @@ -77,7 +75,7 @@ public class SvnNativeClientAuthTest extends SvnTestCase { }; interactiveManager.setAuthenticationProvider(authentication); - final SvnAuthenticationManager manager = configuration.getAuthenticationManager(myVcs); + final SvnAuthenticationManager manager = configuration.getAuthenticationManager(vcs); // will be the same as in interactive -> authentication notifier is not used manager.setAuthenticationProvider(authentication); @@ -482,11 +480,11 @@ public class SvnNativeClientAuthTest extends SvnTestCase { assertNotNull(vf); final ArrayList files = new ArrayList<>(); files.add(vf); - final List exceptions = myVcs.getCheckinEnvironment().scheduleUnversionedFilesForAddition(files); + final List exceptions = vcs.getCheckinEnvironment().scheduleUnversionedFilesForAddition(files); assertTrue(exceptions.isEmpty()); final Change change = new Change(null, new CurrentContentRevision(VcsUtil.getFilePath(vf))); - final List commit = myVcs.getCheckinEnvironment().commit(Collections.singletonList(change), "commit"); + final List commit = vcs.getCheckinEnvironment().commit(Collections.singletonList(change), "commit"); assertTrue(commit.isEmpty()); ++ myExpectedCreds; ++ myExpectedCert; @@ -529,8 +527,8 @@ public class SvnNativeClientAuthTest extends SvnTestCase { final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(wc1); final UpdatedFiles files = UpdatedFiles.create(); final UpdateSession session = - myVcs.getUpdateEnvironment().updateDirectories(new FilePath[]{VcsUtil.getFilePath(vf)}, files, new EmptyProgressIndicator(), - new Ref<>()); + vcs.getUpdateEnvironment().updateDirectories(new FilePath[]{VcsUtil.getFilePath(vf)}, files, new EmptyProgressIndicator(), + new Ref<>()); assertTrue(session.getExceptions() != null && !session.getExceptions().isEmpty()); assertTrue(!session.isCanceled()); assertTrue(session.getExceptions().get(0).getMessage().contains(expectedText)); @@ -546,8 +544,8 @@ public class SvnNativeClientAuthTest extends SvnTestCase { final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(wc1); final UpdatedFiles files = UpdatedFiles.create(); final UpdateSession session = - myVcs.getUpdateEnvironment().updateDirectories(new FilePath[]{VcsUtil.getFilePath(vf)}, files, new EmptyProgressIndicator(), - new Ref<>()); + vcs.getUpdateEnvironment().updateDirectories(new FilePath[]{VcsUtil.getFilePath(vf)}, files, new EmptyProgressIndicator(), + new Ref<>()); assertTrue(session.getExceptions() == null || session.getExceptions().isEmpty()); assertTrue(!session.isCanceled()); if (myIsSecure) { diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnNativeListsTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnNativeListsTest.java index 88312a54aaf1..f2c0181dd481 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnNativeListsTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnNativeListsTest.java @@ -40,7 +40,7 @@ public class SvnNativeListsTest extends SvnTestCase { private void clearListForRevision(final ContentRevision revision) throws VcsException { if (revision == null) return; - SvnChangelistListener.removeFromList(SvnVcs.getInstance(myProject), revision.getFile().getIOFile()); + SvnChangelistListener.removeFromList(vcs, revision.getFile().getIOFile()); } @Test diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnProtocolsTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnProtocolsTest.java index 09f5ec149c25..7768073d8dd0 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnProtocolsTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnProtocolsTest.java @@ -57,17 +57,14 @@ public class SvnProtocolsTest extends SvnTestCase { public static final String SSH_USER_NAME = "user"; public static final String SSH_PASSWORD = "qwerty4321"; public static final int SSH_PORT_NUMBER = 222; - private SvnVcs myVcs; - @Override @Before public void setUp() throws Exception { super.setUp(); - myVcs = SvnVcs.getInstance(myProject); // replace authentication provider so that pass credentials without dialogs final SvnConfiguration configuration = SvnConfiguration.getInstance(myProject); - final SvnAuthenticationManager interactiveManager = configuration.getInteractiveManager(myVcs); + final SvnAuthenticationManager interactiveManager = configuration.getInteractiveManager(vcs); final SvnTestInteractiveAuthentication authentication = new SvnTestInteractiveAuthentication() { @Override public AcceptResult acceptServerAuthentication(Url url, String realm, Object certificate, boolean canCache) { @@ -76,7 +73,7 @@ public class SvnProtocolsTest extends SvnTestCase { }; interactiveManager.setAuthenticationProvider(authentication); - final SvnAuthenticationManager manager = configuration.getAuthenticationManager(myVcs); + final SvnAuthenticationManager manager = configuration.getAuthenticationManager(vcs); // will be the same as in interactive -> authentication notifier is not used manager.setAuthenticationProvider(authentication); @@ -94,7 +91,7 @@ public class SvnProtocolsTest extends SvnTestCase { private void testBrowseRepositoryImpl(Url url) throws VcsException { List list = newArrayList(); - myVcs.getFactoryFromSettings().createBrowseClient().list(Target.on(url), null, null, list::add); + vcs.getFactoryFromSettings().createBrowseClient().list(Target.on(url), null, null, list::add); assertTrue(!list.isEmpty()); } @@ -116,7 +113,7 @@ public class SvnProtocolsTest extends SvnTestCase { } private void testHistoryImpl(Url s) throws VcsException { - final VcsHistoryProvider provider = myVcs.getVcsHistoryProvider(); + final VcsHistoryProvider provider = vcs.getVcsHistoryProvider(); final VcsAppendableHistoryPartnerAdapter partner = new VcsAppendableHistoryPartnerAdapter() { @Override public void acceptRevision(VcsFileRevision revision) { @@ -155,8 +152,8 @@ public class SvnProtocolsTest extends SvnTestCase { final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(wc1); final UpdatedFiles files = UpdatedFiles.create(); final UpdateSession session = - myVcs.getUpdateEnvironment().updateDirectories(new FilePath[]{VcsUtil.getFilePath(vf)}, files, new EmptyProgressIndicator(), - new Ref<>()); + vcs.getUpdateEnvironment().updateDirectories(new FilePath[]{VcsUtil.getFilePath(vf)}, files, new EmptyProgressIndicator(), + new Ref<>()); assertTrue(session.getExceptions() == null || session.getExceptions().isEmpty()); assertTrue(!session.isCanceled()); assertTrue(!files.getGroupById(FileGroup.CREATED_ID).getFiles().isEmpty()); @@ -172,11 +169,11 @@ public class SvnProtocolsTest extends SvnTestCase { assertNotNull(vf); final ArrayList files = new ArrayList<>(); files.add(vf); - final List exceptions = myVcs.getCheckinEnvironment().scheduleUnversionedFilesForAddition(files); + final List exceptions = vcs.getCheckinEnvironment().scheduleUnversionedFilesForAddition(files); assertTrue(exceptions.isEmpty()); final Change change = new Change(null, new CurrentContentRevision(VcsUtil.getFilePath(vf))); - final List commit = myVcs.getCheckinEnvironment().commit(Collections.singletonList(change), "commit"); + final List commit = vcs.getCheckinEnvironment().commit(Collections.singletonList(change), "commit"); assertTrue(commit.isEmpty()); return file; } diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnQuickMergeTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnQuickMergeTest.java index 546da66ff851..eb248bd8923c 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnQuickMergeTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnQuickMergeTest.java @@ -41,7 +41,6 @@ import static org.jetbrains.idea.svn.api.Revision.WORKING; import static org.junit.Assert.*; public class SvnQuickMergeTest extends SvnTestCase { - private SvnVcs myVcs; private String myBranchUrl; private File myBranchRoot; private VirtualFile myBranchVf; @@ -54,7 +53,6 @@ public class SvnQuickMergeTest extends SvnTestCase { public void setUp() throws Exception { super.setUp(); - myVcs = SvnVcs.getInstance(myProject); myChangeListManager = ChangeListManager.getInstance(myProject); myBranchUrl = prepareBranchesStructure(); myBranchRoot = new File(myTempDirFixture.getTempDirPath(), "b1"); @@ -116,7 +114,7 @@ public class SvnQuickMergeTest extends SvnTestCase { @Test public void testSelectRevisionsWithQuickSelectCheckForLocalChanges() throws Exception { - Info info = myVcs.getInfo(virtualToIoFile(myBranchTree.myS1File), WORKING); + Info info = vcs.getInfo(virtualToIoFile(myBranchTree.myS1File), WORKING); assertNotNull(info); final long numberBefore = info.getRevision().getNumber(); @@ -158,7 +156,7 @@ public class SvnQuickMergeTest extends SvnTestCase { assertEquals(FileStatus.MODIFIED, dirChange.getFileStatus()); File file = virtualToIoFile(myWorkingCopyDir); - PropertyValue value = myVcs.getFactory(file).createPropertyClient().getProperty(Target.on(file), MERGE_INFO, false, WORKING); + PropertyValue value = vcs.getFactory(file).createPropertyClient().getProperty(Target.on(file), MERGE_INFO, false, WORKING); System.out.println(value.toString()); assertEquals("/branches/b1:" + (numberBefore + 1), value.toString()); } @@ -167,7 +165,7 @@ public class SvnQuickMergeTest extends SvnTestCase { // trunk->b1->b2 merges between trunk and b2 @Test public void testSelectRevisionsWithQuickSelect() throws Exception { - Info info = myVcs.getInfo(virtualToIoFile(myBranchTree.myS1File), WORKING); + Info info = vcs.getInfo(virtualToIoFile(myBranchTree.myS1File), WORKING); assertNotNull(info); final long numberBefore = info.getRevision().getNumber(); @@ -182,7 +180,7 @@ public class SvnQuickMergeTest extends SvnTestCase { } // before copy - Info info2 = myVcs.getInfo(virtualToIoFile(myBranchTree.myS1File), WORKING); + Info info2 = vcs.getInfo(virtualToIoFile(myBranchTree.myS1File), WORKING); assertNotNull(info2); final long numberBeforeCopy = info2.getRevision().getNumber(); @@ -224,14 +222,14 @@ public class SvnQuickMergeTest extends SvnTestCase { assertEquals(FileStatus.MODIFIED, dirChange.getFileStatus()); File file = virtualToIoFile(myWorkingCopyDir); - PropertyValue value = myVcs.getFactory(file).createPropertyClient().getProperty(Target.on(file), MERGE_INFO, false, WORKING); + PropertyValue value = vcs.getFactory(file).createPropertyClient().getProperty(Target.on(file), MERGE_INFO, false, WORKING); System.out.println(value.toString()); assertEquals("/branches/b2:" + (numberBeforeCopy + 2), value.toString()); } @Test public void testSelectRevisions() throws Exception { - Info info = myVcs.getInfo(virtualToIoFile(myBranchTree.myS1File), WORKING); + Info info = vcs.getInfo(virtualToIoFile(myBranchTree.myS1File), WORKING); assertNotNull(info); final long numberBefore = info.getRevision().getNumber(); @@ -264,7 +262,7 @@ public class SvnQuickMergeTest extends SvnTestCase { assertEquals(FileStatus.MODIFIED, dirChange.getFileStatus()); File file = virtualToIoFile(myWorkingCopyDir); - PropertyValue value = myVcs.getFactory(file).createPropertyClient().getProperty(Target.on(file), MERGE_INFO, false, WORKING); + PropertyValue value = vcs.getFactory(file).createPropertyClient().getProperty(Target.on(file), MERGE_INFO, false, WORKING); System.out.println(value.toString()); assertEquals("/branches/b1:" + (numberBefore + 1) + "-" + (numberBefore + 2), value.toString()); } @@ -272,7 +270,7 @@ public class SvnQuickMergeTest extends SvnTestCase { private WCInfo getWcInfo() { WCInfo found = null; final File workingIoFile = virtualToIoFile(myWorkingCopyDir); - final List infos = myVcs.getAllWcInfos(); + final List infos = vcs.getAllWcInfos(); for (WCInfo info : infos) { if (FileUtil.filesEqual(workingIoFile, new File(info.getPath()))) { found = info; @@ -313,7 +311,7 @@ public class SvnQuickMergeTest extends SvnTestCase { } private void waitQuickMerge(@NotNull String sourceUrl, @NotNull QuickMergeTestInteraction interaction) throws Exception { - MergeContext mergeContext = new MergeContext(myVcs, parseUrl(sourceUrl, false), getWcInfo(), Url.tail(sourceUrl), myWorkingCopyDir); + MergeContext mergeContext = new MergeContext(vcs, parseUrl(sourceUrl, false), getWcInfo(), Url.tail(sourceUrl), myWorkingCopyDir); QuickMerge quickMerge = new QuickMerge(mergeContext, interaction); getApplication().invokeAndWait(quickMerge::execute); diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnRenameTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnRenameTest.java index c6af6cc5528e..5347c12bf10e 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnRenameTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnRenameTest.java @@ -170,8 +170,8 @@ public class SvnRenameTest extends SvnTestCase { Assert.assertNotNull(change); final List exceptions = new ArrayList<>(); - SvnVcs.getInstance(myProject).getRollbackEnvironment().rollbackChanges(Collections.singletonList(change), exceptions, - RollbackProgressListener.EMPTY); + vcs.getRollbackEnvironment().rollbackChanges(Collections.singletonList(change), exceptions, + RollbackProgressListener.EMPTY); Assert.assertTrue(exceptions.isEmpty()); Assert.assertFalse(new File(myWorkingCopyDir.getPath(), "newchild").exists()); Assert.assertTrue(new File(myWorkingCopyDir.getPath(), "child").exists()); @@ -236,7 +236,7 @@ public class SvnRenameTest extends SvnTestCase { changes.add(ChangeListManager.getInstance(myProject).getChange(myWorkingCopyDir.findChild("newchild"))); final List exceptions = new ArrayList<>(); - SvnVcs.getInstance(myProject).getRollbackEnvironment().rollbackChanges(changes, exceptions, RollbackProgressListener.EMPTY); + vcs.getRollbackEnvironment().rollbackChanges(changes, exceptions, RollbackProgressListener.EMPTY); TimeoutUtil.sleep(300); Assert.assertTrue(exceptions.isEmpty()); final File fileA = new File(childPath, "a.txt"); @@ -265,7 +265,7 @@ public class SvnRenameTest extends SvnTestCase { refreshVfs(); // wait for end of refresh operations initiated from SvnFileSystemListener changeListManager.ensureUpToDate(false); final List changes = new ArrayList<>(changeListManager.getDefaultChangeList().getChanges()); - final List list = SvnVcs.getInstance(myProject).getCheckinEnvironment().commit(changes, "test"); + final List list = vcs.getCheckinEnvironment().commit(changes, "test"); Assert.assertEquals(0, list.size()); }); } diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnResolveTreeAcceptVariantsTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnResolveTreeAcceptVariantsTest.java index dfc8467264ea..c7aec5ce6568 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnResolveTreeAcceptVariantsTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnResolveTreeAcceptVariantsTest.java @@ -39,7 +39,6 @@ import static org.junit.Assert.*; public class SvnResolveTreeAcceptVariantsTest extends SvnTestCase { private VirtualFile myTheirs; private SvnClientRunnerImpl mySvnClientRunner; - private SvnVcs myVcs; private VcsDirtyScopeManager myDirtyScopeManager; private ChangeListManager myChangeListManager; @@ -53,7 +52,6 @@ public class SvnResolveTreeAcceptVariantsTest extends SvnTestCase { mySvnClientRunner = new SvnClientRunnerImpl(myRunner); clearWc(true); - myVcs = SvnVcs.getInstance(myProject); myDirtyScopeManager = VcsDirtyScopeManager.getInstance(myProject); myChangeListManager = ChangeListManager.getInstance(myProject); myTraceClient = true; @@ -99,10 +97,10 @@ public class SvnResolveTreeAcceptVariantsTest extends SvnTestCase { sleep(200); ProjectLevelVcsManager.getInstance(myProject).setDirectoryMappings( - Collections.singletonList(new VcsDirectoryMapping(myWorkingCopyDir.getPath(), myVcs.getName()))); + Collections.singletonList(new VcsDirectoryMapping(myWorkingCopyDir.getPath(), vcs.getName()))); createSubTree(data); myTheirs.refresh(false, true); - final ConflictCreator creator = new ConflictCreator(myProject, myTheirs, myWorkingCopyDir, data, mySvnClientRunner); + final ConflictCreator creator = new ConflictCreator(vcs, myTheirs, myWorkingCopyDir, data, mySvnClientRunner); creator.create(); sleep(200); @@ -122,7 +120,7 @@ public class SvnResolveTreeAcceptVariantsTest extends SvnTestCase { final SvnRevisionNumber committedRevision = change.getBeforeRevision() != null ? (SvnRevisionNumber)change.getBeforeRevision().getRevisionNumber() : null; //SvnRevisionNumber committedRevision = new SvnRevisionNumber(Revision.of(cnt * 2 + 1)); - final SvnTreeConflictResolver resolver = new SvnTreeConflictResolver(myVcs, filePath, null); + final SvnTreeConflictResolver resolver = new SvnTreeConflictResolver(vcs, filePath, null); resolver.resolveSelectMineFull(); @@ -148,13 +146,13 @@ public class SvnResolveTreeAcceptVariantsTest extends SvnTestCase { } private void checkStatusesAfterMineFullResolve(TreeConflictData.Data data, File conflictIoFile) { - Status conflStatus = SvnUtil.getStatus(myVcs, conflictIoFile); + Status conflStatus = SvnUtil.getStatus(vcs, conflictIoFile); assertTrue(createTestFailedComment(data, conflictIoFile.getPath()) + " tree conflict resolved", conflStatus.getTreeConflict() == null); Collection leftFiles = data.getLeftFiles(); for (TreeConflictData.FileData file : leftFiles) { File exFile = new File(myWorkingCopyDir.getPath(), file.myRelativePath); - final Status status = SvnUtil.getStatus(myVcs, exFile); + final Status status = SvnUtil.getStatus(vcs, exFile); boolean theirsExists = new File(myTheirs.getPath(), file.myRelativePath).exists(); if (StatusType.STATUS_UNVERSIONED.equals(file.myNodeStatus)) { @@ -224,7 +222,7 @@ public class SvnResolveTreeAcceptVariantsTest extends SvnTestCase { mySvnClientRunner.checkout(myRepoUrl, myWorkingCopyDir); createSubTree(data); - final ConflictCreator creator = new ConflictCreator(myProject, myTheirs, myWorkingCopyDir, data, mySvnClientRunner); + final ConflictCreator creator = new ConflictCreator(vcs, myTheirs, myWorkingCopyDir, data, mySvnClientRunner); creator.create(); myDirtyScopeManager.markEverythingDirty(); @@ -246,7 +244,7 @@ public class SvnResolveTreeAcceptVariantsTest extends SvnTestCase { beforePath = change.getBeforeRevision().getFile(); } //SvnRevisionNumber committedRevision = new SvnRevisionNumber(Revision.of(cnt * 2 + 1)); - final SvnTreeConflictResolver resolver = new SvnTreeConflictResolver(myVcs, filePath, beforePath); + final SvnTreeConflictResolver resolver = new SvnTreeConflictResolver(vcs, filePath, beforePath); resolver.resolveSelectTheirsFull(); @@ -265,8 +263,8 @@ public class SvnResolveTreeAcceptVariantsTest extends SvnTestCase { exists); } final File theirsFile = virtualToIoFile(file); - Info theirsInfo = myVcs.getInfo(theirsFile); - Info thisInfo = myVcs.getInfo(workingFile); + Info theirsInfo = vcs.getInfo(theirsFile); + Info thisInfo = vcs.getInfo(workingFile); if (theirsInfo != null) { assertEquals("Check failed for test: " + getTestName(data) + " and file: " + relative + " in: " + myWorkingCopyDir.getPath() + ", theirs: " + theirsInfo.getRevision().getNumber() + ", mine: " + thisInfo.getRevision().getNumber(), diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnRollbackTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnRollbackTest.java index 1d753083157f..fcd423448ccf 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnRollbackTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnRollbackTest.java @@ -28,7 +28,6 @@ public class SvnRollbackTest extends SvnTestCase { private VcsDirtyScopeManager myDirtyScopeManager; private ChangeListManager myChangeListManager; - private SvnVcs myVcs; @Override @Before @@ -37,8 +36,6 @@ public class SvnRollbackTest extends SvnTestCase { myDirtyScopeManager = VcsDirtyScopeManager.getInstance(myProject); myChangeListManager = ChangeListManager.getInstance(myProject); - myVcs = SvnVcs.getInstance(myProject); - enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD); enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE); } @@ -60,7 +57,7 @@ public class SvnRollbackTest extends SvnTestCase { private void rollbackIMpl(List changes, final List allowedAfter) throws VcsException { final List exceptions = new ArrayList<>(); - myVcs.createRollbackEnvironment().rollbackChanges(changes, exceptions, RollbackProgressListener.EMPTY); + vcs.createRollbackEnvironment().rollbackChanges(changes, exceptions, RollbackProgressListener.EMPTY); if (! exceptions.isEmpty()) { throw exceptions.get(0); } @@ -287,13 +284,13 @@ public class SvnRollbackTest extends SvnTestCase { } private String getProperty(File file, String name) throws SvnBindException { - PropertyValue value = myVcs.getFactory(file).createPropertyClient().getProperty(Target.on(file), name, false, WORKING); + PropertyValue value = vcs.getFactory(file).createPropertyClient().getProperty(Target.on(file), name, false, WORKING); return PropertyValue.toString(value); } private void setProperty(final File file, final String name, final String value) throws SvnBindException { - myVcs.getFactory(file).createPropertyClient().setProperty(file, name, PropertyValue.create(value), Depth.EMPTY, true); + vcs.getFactory(file).createPropertyClient().setProperty(file, name, PropertyValue.create(value), Depth.EMPTY, true); } @Test @@ -395,7 +392,7 @@ public class SvnRollbackTest extends SvnTestCase { final File wasIgnored = virtualToIoFile(ignored); final FileGroupInfo groupInfo = new FileGroupInfo(); groupInfo.onFileEnabled(ignored); - SvnPropertyService.doAddToIgnoreProperty(myVcs, false, new VirtualFile[]{ignored}, groupInfo); + SvnPropertyService.doAddToIgnoreProperty(vcs, false, new VirtualFile[]{ignored}, groupInfo); myDirtyScopeManager.markEverythingDirty(); myChangeListManager.ensureUpToDate(false); @@ -428,7 +425,7 @@ public class SvnRollbackTest extends SvnTestCase { final File wasIgnored = virtualToIoFile(ignored); final FileGroupInfo groupInfo = new FileGroupInfo(); groupInfo.onFileEnabled(ignored); - SvnPropertyService.doAddToIgnoreProperty(myVcs, false, new VirtualFile[]{ignored}, groupInfo); + SvnPropertyService.doAddToIgnoreProperty(vcs, false, new VirtualFile[]{ignored}, groupInfo); checkin(); myDirtyScopeManager.markEverythingDirty(); @@ -623,7 +620,7 @@ public class SvnRollbackTest extends SvnTestCase { private void rollbackLocallyDeleted(final List locally, final List allowed) { final List exceptions = new ArrayList<>(); - myVcs.createRollbackEnvironment().rollbackMissingFileDeletion(locally, exceptions, RollbackProgressListener.EMPTY); + vcs.createRollbackEnvironment().rollbackMissingFileDeletion(locally, exceptions, RollbackProgressListener.EMPTY); Assert.assertTrue(exceptions.isEmpty()); myDirtyScopeManager.markEverythingDirty(); diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnTestCase.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnTestCase.java index 5d782670e273..bc3ffbb8c5d1 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnTestCase.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnTestCase.java @@ -73,6 +73,8 @@ public abstract class SvnTestCase extends AbstractJunitVcsTestCase { protected String myAnotherRepoUrl; protected File myPluginRoot; + protected SvnVcs vcs; + protected SvnTestCase() { this("testData"); } @@ -145,6 +147,7 @@ public abstract class SvnTestCase extends AbstractJunitVcsTestCase { initProject(myWcRoot, this.getTestName()); activateVCS(SvnVcs.VCS_NAME); + vcs = SvnVcs.getInstance(myProject); myGate = new MockChangeListManagerGate(ChangeListManager.getInstance(myProject)); ((StartupManagerImpl)StartupManager.getInstance(myProject)).runPostStartupActivities(); @@ -160,7 +163,6 @@ public abstract class SvnTestCase extends AbstractJunitVcsTestCase { } protected void refreshSvnMappingsSynchronously() { - final SvnVcs vcs = SvnVcs.getInstance(myProject); if (! myInitChangeListManager) { return; } @@ -216,7 +218,7 @@ public abstract class SvnTestCase extends AbstractJunitVcsTestCase { } protected List getChangesInScope(final VcsDirtyScope dirtyScope) throws VcsException { - ChangeProvider changeProvider = SvnVcs.getInstance(myProject).getChangeProvider(); + ChangeProvider changeProvider = vcs.getChangeProvider(); MockChangelistBuilder builder = new MockChangelistBuilder(); changeProvider.getChanges(dirtyScope, builder, new EmptyProgressIndicator(), myGate); return builder.getChanges(); @@ -316,7 +318,6 @@ public abstract class SvnTestCase extends AbstractJunitVcsTestCase { } public String prepareBranchesStructure() throws Exception { - final SvnVcs vcs = SvnVcs.getInstance(myProject); final String mainUrl = myRepoUrl + "/trunk"; runInAndVerifyIgnoreOutput("mkdir", "-m", "mkdir", mainUrl); runInAndVerifyIgnoreOutput("mkdir", "-m", "mkdir", myRepoUrl + "/branches"); @@ -357,7 +358,6 @@ public abstract class SvnTestCase extends AbstractJunitVcsTestCase { 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; if (anotherRepository) { diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnTreeConflictDataTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnTreeConflictDataTest.java index b9f92e889943..5d6f57708823 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnTreeConflictDataTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnTreeConflictDataTest.java @@ -42,7 +42,7 @@ public class SvnTreeConflictDataTest extends SvnTestCase { @Test public void testFile2File_MINE_UNV_THEIRS_ADD() throws Exception { - final ConflictCreator creator = new ConflictCreator(myProject, myTheirs, myWorkingCopyDir, + final ConflictCreator creator = new ConflictCreator(vcs, myTheirs, myWorkingCopyDir, TreeConflictData.FileToFile.MINE_UNV_THEIRS_ADD, mySvnClientRunner); creator.create(); final String conflictFile = TreeConflictData.FileToFile.MINE_UNV_THEIRS_ADD.getConflictFile(); @@ -105,7 +105,7 @@ public class SvnTreeConflictDataTest extends SvnTestCase { mySvnClientRunner.testSvnVersion(myWorkingCopyDir); createSubTree(); - final ConflictCreator creator = new ConflictCreator(myProject, myTheirs, myWorkingCopyDir, data, mySvnClientRunner); + final ConflictCreator creator = new ConflictCreator(vcs, myTheirs, myWorkingCopyDir, data, mySvnClientRunner); creator.create(); return data.getConflictFile(); } diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/history/FirstInBranchTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/history/FirstInBranchTest.java index 831524f19c68..dd5686fb49e7 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/history/FirstInBranchTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/history/FirstInBranchTest.java @@ -4,7 +4,6 @@ package org.jetbrains.idea.svn.history; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.idea.svn.SvnTestCase; -import org.jetbrains.idea.svn.SvnVcs; import org.jetbrains.idea.svn.api.Revision; import org.jetbrains.idea.svn.api.Target; import org.jetbrains.idea.svn.api.Url; @@ -20,8 +19,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; public class FirstInBranchTest extends SvnTestCase { - - private SvnVcs myVcs; private Url myTrunkUrl; private Url myBranchesUrl; private long myHeadRevision; @@ -31,7 +28,6 @@ public class FirstInBranchTest extends SvnTestCase { public void setUp() throws Exception { super.setUp(); - myVcs = SvnVcs.getInstance(myProject); myRepositoryUrl = createUrl(myRepoUrl); myTrunkUrl = myRepositoryUrl.appendPath("trunk", true); myBranchesUrl = myRepositoryUrl.appendPath("branches", true); @@ -39,7 +35,7 @@ public class FirstInBranchTest extends SvnTestCase { runInAndVerifyIgnoreOutput("mkdir", "-m", "trunk", myTrunkUrl.toString()); runInAndVerifyIgnoreOutput("mkdir", "-m", "branches", myBranchesUrl.toString()); - myHeadRevision = getHeadRevision(myVcs, myRepositoryUrl).getNumber(); + myHeadRevision = getHeadRevision(vcs, myRepositoryUrl).getNumber(); } @Test @@ -109,10 +105,10 @@ public class FirstInBranchTest extends SvnTestCase { private void assertBranchPoint(@NotNull Url sourceUrl, @NotNull Url targetUrl, long sourceRevision, long targetRevision) throws Exception { - CopyData branchTrunk = new FirstInBranch(myVcs, myRepositoryUrl, targetUrl, sourceUrl).run(); + CopyData branchTrunk = new FirstInBranch(vcs, myRepositoryUrl, targetUrl, sourceUrl).run(); assertBranchPoint(branchTrunk, sourceRevision, targetRevision, true); - CopyData trunkBranch = new FirstInBranch(myVcs, myRepositoryUrl, sourceUrl, targetUrl).run(); + CopyData trunkBranch = new FirstInBranch(vcs, myRepositoryUrl, sourceUrl, targetUrl).run(); assertBranchPoint(trunkBranch, sourceRevision, targetRevision, false); }