diff options
author | Jean-Baptiste Queru <jbq@google.com> | 2013-02-27 09:41:48 -0800 |
---|---|---|
committer | Jean-Baptiste Queru <jbq@google.com> | 2013-02-27 09:41:48 -0800 |
commit | 1d526b16d476792ca7ce47616d55833115e8d6ab (patch) | |
tree | 650fb03af01ff04097d1d59939518cc71be029cb /plugins/svn4idea | |
parent | 9edc8f6b58f71ec510ba36b838f115718d9a174d (diff) | |
download | idea-1d526b16d476792ca7ce47616d55833115e8d6ab.tar.gz |
Snapshot of commit 329607d9ebcedf2bb0ad81265354366db7dc3f9c
from branch master of git://git.jetbrains.org/idea/community.git
Change-Id: I3b27d82897504da1b66169b67c7771e0f551c973
Diffstat (limited to 'plugins/svn4idea')
76 files changed, 1257 insertions, 594 deletions
diff --git a/plugins/svn4idea/lib/svnkit-javahl.jar b/plugins/svn4idea/lib/svnkit-javahl.jar Binary files differindex 5c0859b229cd..8fbe09f66c57 100644 --- a/plugins/svn4idea/lib/svnkit-javahl.jar +++ b/plugins/svn4idea/lib/svnkit-javahl.jar diff --git a/plugins/svn4idea/lib/svnkit-javahl16.zip b/plugins/svn4idea/lib/svnkit-javahl16.zip Binary files differindex ec3f33962db5..7661a0365e9d 100644 --- a/plugins/svn4idea/lib/svnkit-javahl16.zip +++ b/plugins/svn4idea/lib/svnkit-javahl16.zip diff --git a/plugins/svn4idea/lib/svnkit.jar b/plugins/svn4idea/lib/svnkit.jar Binary files differindex a0aeea04680b..203ef4a61af2 100644 --- a/plugins/svn4idea/lib/svnkit.jar +++ b/plugins/svn4idea/lib/svnkit.jar diff --git a/plugins/svn4idea/lib/svnkitsrc.zip b/plugins/svn4idea/lib/svnkitsrc.zip Binary files differindex 379b059ed335..d31e1a5a49f6 100644 --- a/plugins/svn4idea/lib/svnkitsrc.zip +++ b/plugins/svn4idea/lib/svnkitsrc.zip diff --git a/plugins/svn4idea/lib/trilead.jar b/plugins/svn4idea/lib/trilead.jar Binary files differindex 5ba0ce62b6ac..1351e821540a 100644 --- a/plugins/svn4idea/lib/trilead.jar +++ b/plugins/svn4idea/lib/trilead.jar diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/CopiesRefresh.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/CopiesRefresh.java deleted file mode 100644 index ee25936b2134..000000000000 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/CopiesRefresh.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2000-2009 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; - -public interface CopiesRefresh { - void ensureInit(); - void asynchRequest(); - void synchRequest(); -} diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SSLExceptionsHelper.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SSLExceptionsHelper.java index 5d8e89dfab8e..075423feda4b 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SSLExceptionsHelper.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SSLExceptionsHelper.java @@ -15,10 +15,6 @@ */ package org.jetbrains.idea.svn; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - /** * Created with IntelliJ IDEA. * User: Irina.Chernushina @@ -26,21 +22,17 @@ import java.util.Map; * Time: 4:44 PM */ public class SSLExceptionsHelper { - private final Map<Thread, String> myAdditionalInfo; - - public SSLExceptionsHelper() { - myAdditionalInfo = Collections.synchronizedMap(new HashMap<Thread, String>()); - } + private final static ThreadLocal<String> myAdditionalInfo = new ThreadLocal<String>(); - public void addInfo(final String s) { - myAdditionalInfo.put(Thread.currentThread(), s); + public static void addInfo(final String s) { + myAdditionalInfo.set(s); } - public void removeInfo() { - myAdditionalInfo.remove(Thread.currentThread()); + public static void removeInfo() { + myAdditionalInfo.remove(); } - public String getAddInfo() { - return myAdditionalInfo.get(Thread.currentThread()); + public static String getAddInfo() { + return myAdditionalInfo.get(); } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnAuthenticationManager.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnAuthenticationManager.java index 1d69598296b6..0202a3c28604 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnAuthenticationManager.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnAuthenticationManager.java @@ -70,7 +70,6 @@ public class SvnAuthenticationManager extends DefaultSVNAuthenticationManager im private IdeaSVNHostOptionsProvider myLocalHostOptionsProvider; private final ThreadLocalSavePermissions mySavePermissions; private final Map<Thread, String> myKeyAlgorithm; - private SSLExceptionsHelper myHelper; private boolean myArtificialSaving; public SvnAuthenticationManager(final Project project, final File configDirectory) { @@ -361,6 +360,7 @@ public class SvnAuthenticationManager extends DefaultSVNAuthenticationManager im @Override public void acknowledgeConnectionSuccessful(SVNURL url) { CommonProxy.getInstance().removeNoProxy(url.getProtocol(), url.getHost(), url.getPort()); + SSLExceptionsHelper.removeInfo(); } @Override @@ -370,7 +370,7 @@ public class SvnAuthenticationManager extends DefaultSVNAuthenticationManager im SVNErrorMessage errorMessage, SVNAuthentication authentication, SVNURL url) throws SVNException { - if (myHelper != null) myHelper.removeInfo(); + SSLExceptionsHelper.removeInfo(); CommonProxy.getInstance().removeNoProxy(url.getProtocol(), url.getHost(), url.getPort()); boolean successSaving = false; myListener.getMulticaster().acknowledge(accepted, kind, realm, errorMessage, authentication); @@ -388,7 +388,7 @@ public class SvnAuthenticationManager extends DefaultSVNAuthenticationManager im } public ISVNProxyManager getProxyManager(SVNURL url) throws SVNException { - if (myHelper != null) myHelper.addInfo("Accessing URL: " + url.toString()); + SSLExceptionsHelper.addInfo("Accessing URL: " + url.toString()); CommonProxy.getInstance().noProxy(url.getProtocol(), url.getHost(), url.getPort()); // this code taken from default manager (changed for system properties reading) String host = url.getHost(); @@ -984,8 +984,4 @@ public class SvnAuthenticationManager extends DefaultSVNAuthenticationManager im return mySuccess; } } - - public void setHelper(SSLExceptionsHelper helper) { - myHelper = helper; - } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProvider.java index fe4a640650d6..ebdf274bb4d7 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProvider.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProvider.java @@ -120,11 +120,12 @@ public class SvnChangeProvider implements ChangeProvider { } private static void putAdministrative17UnderVfsListener(Set<NestedCopiesBuilder.MyPointInfo> pointInfos) { + if (! SvnVcs.ourListenToWcDb) return; final LocalFileSystem lfs = LocalFileSystem.getInstance(); for (NestedCopiesBuilder.MyPointInfo info : pointInfos) { if (WorkingCopyFormat.ONE_DOT_SEVEN.equals(info.getFormat()) && ! NestedCopyType.switched.equals(info.getType())) { final VirtualFile root = info.getFile(); - final VirtualFile wcDb = lfs.refreshAndFindFileByIoFile(SvnUtil.getWcDb(new File(root.getPath()))); + lfs.refreshIoFiles(Collections.singletonList(SvnUtil.getWcDb(new File(root.getPath()))), true, false, null); } } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProviderContext.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProviderContext.java index 06cbd4af2aec..a9bfd234985e 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProviderContext.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProviderContext.java @@ -307,21 +307,17 @@ class SvnChangeProviderContext implements StatusReceiver { if (parentPath == null) { return; } - File svnSubdirectory = new File(parentPath.getIOFile(), SvnUtil.SVN_ADMIN_DIR_NAME); - LocalFileSystem localFileSystem = LocalFileSystem.getInstance(); - VirtualFile file = localFileSystem.refreshAndFindFileByIoFile(svnSubdirectory); - if (file != null) { - localFileSystem.refreshAndFindFileByIoFile(new File(svnSubdirectory, SvnUtil.ENTRIES_FILE_NAME)); - } + refreshDotSvnAndEntries(parentPath); if (filePath.isDirectory()) { - svnSubdirectory = new File(filePath.getPath(), SvnUtil.SVN_ADMIN_DIR_NAME); - file = localFileSystem.refreshAndFindFileByIoFile(svnSubdirectory); - if (file != null) { - localFileSystem.refreshAndFindFileByIoFile(new File(svnSubdirectory, SvnUtil.ENTRIES_FILE_NAME)); - } + refreshDotSvnAndEntries(filePath); } } + private static void refreshDotSvnAndEntries(FilePath filePath) { + final File svn = new File(filePath.getPath(), SvnUtil.SVN_ADMIN_DIR_NAME); + LocalFileSystem.getInstance().refreshIoFiles(Arrays.asList(svn, new File(svn, SvnUtil.ENTRIES_FILE_NAME)), true, false, null); + } + // seems here we can only have a tree conflict; which can be marked on either path (?) // .. ok try to merge states Change createMovedChange(final ContentRevision before, final ContentRevision after, final SVNStatus copiedStatus, diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnEntriesFileListener.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnEntriesFileListener.java index 8a2de80c4c6c..e41257204cf8 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnEntriesFileListener.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnEntriesFileListener.java @@ -61,7 +61,7 @@ public class SvnEntriesFileListener extends VirtualFileAdapter { return; } final VirtualFile file = event.getFile(); - if (isWcDbFile(file)) { + if (isWcDbFile(file) && SvnVcs.ourListenToWcDb) { LOG.debug("wc.db had changed"); final VirtualFile parentWcDb = file.getParent(); if (parentWcDb != null && SvnUtil.isAdminDirectory(parentWcDb)) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnFileUrlMappingImpl.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnFileUrlMappingImpl.java index 257fcff426bf..46545c43a4cc 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnFileUrlMappingImpl.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnFileUrlMappingImpl.java @@ -221,7 +221,7 @@ public class SvnFileUrlMappingImpl implements SvnFileUrlMapping, PersistentState } } - public void realRefresh(final Runnable callback) { + public void realRefresh(final Runnable afterRefreshCallback) { 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(), callback); + copiesDetector.detectCopyRoots(roots, init(), afterRefreshCallback); } private class CopiesApplier { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnVcs.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnVcs.java index bdbb020e8811..838295cb20a7 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnVcs.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnVcs.java @@ -69,6 +69,7 @@ import org.jetbrains.idea.svn.actions.ShowPropertiesDiffWithLocalAction; import org.jetbrains.idea.svn.actions.SvnMergeProvider; import org.jetbrains.idea.svn.annotate.SvnAnnotationProvider; import org.jetbrains.idea.svn.checkin.SvnCheckinEnvironment; +import org.jetbrains.idea.svn.checkout.SvnCheckoutProvider; import org.jetbrains.idea.svn.commandLine.SvnExecutableChecker; import org.jetbrains.idea.svn.dialogs.SvnBranchPointsCalculator; import org.jetbrains.idea.svn.dialogs.WCInfo; @@ -107,8 +108,10 @@ import java.util.logging.Level; @SuppressWarnings({"IOResourceOpenedButNotSafelyClosed"}) public class SvnVcs extends AbstractVcs<CommittedChangeList> { + private static final String DO_NOT_LISTEN_TO_WC_DB = "svn.do.not.listen.to.wc.db"; private static final String KEEP_CONNECTIONS_KEY = "svn.keep.connections"; private static final Logger REFRESH_LOG = Logger.getInstance("#svn_refresh"); + public static boolean ourListenToWcDb = true; private static final int ourLogUsualInterval = 20 * 1000; private static final int ourLogRareInterval = 30 * 1000; @@ -140,7 +143,6 @@ public class SvnVcs extends AbstractVcs<CommittedChangeList> { private EditFileProvider myEditFilesProvider; private SvnCommittedChangesProvider myCommittedChangesProvider; private final VcsShowSettingOption myCheckoutOptions; - private final static SSLExceptionsHelper myHelper = new SSLExceptionsHelper(); private ChangeProvider myChangeProvider; private MergeProvider myMergeProvider; @@ -188,6 +190,7 @@ public class SvnVcs extends AbstractVcs<CommittedChangeList> { return false; } }; + private SvnCheckoutProvider myCheckoutProvider; public void checkCommandLineVersion() { myChecker.checkExecutableAndNotifyIfNeeded(); @@ -195,6 +198,9 @@ public class SvnVcs extends AbstractVcs<CommittedChangeList> { static { System.setProperty("svnkit.log.native.calls", "true"); + if (Boolean.getBoolean(DO_NOT_LISTEN_TO_WC_DB)) { + ourListenToWcDb = false; + } final JavaSVNDebugLogger logger = new JavaSVNDebugLogger(Boolean.getBoolean(LOG_PARAMETER_NAME), Boolean.getBoolean(TRACE_NATIVE_CALLS), LOG); SVNDebugLog.setDefaultLog(logger); @@ -275,7 +281,6 @@ public class SvnVcs extends AbstractVcs<CommittedChangeList> { // remove used some time before old notification group ids correctNotificationIds(); myChecker = new SvnExecutableChecker(myProject); - myConfiguration.getAuthenticationManager(this).setHelper(myHelper); } private void correctNotificationIds() { @@ -334,13 +339,15 @@ public class SvnVcs extends AbstractVcs<CommittedChangeList> { myCopiesRefreshManager.waitRefresh(new Runnable() { @Override public void run() { - callCleanupWorker.run(); + ApplicationManager.getApplication().invokeLater(callCleanupWorker, ModalityState.any()); } }); } public void invokeRefreshSvnRoots() { - REFRESH_LOG.debug("refresh: ", new Throwable()); + if (REFRESH_LOG.isDebugEnabled()) { + REFRESH_LOG.debug("refresh: ", new Throwable()); + } if (myCopiesRefreshManager != null) { myCopiesRefreshManager.asynchRequest(); } @@ -950,7 +957,7 @@ public class SvnVcs extends AbstractVcs<CommittedChangeList> { private final boolean myLoggingEnabled; private final boolean myLogNative; private final Logger myLog; - private final static long ourMaxFrequency = 10000; + private final static long ourErrorNotificationInterval = 10000; private long myPreviousTime = 0; public JavaSVNDebugLogger(boolean loggingEnabled, boolean logNative, Logger log) { @@ -967,9 +974,9 @@ public class SvnVcs extends AbstractVcs<CommittedChangeList> { public void log(final SVNLogType logType, final Throwable th, final Level logLevel) { if (th instanceof SSLHandshakeException) { final long time = System.currentTimeMillis(); - if ((time - myPreviousTime) > ourMaxFrequency) { + if ((time - myPreviousTime) > ourErrorNotificationInterval) { myPreviousTime = time; - String info = myHelper.getAddInfo(); + String info = SSLExceptionsHelper.getAddInfo(); info = info == null ? "" : " (" + info + ") "; if (th.getCause() instanceof CertificateException) { PopupUtil.showBalloonForActiveComponent("Subversion: " + info + th.getCause().getMessage(), MessageType.ERROR); @@ -1209,4 +1216,12 @@ public class SvnVcs extends AbstractVcs<CommittedChangeList> { public boolean areDirectoriesVersionedItems() { return true; } + + @Override + public CheckoutProvider getCheckoutProvider() { + if (myCheckoutProvider == null) { + myCheckoutProvider = new SvnCheckoutProvider(); + } + return myCheckoutProvider; + } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/CheckoutEventHandler.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/CheckoutEventHandler.java index 990dd00f66e7..365069668244 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/CheckoutEventHandler.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/CheckoutEventHandler.java @@ -16,6 +16,7 @@ package org.jetbrains.idea.svn.checkout; import com.intellij.openapi.progress.ProgressIndicator; +import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.wm.StatusBar; import org.jetbrains.idea.svn.SvnBundle; @@ -50,16 +51,15 @@ public class CheckoutEventHandler implements ISVNEventHandler { } if (event.getAction() == SVNEventAction.UPDATE_EXTERNAL) { myExternalsCount++; - myIndicator.setText(SvnBundle.message("progress.text2.fetching.external.location", event.getFile().getAbsolutePath())); - myIndicator.setText2(""); + ProgressManager.progress(SvnBundle.message("progress.text2.fetching.external.location", event.getFile().getAbsolutePath()), ""); } else if (event.getAction() == SVNEventAction.UPDATE_ADD) { - myIndicator.setText2(SvnBundle.message(myIsExport ? "progress.text2.exported" : "progress.text2.checked.out", event.getFile().getName(), myCnt)); + ProgressManager.progress2(SvnBundle.message(myIsExport ? "progress.text2.exported" : "progress.text2.checked.out", event.getFile().getName(), myCnt)); ++ myCnt; } else if (event.getAction() == SVNEventAction.UPDATE_COMPLETED) { myExternalsCount--; - myIndicator.setText2(SvnBundle.message(myIsExport ? "progress.text2.exported.revision" : "progress.text2.checked.out.revision", event.getRevision())); + ProgressManager.progress2((SvnBundle.message(myIsExport ? "progress.text2.exported.revision" : "progress.text2.checked.out.revision", event.getRevision()))); if (myExternalsCount == 0 && event.getRevision() >= 0 && myVCS != null) { myExternalsCount = 1; Project project = myVCS.getProject(); @@ -68,14 +68,14 @@ public class CheckoutEventHandler implements ISVNEventHandler { } } } else if (event.getAction() == SVNEventAction.COMMIT_ADDED) { - myIndicator.setText2(SvnBundle.message("progress.text2.adding", path)); + ProgressManager.progress2((SvnBundle.message("progress.text2.adding", path))); } else if (event.getAction() == SVNEventAction.COMMIT_DELTA_SENT) { - myIndicator.setText2(SvnBundle.message("progress.text2.transmitting.delta", path)); + ProgressManager.progress2((SvnBundle.message("progress.text2.transmitting.delta", path))); } } public void checkCancelled() throws SVNCancelException { - if (myIndicator.isCanceled()) { + if (myIndicator != null && myIndicator.isCanceled()) { throw new SVNCancelException(SVNErrorMessage.create(SVNErrorCode.CANCELLED, "Operation cancelled")); } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/SvnCheckoutProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/SvnCheckoutProvider.java index a0d53844dead..20fe62410668 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/SvnCheckoutProvider.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/SvnCheckoutProvider.java @@ -84,20 +84,19 @@ public class SvnCheckoutProvider implements CheckoutProvider { public void run(@NotNull final ProgressIndicator indicator) { SvnWorkingCopyFormatHolder.setPresetFormat(selectedFormat); - final ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator(); final SVNUpdateClient client = SvnVcs.getInstance(project).createUpdateClient(); if (! WorkingCopyFormat.ONE_DOT_SEVEN.equals(selectedFormat)) { client.getOperationsFactory().setPrimaryWcGeneration(SvnWcGeneration.V16); } - client.setEventHandler(new CheckoutEventHandler(SvnVcs.getInstance(project), false, progressIndicator)); + client.setEventHandler(new CheckoutEventHandler(SvnVcs.getInstance(project), false, ProgressManager.getInstance().getProgressIndicator())); client.setIgnoreExternals(ignoreExternals); try { - progressIndicator.setText(SvnBundle.message("progress.text.checking.out", target.getAbsolutePath())); + ProgressManager.progress(SvnBundle.message("progress.text.checking.out", target.getAbsolutePath())); if (! WorkingCopyFormat.ONE_DOT_SEVEN.equals(SvnWorkingCopyFormatHolder.getPresetFormat())) { client.getOperationsFactory().setPrimaryWcGeneration(SvnWcGeneration.V16); } client.doCheckout(SVNURL.parseURIEncoded(url), target, SVNRevision.UNDEFINED, revision, depth, true); - progressIndicator.checkCanceled(); + ProgressManager.checkCanceled(); checkoutSuccessful.set(Boolean.TRUE); } catch (SVNCancelException ignore) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnCommand.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnCommand.java index 4ae19f0c5fa2..5ef336a98428 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnCommand.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnCommand.java @@ -15,20 +15,21 @@ */ package org.jetbrains.idea.svn.commandLine; -import com.intellij.execution.ExecutionException; import com.intellij.execution.configurations.GeneralCommandLine; +import com.intellij.execution.process.OSProcessHandler; +import com.intellij.execution.process.ProcessEvent; +import com.intellij.execution.process.ProcessListener; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.Key; import com.intellij.openapi.vcs.ProcessEventListener; import com.intellij.util.EventDispatcher; -import com.intellij.util.Processor; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.idea.svn.SvnApplicationSettings; import org.jetbrains.idea.svn.SvnVcs; import java.io.File; -import java.io.OutputStream; import java.util.List; /** @@ -41,16 +42,16 @@ public abstract class SvnCommand { private static final Logger LOG = Logger.getInstance(SvnCommand.class.getName()); protected final Project myProject; + private boolean myIsDestroyed; + private int myExitCode; protected final GeneralCommandLine myCommandLine; private final File myWorkingDirectory; - protected Process myProcess; + private Process myProcess; + private OSProcessHandler myHandler; private final Object myLock; - private Integer myExitCode; // exit code or null if exit code is not yet available private final EventDispatcher<ProcessEventListener> myListeners = EventDispatcher.create(ProcessEventListener.class); - private Processor<OutputStream> myInputProcessor; // The processor for stdin - // todo check version /*c:\Program Files (x86)\CollabNet\Subversion Client17>svn --version --quiet 1.7.2*/ @@ -71,13 +72,9 @@ public abstract class SvnCommand { checkNotStarted(); try { - myProcess = startProcess(); - if (myProcess != null) { - startHandlingStreams(); - } else { - SvnVcs.getInstance(myProject).checkCommandLineVersion(); - myListeners.getMulticaster().startFailed(null); - } + myProcess = myCommandLine.createProcess(); + myHandler = new OSProcessHandler(myProcess, myCommandLine.getCommandLineString()); + startHandlingStreams(); } catch (Throwable t) { SvnVcs.getInstance(myProject).checkCommandLineVersion(); myListeners.getMulticaster().startFailed(t); @@ -85,21 +82,52 @@ public abstract class SvnCommand { } } + private void startHandlingStreams() { + final ProcessListener processListener = new ProcessListener() { + public void startNotified(final ProcessEvent event) { + // do nothing + } + + public void processTerminated(final ProcessEvent event) { + final int exitCode = event.getExitCode(); + try { + setExitCode(exitCode); + //cleanupEnv(); todo + SvnCommand.this.processTerminated(exitCode); + } finally { + listeners().processTerminated(exitCode); + } + } + + public void processWillTerminate(final ProcessEvent event, final boolean willBeDestroyed) { + // do nothing + } + + public void onTextAvailable(final ProcessEvent event, final Key outputType) { + SvnCommand.this.onTextAvailable(event.getText(), outputType); + } + }; + + myHandler.addProcessListener(processListener); + myHandler.startNotify(); + } + /** * Wait for process termination */ public void waitFor() { checkStarted(); - try { - if (myInputProcessor != null && myProcess != null) { - myInputProcessor.process(myProcess.getOutputStream()); - } - } - finally { - waitForProcess(); + final OSProcessHandler handler; + synchronized (myLock) { + if (myIsDestroyed) return; + handler = myHandler; } + handler.waitFor(); } + protected abstract void processTerminated(int exitCode); + protected abstract void onTextAvailable(final String text, final Key outputType); + public void cancel() { synchronized (myLock) { checkStarted(); @@ -139,15 +167,12 @@ public abstract class SvnCommand { } } - public abstract void destroyProcess(); - protected abstract void waitForProcess(); - - protected abstract Process startProcess() throws ExecutionException; - - /** - * Start handling process output streams for the handler. - */ - protected abstract void startHandlingStreams(); + public void destroyProcess() { + synchronized (myLock) { + myIsDestroyed = true; + myHandler.destroyProcess(); + } + } /** * check that process is not started yet @@ -179,4 +204,10 @@ public abstract class SvnCommand { return myProcess != null; } } + + protected int getExitCode() { + synchronized (myLock) { + return myExitCode; + } + } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnCommandLineInfoClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnCommandLineInfoClient.java index 937e2963d1d3..c2a0be1e2d6d 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnCommandLineInfoClient.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnCommandLineInfoClient.java @@ -123,17 +123,23 @@ public class SvnCommandLineInfoClient extends SvnkitSvnWcClient { } catch (VcsException e) { final String text = e.getMessage(); - if (!StringUtil.isEmptyOrSpaces(text) && text.contains("W155010")) { + final boolean notEmpty = !StringUtil.isEmptyOrSpaces(text); + if (notEmpty && text.contains("W155010")) { // just null return; } + // not a working copy exception + // "E155007: '' is not a working copy" + if (notEmpty && text.contains("is not a working copy")) { + throw new SVNException(SVNErrorMessage.create(SVNErrorCode.WC_NOT_WORKING_COPY), e); + } throw new SVNException(SVNErrorMessage.create(SVNErrorCode.IO_ERROR), e); } } private File correctUpToExistingParent(File base) { while (base != null) { - if (base.exists()) return base; + if (base.exists() && base.isDirectory()) return base; base = base.getParentFile(); } return null; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnCommandLineStatusClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnCommandLineStatusClient.java index 0c441e2af3fa..f45b5c7039d0 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnCommandLineStatusClient.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnCommandLineStatusClient.java @@ -24,6 +24,8 @@ import org.jetbrains.idea.svn.SvnUtil; import org.jetbrains.idea.svn.portable.PortableStatus; import org.jetbrains.idea.svn.portable.SvnExceptionWrapper; import org.jetbrains.idea.svn.portable.SvnStatusClientI; +import org.tmatesoft.sqljet.core.SqlJetErrorCode; +import org.tmatesoft.sqljet.core.SqlJetException; import org.tmatesoft.svn.core.*; import org.tmatesoft.svn.core.internal.util.SVNPathUtil; import org.tmatesoft.svn.core.wc.*; @@ -190,6 +192,10 @@ public class SvnCommandLineStatusClient implements SvnStatusClientI { @Override public void switchPath() { final PortableStatus pending = svnHandl[0].getPending(); + if (pending.isLocked()) { + throw new SvnExceptionWrapper(new SVNException(SVNErrorMessage.create(SVNErrorCode.SQLITE_ERROR), + new SqlJetException(SqlJetErrorCode.BUSY))); + } pending.setChangelistName(changelistName[0]); try { //if (infoBase != null) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnLineCommand.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnLineCommand.java index b50da56de3ab..cf31abde7f1a 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnLineCommand.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnLineCommand.java @@ -34,7 +34,7 @@ import java.util.Iterator; * * honestly stolen from GitLineHandler */ -public class SvnLineCommand extends SvnTextCommand { +public class SvnLineCommand extends SvnCommand { /** * the partial line from stdout stream */ diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnSimpleCommand.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnSimpleCommand.java index 7be3141155e9..6f68d390798e 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnSimpleCommand.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnSimpleCommand.java @@ -21,7 +21,6 @@ import com.intellij.openapi.util.Key; import com.intellij.openapi.vcs.ProcessEventListener; import com.intellij.openapi.vcs.VcsException; import org.jetbrains.annotations.NotNull; -import org.jetbrains.idea.svn.SvnVcs; import java.io.File; @@ -31,13 +30,16 @@ import java.io.File; * Date: 1/25/12 * Time: 4:04 PM */ -public class SvnSimpleCommand extends SvnTextCommand { +public class SvnSimpleCommand extends SvnCommand { private final StringBuilder myStderr; private final StringBuilder myStdout; + private VcsException myException; + private final Object myDataLock; public SvnSimpleCommand(Project project, File workingDirectory, @NotNull SvnCommandName commandName) { super(project, workingDirectory, commandName); + myDataLock = new Object(); myStderr = new StringBuilder(); myStdout = new StringBuilder(); } @@ -49,63 +51,60 @@ public class SvnSimpleCommand extends SvnTextCommand { @Override protected void onTextAvailable(String text, Key outputType) { - if (ProcessOutputTypes.STDOUT.equals(outputType)) { - myStdout.append(text); - } else if (ProcessOutputTypes.STDERR.equals(outputType)) { - myStderr.append(text); + synchronized (myDataLock) { + if (ProcessOutputTypes.STDOUT.equals(outputType)) { + myStdout.append(text); + } else if (ProcessOutputTypes.STDERR.equals(outputType)) { + myStderr.append(text); + } } } public StringBuilder getStderr() { - return myStderr; + synchronized (myDataLock) { + return myStderr; + } } public StringBuilder getStdout() { - return myStdout; + synchronized (myDataLock) { + return myStdout; + } } public String run() throws VcsException { - final VcsException[] ex = new VcsException[1]; - final String[] result = new String[1]; addListener(new ProcessEventListener() { @Override public void processTerminated(int exitCode) { - try { - if (exitCode == 0) { - result[0] = getStdout().toString(); - } - else { - String msg = getStderr().toString(); - if (msg.length() == 0) { - msg = getStdout().toString(); - } - if (msg.length() == 0) { - msg = "Svn process exited with error code: " + exitCode; - } - ex[0] = new VcsException(msg); - } - } - catch (Throwable t) { - ex[0] = new VcsException(t.toString(), t); - } } @Override public void startFailed(Throwable exception) { - ex[0] = new VcsException("Process failed to start (" + myCommandLine.getCommandLineString() + "): " + exception.toString(), exception); + synchronized (myDataLock) { + myException = new VcsException("Process failed to start (" + myCommandLine.getCommandLineString() + "): " + exception.toString(), exception); + } } }); start(); - if (myProcess != null) { + if (isStarted()) {//if wasn't started, exception is stored into a field, don't wait for process waitFor(); } - if (ex[0] != null) { - SvnVcs.getInstance(myProject).checkCommandLineVersion(); - throw ex[0]; - } - if (result[0] == null) { - throw new VcsException("Svn command returned null: " + myCommandLine.getCommandLineString()); + + synchronized (myDataLock) { + if (myException != null) throw myException; + final int code = getExitCode(); + if (code == 0) { + return myStdout.toString(); + } else { + String msg = myStderr.toString(); + if (msg.length() == 0) { + msg = getStdout().toString(); + } + if (msg.length() == 0) { + msg = "Svn process exited with error code: " + code; + } + throw new VcsException(msg); + } } - return result[0]; } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnStatusHandler.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnStatusHandler.java index 97c17447be80..84d25f59f4b3 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnStatusHandler.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnStatusHandler.java @@ -284,8 +284,8 @@ public class SvnStatusHandler extends DefaultHandler { if (createNewChild) { assertSAX(myElementsMap.containsKey(qName)); final ElementHandlerBase newChild = myElementsMap.get(qName).get(); - newChild.preEffect(myDataCallback); newChild.updateStatus(attributes, myPending, myLockWrapper); + newChild.preEffect(myDataCallback); myParseStack.add(newChild); return; } else { @@ -642,6 +642,11 @@ public class SvnStatusHandler extends DefaultHandler { status.setIsConflicted(true); } + final String switched = attributes.getValue("switched"); + if (switched != null && Boolean.parseBoolean(switched)) { + status.setIsSwitched(true); + } + final String revision = attributes.getValue("revision"); if (! StringUtil.isEmptyOrSpaces(revision)) { try { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnTextCommand.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnTextCommand.java deleted file mode 100644 index 8b6ec9b8f5f6..000000000000 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnTextCommand.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2000-2012 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.commandLine; - -import com.intellij.execution.ExecutionException; -import com.intellij.execution.process.OSProcessHandler; -import com.intellij.execution.process.ProcessEvent; -import com.intellij.execution.process.ProcessListener; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.Key; -import org.jetbrains.annotations.NotNull; - -import java.io.File; - -/** - * Created with IntelliJ IDEA. - * User: Irina.Chernushina - * Date: 1/25/12 - * Time: 3:09 PM - */ -public abstract class SvnTextCommand extends SvnCommand { - private boolean myIsDestroyed; - private OSProcessHandler myHandler; - - public SvnTextCommand(Project project, File workingDirectory, @NotNull SvnCommandName commandName) { - super(project, workingDirectory, commandName); - } - - @Override - protected void waitForProcess() { - if (myHandler != null) { - myHandler.waitFor(); - } - } - - @Override - protected Process startProcess() throws ExecutionException { - if (myIsDestroyed) return null; - final Process process = myCommandLine.createProcess(); - myHandler = new OSProcessHandler(process, myCommandLine.getCommandLineString()); - return myHandler.getProcess(); - } - - @Override - protected void startHandlingStreams() { - if (myIsDestroyed || myProcess == null) return; - - myHandler.addProcessListener(new ProcessListener() { - public void startNotified(final ProcessEvent event) { - // do nothing - } - - public void processTerminated(final ProcessEvent event) { - final int exitCode = event.getExitCode(); - try { - setExitCode(exitCode); - //cleanupEnv(); todo - SvnTextCommand.this.processTerminated(exitCode); - } finally { - listeners().processTerminated(exitCode); - } - } - - public void processWillTerminate(final ProcessEvent event, final boolean willBeDestroyed) { - // do nothing - } - - public void onTextAvailable(final ProcessEvent event, final Key outputType) { - SvnTextCommand.this.onTextAvailable(event.getText(), outputType); - } - }); - myHandler.startNotify(); - } - - protected abstract void processTerminated(int exitCode); - protected abstract void onTextAvailable(final String text, final Key outputType); - - @Override - public void destroyProcess() { - myIsDestroyed = true; - if (myHandler != null) { - myHandler.destroyProcess(); - } - } -} diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/AddRepositoryLocationDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/AddRepositoryLocationDialog.java index 92ec885de739..746c9d054666 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/AddRepositoryLocationDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/AddRepositoryLocationDialog.java @@ -19,6 +19,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.ui.MultiLineLabelUI; import com.intellij.util.ArrayUtil; +import org.jetbrains.annotations.NotNull; import org.jetbrains.idea.svn.SvnBundle; import org.tmatesoft.svn.core.SVNException; import org.tmatesoft.svn.core.SVNURL; @@ -141,6 +142,7 @@ public class AddRepositoryLocationDialog extends DialogWrapper { super.doOKAction(); } + @NotNull @Override protected Action[] createActions() { return new Action[]{getOKAction(), getCancelAction()}; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ChangeFormatDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ChangeFormatDialog.java index f6b74221bf39..39735901a73c 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ChangeFormatDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ChangeFormatDialog.java @@ -18,6 +18,7 @@ package org.jetbrains.idea.svn.dialogs; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.ui.MultiLineLabelUI; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.idea.svn.SvnBundle; @@ -35,6 +36,7 @@ public class ChangeFormatDialog extends UpgradeFormatDialog { init(); } + @NotNull @Override protected Action[] createActions() { return new Action[]{getOKAction(),getCancelAction()}; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CheckoutDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CheckoutDialog.java index d751553bc7c1..8e02d59b94c1 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CheckoutDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CheckoutDialog.java @@ -17,6 +17,7 @@ package org.jetbrains.idea.svn.dialogs; import com.intellij.openapi.project.Project; import com.intellij.openapi.vcs.CheckoutProvider; +import org.jetbrains.annotations.NotNull; import org.jetbrains.idea.svn.SvnBundle; import javax.swing.*; @@ -45,6 +46,7 @@ public class CheckoutDialog extends RepositoryBrowserDialog { getOKAction().setEnabled(getRepositoryBrowser().getSelectedURL() != null); } + @NotNull protected Action[] createActions() { return new Action[] {getOKAction(), getCancelAction(), getHelpAction()}; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CopyDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CopyDialog.java index 051aff2b4ec7..5b31c7b7b266 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CopyDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CopyDialog.java @@ -29,6 +29,7 @@ import com.intellij.ui.ComboboxWithBrowseButton; import com.intellij.ui.DocumentAdapter; import com.intellij.util.ArrayUtil; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; import org.jetbrains.idea.svn.RootUrlInfo; import org.jetbrains.idea.svn.SvnBranchConfigurationManager; import org.jetbrains.idea.svn.SvnBundle; @@ -245,6 +246,7 @@ public class CopyDialog extends DialogWrapper { getOKAction().setEnabled(isOKActionEnabled()); } + @NotNull protected Action[] createActions() { return new Action[]{getOKAction(), getCancelAction(), getHelpAction()}; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ImportDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ImportDialog.java index f5c6d284e52a..50b22c1f8178 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ImportDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ImportDialog.java @@ -17,6 +17,7 @@ package org.jetbrains.idea.svn.dialogs; import com.intellij.openapi.help.HelpManager; import com.intellij.openapi.project.Project; +import org.jetbrains.annotations.NotNull; import org.jetbrains.idea.svn.SvnBundle; import javax.swing.*; @@ -42,6 +43,7 @@ public class ImportDialog extends RepositoryBrowserDialog { updateOKAction(); } + @NotNull protected Action[] createActions() { return new Action[] {getOKAction(), getCancelAction(), getHelpAction()}; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/LockDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/LockDialog.java index b7a980500a5c..38f5248758df 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/LockDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/LockDialog.java @@ -20,6 +20,7 @@ import com.intellij.openapi.project.Project; import com.intellij.ui.ScrollPaneFactory; import com.intellij.util.ui.OptionsDialog; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; import org.jetbrains.idea.svn.SvnBundle; import org.jetbrains.idea.svn.SvnVcs; @@ -45,6 +46,7 @@ public class LockDialog extends OptionsDialog { } + @NotNull protected Action[] createActions() { return new Action[]{getOKAction(), getCancelAction(), getHelpAction()}; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserDialog.java index 64d4afd743c3..ca596e92fefc 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserDialog.java @@ -125,6 +125,7 @@ public class RepositoryBrowserDialog extends DialogWrapper { return "reference.svn.repository"; } + @NotNull protected Action[] createActions() { return new Action[] {getOKAction(), getHelpAction()}; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SSHCredentialsDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SSHCredentialsDialog.java index 67d7956fc576..5f5e37b2e13d 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SSHCredentialsDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SSHCredentialsDialog.java @@ -32,6 +32,7 @@ import com.intellij.util.SystemProperties; import com.intellij.util.ui.UIUtil; import com.trilead.ssh2.crypto.PEMDecoder; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; import org.jetbrains.idea.svn.SvnBundle; import org.tmatesoft.svn.core.internal.io.svn.SVNSSHPrivateKeyUtil; @@ -89,6 +90,7 @@ public class SSHCredentialsDialog extends DialogWrapper implements ActionListene HelpManager.getInstance().invokeHelp(HELP_ID); } + @NotNull protected Action[] createActions() { return new Action[]{getOKAction(), getCancelAction(), getHelpAction()}; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SSLCredentialsDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SSLCredentialsDialog.java index a5d0bb7f56d5..44e503fe08d2 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SSLCredentialsDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SSLCredentialsDialog.java @@ -20,6 +20,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.ui.TextFieldWithBrowseButton; import com.intellij.util.ui.UIUtil; +import org.jetbrains.annotations.NotNull; import org.jetbrains.idea.svn.SvnBundle; import javax.swing.*; @@ -42,6 +43,7 @@ public class SSLCredentialsDialog extends DialogWrapper { return "svn.sslCredentialsDialog"; } + @NotNull protected Action[] createActions() { return new Action[]{getOKAction(), getCancelAction()}; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SelectCreateExternalTargetDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SelectCreateExternalTargetDialog.java index 4fefe1c92d87..9c1bad123f8b 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SelectCreateExternalTargetDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SelectCreateExternalTargetDialog.java @@ -22,6 +22,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.containers.hash.HashSet; +import org.jetbrains.annotations.NotNull; import org.tmatesoft.svn.core.internal.util.SVNPathUtil; import javax.swing.*; @@ -90,6 +91,7 @@ public class SelectCreateExternalTargetDialog extends RepositoryBrowserDialog { getOKAction().setEnabled(enabled); } + @NotNull protected Action[] createActions() { return new Action[] {getOKAction(), getCancelAction()}; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SelectFilesDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SelectFilesDialog.java index 66a82cd943cd..dcffa18e387d 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SelectFilesDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SelectFilesDialog.java @@ -23,6 +23,7 @@ import com.intellij.ui.OrderPanelListener; import com.intellij.ui.ScrollPaneFactory; import com.intellij.util.ArrayUtil; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; import org.jetbrains.idea.svn.SvnBundle; import javax.swing.*; @@ -67,6 +68,7 @@ public class SelectFilesDialog extends DialogWrapper implements ActionListener { } } + @NotNull protected Action[] createActions() { return new Action[]{getOKAction(), getCancelAction(), getHelpAction()}; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SelectLocationDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SelectLocationDialog.java index 01186c0b1f3e..8e0e4218d748 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SelectLocationDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SelectLocationDialog.java @@ -23,6 +23,7 @@ import com.intellij.openapi.ui.Messages; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.Ref; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.idea.svn.SvnBundle; import org.jetbrains.idea.svn.SvnVcs; @@ -106,6 +107,7 @@ public class SelectLocationDialog extends DialogWrapper { HelpManager.getInstance().invokeHelp(HELP_ID); } + @NotNull protected Action[] createActions() { return new Action[]{getOKAction(), getCancelAction(), getHelpAction()}; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ServerSSHDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ServerSSHDialog.java index 981d497eedeb..30ef5216614c 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ServerSSHDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ServerSSHDialog.java @@ -59,6 +59,7 @@ public class ServerSSHDialog extends DialogWrapper { return false; } + @NotNull protected Action[] createActions() { return new Action[]{getOKAction(), getCancelAction()}; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ServerSSLDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ServerSSLDialog.java index 64a9e23c3916..3506e5859a4c 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ServerSSLDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ServerSSLDialog.java @@ -19,6 +19,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.ui.ScrollPaneFactory; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; import org.jetbrains.idea.svn.SvnBundle; import org.tmatesoft.svn.core.auth.ISVNAuthenticationProvider; @@ -54,6 +55,7 @@ public class ServerSSLDialog extends DialogWrapper { return false; } + @NotNull protected Action[] createActions() { return new Action[]{getOKAction(), getTempAction(), getCancelAction()}; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SetPropertyDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SetPropertyDialog.java index 82e90854d1a4..486fe2c4355e 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SetPropertyDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SetPropertyDialog.java @@ -20,6 +20,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.ui.DocumentAdapter; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; import org.jetbrains.idea.svn.SvnBundle; import org.jetbrains.idea.svn.SvnPropertyKeys; import org.jetbrains.idea.svn.SvnVcs; @@ -76,6 +77,7 @@ public class SetPropertyDialog extends DialogWrapper { HelpManager.getInstance().invokeHelp(HELP_ID); } + @NotNull protected Action[] createActions() { return new Action[]{getOKAction(), getCancelAction(), getHelpAction()}; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ShareDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ShareDialog.java index b2be62d7ee9d..95b137115407 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ShareDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ShareDialog.java @@ -25,6 +25,7 @@ import com.intellij.openapi.vcs.changes.ChangeListManager; import com.intellij.openapi.vcs.changes.LocalChangeList; import com.intellij.openapi.vcs.changes.ui.EditChangelistSupport; import com.intellij.openapi.vcs.ui.CommitMessage; +import org.jetbrains.annotations.NotNull; import javax.swing.*; import javax.swing.event.ChangeEvent; @@ -110,6 +111,7 @@ public class ShareDialog extends RepositoryBrowserDialog { return myPrefferedFocused; } + @NotNull protected Action[] createActions() { return new Action[] {getOKAction(), getCancelAction(), getHelpAction()}; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SimpleCredentialsDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SimpleCredentialsDialog.java index a5c322d4efac..3c11acb0e14b 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SimpleCredentialsDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SimpleCredentialsDialog.java @@ -20,6 +20,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; import org.jetbrains.idea.svn.SvnBundle; import javax.swing.*; @@ -57,6 +58,7 @@ public class SimpleCredentialsDialog extends DialogWrapper implements DocumentLi HelpManager.getInstance().invokeHelp(HELP_ID); } + @NotNull protected Action[] createActions() { return new Action[]{getOKAction(), getCancelAction(), getHelpAction()}; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ToBeMergedDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ToBeMergedDialog.java index 4e739c1aa6f1..91d8bdb4a422 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ToBeMergedDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ToBeMergedDialog.java @@ -41,6 +41,7 @@ import com.intellij.util.containers.Convertor; import com.intellij.util.ui.ColumnInfo; import com.intellij.util.ui.ListTableModel; import com.intellij.util.ui.UIUtil; +import org.jetbrains.annotations.NotNull; import org.jetbrains.idea.svn.history.SvnChangeList; import org.jetbrains.idea.svn.mergeinfo.MergeChecker; @@ -88,6 +89,7 @@ public class ToBeMergedDialog extends DialogWrapper { init(); } + @NotNull @Override protected Action[] createActions() { return new Action[]{getOKAction(), new DialogWrapperAction("Merge All") { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/UpgradeFormatDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/UpgradeFormatDialog.java index 7d9c93fb8af9..a174c59f60d1 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/UpgradeFormatDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/UpgradeFormatDialog.java @@ -20,6 +20,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.ui.MultiLineLabelUI; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.idea.svn.SvnBundle; import org.jetbrains.idea.svn.SvnConfiguration; @@ -53,6 +54,7 @@ public class UpgradeFormatDialog extends DialogWrapper { } } + @NotNull protected Action[] createActions() { return new Action[]{getOKAction(), getCancelAction()}; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/UserNameCredentialsDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/UserNameCredentialsDialog.java index fac0009247d0..3896c020f880 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/UserNameCredentialsDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/UserNameCredentialsDialog.java @@ -20,6 +20,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; import org.jetbrains.idea.svn.SvnBundle; import javax.swing.*; @@ -54,6 +55,7 @@ public class UserNameCredentialsDialog extends DialogWrapper implements Document HelpManager.getInstance().invokeHelp(HELP_ID); } + @NotNull protected Action[] createActions() { return new Action[]{getOKAction(), getCancelAction(), getHelpAction()}; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/portable/PortableStatus.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/portable/PortableStatus.java index c834e3a17dbb..184d5598f9fe 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/portable/PortableStatus.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/portable/PortableStatus.java @@ -241,6 +241,19 @@ public class PortableStatus extends SVNStatus { return url == null ? null : url.toString(); } + @Override + public SVNRevision getRevision() { + final SVNRevision revision = super.getRevision(); + if (revision != null && revision.isValid()) return revision; + + final SVNStatusType status = getContentsStatus(); + if (SVNStatusType.STATUS_NONE.equals(status) || SVNStatusType.STATUS_UNVERSIONED.equals(status) || + SVNStatusType.STATUS_ADDED.equals(status)) return revision; + + final SVNInfo info = initInfo(); + return info == null ? revision : info.getRevision(); + } + /** * Gets the revision of the item's ancestor from which the item was copied * (the item is added with history). diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/SvnTestCase.java b/plugins/svn4idea/testSource/org/jetbrains/idea/SvnTestCase.java index 75185e9b9082..25e5f71f7826 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/SvnTestCase.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/SvnTestCase.java @@ -32,6 +32,7 @@ import com.intellij.openapi.ui.Messages; import com.intellij.openapi.ui.TestDialog; import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vcs.VcsConfiguration; import com.intellij.openapi.vcs.VcsException; import com.intellij.openapi.vcs.VcsShowConfirmationOption; @@ -50,6 +51,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.Processor; import com.intellij.util.concurrency.Semaphore; import com.intellij.util.io.ZipUtil; import com.intellij.util.ui.UIUtil; @@ -67,9 +69,7 @@ import org.junit.Before; import java.io.File; import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; +import java.util.*; import static org.junit.Assert.assertTrue; @@ -81,7 +81,7 @@ public abstract class SvnTestCase extends AbstractJunitVcsTestCase { protected String myRepoUrl; protected TestClientRunner myRunner; protected String myWcRootName; - protected boolean myUseNativeAcceleration; + protected boolean myUseNativeAcceleration = new GregorianCalendar().get(Calendar.HOUR_OF_DAY) % 2 == 0; private final String myTestDataDir; private File myRepoRoot; @@ -116,6 +116,7 @@ public abstract class SvnTestCase extends AbstractJunitVcsTestCase { @Before public void setUp() throws Exception { + System.out.println("Native client for status: " + myUseNativeAcceleration); UIUtil.invokeAndWaitIfNeeded(new Runnable() { @Override public void run() { @@ -160,11 +161,11 @@ public abstract class SvnTestCase extends AbstractJunitVcsTestCase { myRepoUrl = (SystemInfo.isWindows ? "file:///" : "file://") + FileUtil.toSystemIndependentName(myRepoRoot.getPath()); + verify(runSvn("co", myRepoUrl, myWcRoot.getPath())); + initProject(myWcRoot, SvnTestCase.this.getTestName()); activateVCS(SvnVcs.VCS_NAME); - verify(runSvn("co", myRepoUrl, myWorkingCopyDir.getPath())); - myGate = new MockChangeListManagerGate(ChangeListManager.getInstance(myProject)); ((StartupManagerImpl) StartupManager.getInstance(myProject)).runPostStartupActivities(); @@ -210,6 +211,8 @@ public abstract class SvnTestCase extends AbstractJunitVcsTestCase { @After public void tearDown() throws Exception { + ((ChangeListManagerImpl) ChangeListManager.getInstance(myProject)).stopEveryThingIfInTestMode(); + sleep(100); UIUtil.invokeAndWaitIfNeeded(new Runnable() { @Override public void run() { @@ -248,11 +251,11 @@ public abstract class SvnTestCase extends AbstractJunitVcsTestCase { } protected void checkin() throws IOException { - verify(runSvn("ci", "-m", "test")); + runInAndVerifyIgnoreOutput("ci", "-m", "test"); } protected void update() throws IOException { - verify(runSvn("up")); + runInAndVerifyIgnoreOutput("up"); } protected List<Change> getChangesInScope(final VcsDirtyScope dirtyScope) throws VcsException { @@ -323,23 +326,29 @@ public abstract class SvnTestCase extends AbstractJunitVcsTestCase { public String prepareBranchesStructure() throws Exception { final SvnVcs vcs = SvnVcs.getInstance(myProject); final String mainUrl = myRepoUrl + "/trunk"; - verify(runSvn("mkdir", "-m", "mkdir", mainUrl)); - verify(runSvn("mkdir", "-m", "mkdir", myRepoUrl + "/branches")); - verify(runSvn("mkdir", "-m", "mkdir", myRepoUrl + "/tags")); + runInAndVerifyIgnoreOutput("mkdir", "-m", "mkdir", mainUrl); + runInAndVerifyIgnoreOutput("mkdir", "-m", "mkdir", myRepoUrl + "/branches"); + runInAndVerifyIgnoreOutput("mkdir", "-m", "mkdir", myRepoUrl + "/tags"); final ChangeListManagerImpl clManager = (ChangeListManagerImpl)ChangeListManager.getInstance(myProject); clManager.stopEveryThingIfInTestMode(); sleep(100); - Assert.assertTrue(FileUtil.delete(new File(myWorkingCopyDir.getPath() + File.separator + ".svn"))); + boolean deleted = false; + for (int i = 0; i < 5; i++) { + deleted = FileUtil.delete(new File(myWorkingCopyDir.getPath() + File.separator + ".svn")); + if (deleted) break; + sleep(200); + } + Assert.assertTrue(deleted); sleep(200); myWorkingCopyDir.refresh(false, true); - verify(runSvn("co", mainUrl, myWorkingCopyDir.getPath())); + runInAndVerifyIgnoreOutput("co", mainUrl, myWorkingCopyDir.getPath()); enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD); final SubTree tree = new SubTree(myWorkingCopyDir); checkin(); final String branchUrl = myRepoUrl + "/branches/b1"; - verify(runSvn("copy", "-q", "-m", "coppy", mainUrl, branchUrl)); + runInAndVerifyIgnoreOutput("copy", "-q", "-m", "coppy", mainUrl, branchUrl); clManager.forceGoInTestMode(); refreshSvnMappingsSynchronously(); @@ -378,15 +387,15 @@ public abstract class SvnTestCase extends AbstractJunitVcsTestCase { myWorkingCopyDir.refresh(false, true); final File sourceDir = new File(myWorkingCopyDir.getPath(), "source"); - verify(runSvn("co", mainUrl, sourceDir.getPath())); + runInAndVerifyIgnoreOutput("co", mainUrl, sourceDir.getPath()); CreateExternalAction.addToExternalProperty(vcs, sourceDir, "external", externalURL); sleep(100); if (updateExternal) { - verify(runSvn("up", sourceDir.getPath())); + runInAndVerifyIgnoreOutput("up", sourceDir.getPath()); } if (commitExternalDefinition) { - verify(runSvn("ci", "-m", "test", sourceDir.getPath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", sourceDir.getPath()); } sleep(100); @@ -409,12 +418,12 @@ public abstract class SvnTestCase extends AbstractJunitVcsTestCase { 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())); + runInAndVerifyIgnoreOutput("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")); + runInAndVerifyIgnoreOutput(tmpWc, "add", "root"); + runInAndVerifyIgnoreOutput(tmpWc, "ci", "-m", "fff"); FileUtil.delete(tmpWc); } @@ -439,4 +448,103 @@ public abstract class SvnTestCase extends AbstractJunitVcsTestCase { clManager.ensureUpToDate(false); // wait for after-events like annotations recalculation sleep(100); // zipper updater } + + protected void runAndVerifyStatusSorted(final String... stdoutLines) throws IOException { + runStatusAcrossLocks(myWcRoot, true, stdoutLines); + } + + protected void runAndVerifyStatus(final String... stdoutLines) throws IOException { + runStatusAcrossLocks(myWcRoot, false, stdoutLines); + } + + private void runStatusAcrossLocks(@Nullable File workingDir, final boolean sorted, final String... stdoutLines) throws IOException { + final Processor<ProcessOutput> primitiveVerifier = new Processor<ProcessOutput>() { + @Override + public boolean process(ProcessOutput output) { + if (sorted) { + verifySorted(output, stdoutLines); // will assert if err not empty + } else { + verify(output, stdoutLines); // will assert if err not empty + } + return false; + } + }; + runAndVerifyAcrossLocks(workingDir, new String[]{"status"}, new Processor<ProcessOutput>() { + @Override + public boolean process(ProcessOutput output) { + final List<String> lines = output.getStdoutLines(); + for (String line : lines) { + if (line.trim().startsWith("L")) { + return true; // i.e. continue tries + } + } + primitiveVerifier.process(output); + return false; + } + }, primitiveVerifier); + } + + protected void runInAndVerifyIgnoreOutput(final String... inLines) throws IOException { + final Processor<ProcessOutput> verifier = createPrimitiveExitCodeVerifier(); + runAndVerifyAcrossLocks(myWcRoot, myRunner, inLines, verifier, verifier); + } + + private static Processor<ProcessOutput> createPrimitiveExitCodeVerifier() { + return new Processor<ProcessOutput>() { + @Override + public boolean process(ProcessOutput output) { + Assert.assertEquals(output.getStderr(), 0, output.getExitCode()); + return false; + } + }; + } + + public static void runInAndVerifyIgnoreOutput(File workingDir, final TestClientRunner runner, final String[] input, final String... stdoutLines) throws IOException { + final Processor<ProcessOutput> verifier = createPrimitiveExitCodeVerifier(); + runAndVerifyAcrossLocks(workingDir, runner, input, verifier, verifier); + } + + protected void runInAndVerifyIgnoreOutput(final File root, final String... inLines) throws IOException { + final Processor<ProcessOutput> verifier = createPrimitiveExitCodeVerifier(); + runAndVerifyAcrossLocks(root, myRunner, inLines, verifier, verifier); + } + + private void runAndVerifyAcrossLocks(@Nullable File workingDir, final String[] input, final Processor<ProcessOutput> verifier, + final Processor<ProcessOutput> primitiveVerifier) throws IOException { + workingDir = workingDir == null ? myWcRoot : workingDir; + runAndVerifyAcrossLocks(workingDir, myRunner, input, verifier, primitiveVerifier); + } + + /** + * @param verifier - if returns true, try again + */ + public static void runAndVerifyAcrossLocks(File workingDir, final TestClientRunner runner, final String[] input, + final Processor<ProcessOutput> verifier, final Processor<ProcessOutput> primitiveVerifier) throws IOException { + for (int i = 0; i < 5; i++) { + final ProcessOutput output = runner.runClient("svn", null, workingDir, input); + if (output.getExitCode() == 0) { + if (verifier.process(output)) { + continue; + } + return; + } + + if (! StringUtil.isEmptyOrSpaces(output.getStderr())) { + final String stderr = output.getStderr(); + /*svn: E155004: Working copy '' locked. + svn: E155004: '' is already locked. + svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details)*/ + if (stderr.contains("E155004") && stderr.contains("is already locked")) { + continue; + } + } + // will throw assertion + if (verifier.process(output)) { + continue; + } + return; + } + final ProcessOutput output = runner.runClient("svn", null, workingDir, input); + primitiveVerifier.process(output); + } } diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnAddTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnAddTest.java index 7e87cb18f553..33ac9723c62a 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnAddTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnAddTest.java @@ -15,7 +15,6 @@ */ package org.jetbrains.idea.svn; -import com.intellij.execution.process.ProcessOutput; import com.intellij.openapi.command.WriteCommandAction; import com.intellij.openapi.vcs.VcsConfiguration; import com.intellij.openapi.vcs.VcsException; @@ -38,7 +37,7 @@ public class SvnAddTest extends Svn17TestCase { final VirtualFile file = createFileInCommand("a.txt", "old content"); checkin(); copyFileInCommand(file, "b.txt"); - verify(runSvn("status"), "A + b.txt"); + runAndVerifyStatusSorted("A + b.txt"); } // IDEADEV-16268 @@ -58,8 +57,7 @@ public class SvnAddTest extends Svn17TestCase { } }.execute(); - final ProcessOutput result = runSvn("status"); - verify(result, "A child", "A child" + File.separatorChar + "a.txt"); + runAndVerifyStatusSorted("A child", "A child" + File.separatorChar + "a.txt"); } // IDEADEV-19308 @@ -69,7 +67,7 @@ public class SvnAddTest extends Svn17TestCase { final VirtualFile dir = createDirInCommand(myWorkingCopyDir, "dir"); final VirtualFile file = createFileInCommand(dir, "a.txt", "content"); - verify(runSvn("status"), "? dir"); + runAndVerifyStatusSorted("? dir"); final List<VirtualFile> files = new ArrayList<VirtualFile>(); files.add(file); @@ -85,7 +83,7 @@ public class SvnAddTest extends Svn17TestCase { createFileInCommand("a.txt", "old content"); checkin(); undo(); - verify(runSvn("status"), "D a.txt"); + runAndVerifyStatusSorted("D a.txt"); Assert.assertFalse(new File(myWorkingCopyDir.getPath(), "a.txt").exists()); } } diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnAnnotationIsClosedTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnAnnotationIsClosedTest.java index c5268c9594d6..c6795b034068 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnAnnotationIsClosedTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnAnnotationIsClosedTest.java @@ -114,7 +114,7 @@ public class SvnAnnotationIsClosedTest extends Svn17TestCase { checkin(); //#2 editFileInCommand(myProject, tree.myS1File, "1\n2\n3**\n4\n"); checkin(); //#3 - verify(runSvn("up", "-r", "2")); + runInAndVerifyIgnoreOutput("up", "-r", "2"); final VcsAnnotationLocalChangesListener listener = ProjectLevelVcsManager.getInstance(myProject).getAnnotationLocalChangesListener(); final FileAnnotation annotation = myVcs.getAnnotationProvider().annotate(tree.myS1File); @@ -159,7 +159,7 @@ public class SvnAnnotationIsClosedTest extends Svn17TestCase { checkin(); //#2 editFileInCommand(myProject, tree.myS1File, "1\n2\n3**\n4\n"); checkin(); //#3 - verify(runSvn("up", "-r", "2")); // take #2 + runInAndVerifyIgnoreOutput("up", "-r", "2"); // take #2 final VcsAnnotationLocalChangesListener listener = ProjectLevelVcsManager.getInstance(myProject).getAnnotationLocalChangesListener(); final FileAnnotation annotation = myVcs.getAnnotationProvider().annotate(tree.myS1File); @@ -206,7 +206,7 @@ public class SvnAnnotationIsClosedTest extends Svn17TestCase { checkin(); //#2 editFileInCommand(myProject, tree.myS1File, "1\n2\n3**\n4\n"); checkin(); //#3 - verify(runSvn("up", "-r", "2")); // take #2 + runInAndVerifyIgnoreOutput("up", "-r", "2"); // take #2 final VcsAnnotationLocalChangesListener listener = ProjectLevelVcsManager.getInstance(myProject).getAnnotationLocalChangesListener(); final FileAnnotation annotation = myVcs.getAnnotationProvider().annotate(tree.myS1File); @@ -356,19 +356,19 @@ public class SvnAnnotationIsClosedTest extends Svn17TestCase { final File sourceDir = new File(myWorkingCopyDir.getPath(), "source"); final File externalDir = new File(myWorkingCopyDir.getPath(), "source/external"); - verify(runSvn("ci", "-m", "test", sourceDir.getPath())); // #3 - verify(runSvn("ci", "-m", "test", externalDir.getPath())); // #4 + runInAndVerifyIgnoreOutput("ci", "-m", "test", sourceDir.getPath()); // #3 + runInAndVerifyIgnoreOutput("ci", "-m", "test", externalDir.getPath()); // #4 editFileInCommand(myProject, vf2, "test externals 12344444" + System.currentTimeMillis()); - verify(runSvn("ci", "-m", "test", externalDir.getPath())); // #5 + runInAndVerifyIgnoreOutput("ci", "-m", "test", externalDir.getPath()); // #5 final SvnDiffProvider diffProvider = (SvnDiffProvider) myVcs.getDiffProvider(); assertRevision(vf1, diffProvider, 3); assertRevision(vf2, diffProvider, 5); - verify(runSvn("up", "-r", "4", sourceDir.getPath())); - verify(runSvn("up", "-r", "4", externalDir.getPath())); + runInAndVerifyIgnoreOutput("up", "-r", "4", sourceDir.getPath()); + runInAndVerifyIgnoreOutput("up", "-r", "4", externalDir.getPath()); assertRevision(vf1, diffProvider, 3); assertRevision(vf2, diffProvider, 4); @@ -396,7 +396,7 @@ public class SvnAnnotationIsClosedTest extends Svn17TestCase { listener.registerAnnotation(vf1, annotation1); //up - verify(runSvn("up", sourceDir.getPath())); + runInAndVerifyIgnoreOutput("up", sourceDir.getPath()); imitateEvent(lfs.refreshAndFindFileByIoFile(sourceDir)); imitateEvent(lfs.refreshAndFindFileByIoFile(externalDir)); myChangeListManager.ensureUpToDate(false); diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnAuthenticationTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnAuthenticationTest.java index 3885109c898b..de273690fd73 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnAuthenticationTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnAuthenticationTest.java @@ -969,49 +969,6 @@ public class SvnAuthenticationTest extends PlatformTestCase { } } - private static class SvnTestInteractiveAuthentication implements ISVNAuthenticationProvider { - private final SvnAuthenticationManager myManager; - private boolean mySaveData; - - public SvnTestInteractiveAuthentication(SvnAuthenticationManager manager) { - myManager = manager; - mySaveData = true; - } - - public void setSaveData(boolean saveData) { - mySaveData = saveData; - } - - @Override - public int acceptServerAuthentication(SVNURL url, String realm, Object certificate, boolean resultMayBeStored) { - return ISVNAuthenticationProvider.REJECTED; - } - - @Override - public SVNAuthentication requestClientAuthentication(String kind, - SVNURL url, - String realm, - SVNErrorMessage errorMessage, - SVNAuthentication previousAuth, - boolean authMayBeStored) { - authMayBeStored = authMayBeStored && mySaveData; - SVNAuthentication result = null; - if (ISVNAuthenticationManager.USERNAME.equals(kind)) { - result = new SVNUserNameAuthentication("username", authMayBeStored); - } else if (ISVNAuthenticationManager.PASSWORD.equals(kind)) { - result = new SVNPasswordAuthentication("username", "abc", authMayBeStored, url, false); - } else if (ISVNAuthenticationManager.SSH.equals(kind)) { - result = new SVNSSHAuthentication("username", "abc", -1, authMayBeStored, url, false); - } else if (ISVNAuthenticationManager.SSL.equals(kind)) { - result = new SVNSSLAuthentication(new File("aaa"), "abc", authMayBeStored, url, false); - } - if (! ISVNAuthenticationManager.USERNAME.equals(kind)) { - myManager.requested(ProviderType.interactive, url, realm, kind, result == null); - } - return result; - } - } - private static boolean passwordSpecified(final SVNAuthentication authentication) { final String kind = authentication.getKind(); if (ISVNAuthenticationManager.SSH.equals(kind)) { diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnChangesCorrectlyRefreshedTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnChangesCorrectlyRefreshedTest.java index 19027475085d..b16e8e1ca897 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnChangesCorrectlyRefreshedTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnChangesCorrectlyRefreshedTest.java @@ -69,7 +69,9 @@ public class SvnChangesCorrectlyRefreshedTest extends Svn17TestCase { if (updateException != null) { updateException.printStackTrace(); } - Assert.assertNull(updateException == null ? null : updateException.getMessage(), updateException); + if (! SvnVcs.ourBusyExceptionProcessor.process(updateException)) { + Assert.assertNull(updateException == null ? null : updateException.getMessage(), updateException); + } DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {subTree.myS1File}, clManager.getDefaultListName(), clManager); diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnClientRunnerImpl.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnClientRunnerImpl.java index eceaac98c4c4..5ab82b6c40b1 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnClientRunnerImpl.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnClientRunnerImpl.java @@ -17,8 +17,8 @@ package org.jetbrains.idea.svn; import com.intellij.execution.process.ProcessOutput; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.testFramework.vcs.AbstractVcsTestCase; import com.intellij.testFramework.vcs.TestClientRunner; +import org.jetbrains.idea.SvnTestCase; import java.io.File; import java.io.IOException; @@ -43,36 +43,36 @@ public class SvnClientRunnerImpl implements SvnClientRunner { @Override public void checkin(final VirtualFile file) throws IOException { - AbstractVcsTestCase.verify(runSvn(file, "ci", "-m", "test", file.getPath())); + SvnTestCase.runInAndVerifyIgnoreOutput(new File(file.getPath()), myTestClientRunner, new String[]{"ci", "-m", "test", file.getPath()}); } @Override public void update(final VirtualFile file) throws IOException { - AbstractVcsTestCase.verify(runSvn(file, "up", "--accept", "postpone", file.getPath())); + SvnTestCase.runInAndVerifyIgnoreOutput(new File(file.getPath()), myTestClientRunner, new String[]{"up", "--accept", "postpone", file.getPath()}); } @Override public void checkout(final String repoUrl, final VirtualFile file) throws IOException { - AbstractVcsTestCase.verify(runSvn(file, "co", repoUrl, file.getPath())); + SvnTestCase.runInAndVerifyIgnoreOutput(new File(file.getPath()), myTestClientRunner, new String[]{"co", repoUrl, file.getPath()}); } @Override public void add(VirtualFile root, String path) throws IOException { - AbstractVcsTestCase.verify(runSvn(root, "add", path)); + SvnTestCase.runInAndVerifyIgnoreOutput(new File(root.getPath()), myTestClientRunner, new String[]{"add", path}); } @Override public void delete(VirtualFile root, String path) throws IOException { - AbstractVcsTestCase.verify(runSvn(root, "delete", path)); + SvnTestCase.runInAndVerifyIgnoreOutput(new File(root.getPath()), myTestClientRunner, new String[]{"delete", path}); } @Override public void copy(VirtualFile root, String path, String from) throws IOException { - AbstractVcsTestCase.verify(runSvn(root, "copy", path, from)); + SvnTestCase.runInAndVerifyIgnoreOutput(new File(root.getPath()), myTestClientRunner, new String[]{"copy", path, from}); } @Override public void testSvnVersion(VirtualFile root) throws IOException { - AbstractVcsTestCase.verify(runSvn(root, "--version")); + SvnTestCase.runInAndVerifyIgnoreOutput(new File(root.getPath()), myTestClientRunner, new String[]{"--version"}); } } diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCommandLineStabilityTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCommandLineStabilityTest.java new file mode 100644 index 000000000000..e699a1a8069b --- /dev/null +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCommandLineStabilityTest.java @@ -0,0 +1,33 @@ +package org.jetbrains.idea.svn; + +import com.intellij.openapi.vcs.VcsException; +import junit.framework.Assert; +import org.jetbrains.idea.svn.commandLine.SvnCommandName; +import org.jetbrains.idea.svn.commandLine.SvnSimpleCommand; +import org.junit.Test; + +import java.io.File; + +/** + * Created with IntelliJ IDEA. + * User: Irina.Chernushina + * Date: 2/19/13 + * Time: 11:45 AM + */ +public class SvnCommandLineStabilityTest extends Svn17TestCase { + @Test + public void testCallInfoManyTimes() throws Exception { + for (int i = 0; i < 200; i++) { + call(); + try { Thread.sleep(5); } catch (InterruptedException e) {} + } + } + + private void call() throws VcsException { + final SvnSimpleCommand command = new SvnSimpleCommand(myProject, new File(myWorkingCopyDir.getPath()), SvnCommandName.info); + command.addParameters("--xml"); + final String result = command.run(); + System.out.println(result); + Assert.assertNotNull(result); + } +} diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCommittedViewTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCommittedViewTest.java index c863f8e7e369..4e0ed8e1030a 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCommittedViewTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCommittedViewTest.java @@ -113,10 +113,10 @@ public class SvnCommittedViewTest extends Svn17TestCase { File dir = new File(d1.getPath()); final String d1Path = dir.getAbsolutePath(); - verify(runSvn("delete", d1Path)); + runInAndVerifyIgnoreOutput("delete", d1Path); boolean created = dir.mkdir(); Assert.assertTrue(created); - verify(runSvn("add", d1Path)); + runInAndVerifyIgnoreOutput("add", d1Path); checkin(); @@ -203,8 +203,8 @@ public class SvnCommittedViewTest extends Svn17TestCase { new File(folder, "f2.txt").createNewFile(); Thread.sleep(100); - verify(runSvn("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk")); - verify(runSvn("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch")); + runInAndVerifyIgnoreOutput("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk"); + runInAndVerifyIgnoreOutput("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch"); final SvnVcs vcs = SvnVcs.getInstance(myProject); vcs.invokeRefreshSvnRoots(); @@ -227,12 +227,12 @@ public class SvnCommittedViewTest extends Svn17TestCase { new File(folder, "f2.txt").createNewFile(); Thread.sleep(100); - verify(runSvn("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk")); + runInAndVerifyIgnoreOutput("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk"); update(); - verify(runSvn("copy", myWorkingCopyDir.getPath() + "/trunk", myWorkingCopyDir.getPath() + "/branch")); - verify(runSvn("propset", "testprop", "testval", myWorkingCopyDir.getPath() + "/branch/folder")); + runInAndVerifyIgnoreOutput("copy", myWorkingCopyDir.getPath() + "/trunk", myWorkingCopyDir.getPath() + "/branch"); + runInAndVerifyIgnoreOutput("propset", "testprop", "testval", myWorkingCopyDir.getPath() + "/branch/folder"); checkin(); diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnConcurrentChangeListManagerTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnConcurrentChangeListManagerTest.java index 5c6564b0ef06..4d41c33d544d 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnConcurrentChangeListManagerTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnConcurrentChangeListManagerTest.java @@ -73,8 +73,8 @@ public class SvnConcurrentChangeListManagerTest extends Svn17TestCase { final SubTree tree = new SubTree(myWorkingCopyDir); - verify(runSvn("switch", branchUrl + "/root/source/s1.txt", tree.myS1File.getPath())); - verify(runSvn("switch", branchUrl + "/root/target", tree.myTargetDir.getPath())); + runInAndVerifyIgnoreOutput("switch", branchUrl + "/root/source/s1.txt", tree.myS1File.getPath()); + runInAndVerifyIgnoreOutput("switch", branchUrl + "/root/target", tree.myTargetDir.getPath()); final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject); VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty(); @@ -90,6 +90,8 @@ public class SvnConcurrentChangeListManagerTest extends Svn17TestCase { Assert.assertEquals(FileStatus.SWITCHED, changeListManager.getStatus(tree.myTargetFiles.get(1))); } }; + // do before refresh check + check.run(); myScheme.doTest(check); changeListManager.ensureUpToDate(false); @@ -319,7 +321,7 @@ public class SvnConcurrentChangeListManagerTest extends Svn17TestCase { final String targetName = "target"; // not parralel, just test of correct detection - runSvn("changelist", targetName, file.getPath()); + runInAndVerifyIgnoreOutput("changelist", targetName, file.getPath()); VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty(); changeListManager.ensureUpToDate(false); @@ -372,9 +374,9 @@ public class SvnConcurrentChangeListManagerTest extends Svn17TestCase { private void checkFilesAreInList(final VirtualFile[] files, final String listName, final ChangeListManager manager) { System.out.println("Checking files for list: " + listName); - assert manager.findChangeList(listName) != null; + Assert.assertNotNull(manager.findChangeList(listName)); final Collection<Change> changes = manager.findChangeList(listName).getChanges(); - assert changes.size() == files.length; + Assert.assertEquals(changes.size(), files.length); for (Change change : changes) { final VirtualFile vf = change.getAfterRevision().getFile().getVirtualFile(); diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnDeleteTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnDeleteTest.java index 5b9231f5a704..2ead2f02c214 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnDeleteTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnDeleteTest.java @@ -42,11 +42,11 @@ public class SvnDeleteTest extends Svn17TestCase { VirtualFile dir = createDirInCommand(myWorkingCopyDir, "child"); createFileInCommand(dir, "a.txt", "content"); - verify(runSvn("status"), "A child", "A child" + File.separatorChar + "a.txt"); + runAndVerifyStatusSorted("A child", "A child" + File.separatorChar + "a.txt"); checkin(); deleteFileInCommand(dir); - verify(runSvn("status"), "D child", "D child" + File.separatorChar + "a.txt"); + runAndVerifyStatusSorted("D child", "D child" + File.separatorChar + "a.txt"); refreshVfs(); @@ -72,12 +72,12 @@ public class SvnDeleteTest extends Svn17TestCase { VirtualFile dir = createDirInCommand(myWorkingCopyDir, "child"); createFileInCommand(dir, "a.txt", "content"); - verify(runSvn("status"), "A child", "A child" + File.separatorChar + "a.txt"); + runAndVerifyStatusSorted("A child", "A child" + File.separatorChar + "a.txt"); checkin(); final File wasFile = new File(dir.getPath()); deleteFileInCommand(dir); - verify(runSvn("status"), "! child", "! child" + File.separatorChar + "a.txt"); + runAndVerifyStatusSorted("! child", "! child" + File.separatorChar + "a.txt"); Assert.assertTrue(! wasFile.exists()); } } diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnExternalCommitNoticedTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnExternalCommitNoticedTest.java index 91f30c9452d3..965ea6326c70 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnExternalCommitNoticedTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnExternalCommitNoticedTest.java @@ -114,9 +114,10 @@ public class SvnExternalCommitNoticedTest extends Svn17TestCase { final String branchUrl = prepareBranchesStructure(); final SubTree tree = new SubTree(myWorkingCopyDir); - verify(runSvn("switch", branchUrl + "/root/source/s1.txt", tree.myS1File.getPath())); - verify(runSvn("switch", branchUrl + "/root/target", tree.myTargetDir.getPath())); + runInAndVerifyIgnoreOutput("switch", branchUrl + "/root/source/s1.txt", tree.myS1File.getPath()); + runInAndVerifyIgnoreOutput("switch", branchUrl + "/root/target", tree.myTargetDir.getPath()); + sleep(50); myWorkingCopyDir.refresh(false, true); imitateEvent(myWorkingCopyDir); // no dirty scope externally provided! just VFS refresh @@ -142,7 +143,7 @@ public class SvnExternalCommitNoticedTest extends Svn17TestCase { Assert.assertEquals(1, infos.size()); Assert.assertEquals(myRepoUrl + "/trunk", infos.get(0).getAbsoluteUrl()); - verify(runSvn("switch", branchUrl, myWorkingCopyDir.getPath())); + runInAndVerifyIgnoreOutput("switch", branchUrl, myWorkingCopyDir.getPath()); myWorkingCopyDir.refresh(false, true); imitateEvent(myWorkingCopyDir); @@ -182,8 +183,8 @@ public class SvnExternalCommitNoticedTest extends Svn17TestCase { // } - verify(runSvn("ci", "-m", "test", sourceDir.getPath())); - verify(runSvn("ci", "-m", "test", externalDir.getPath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", sourceDir.getPath()); + runInAndVerifyIgnoreOutput("ci", "-m", "test", externalDir.getPath()); myWorkingCopyDir.refresh(false, true); final LocalFileSystem lfs = LocalFileSystem.getInstance(); diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnExternalTests.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnExternalTests.java index 443dc9502696..177f608ea768 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnExternalTests.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnExternalTests.java @@ -103,10 +103,10 @@ public class SvnExternalTests extends Svn17TestCase { sleep(200); myWorkingCopyDir.refresh(false, true); - verify(runSvn("co", myMainUrl)); + runInAndVerifyIgnoreOutput("co", myMainUrl); final File sourceDir = new File(myWorkingCopyDir.getPath(), "source"); final File innerDir = new File(sourceDir, "inner1/inner2/inner"); - verify(runSvn("co", myExternalURL, innerDir.getPath())); + runInAndVerifyIgnoreOutput("co", myExternalURL, innerDir.getPath()); sleep(100); myWorkingCopyDir.refresh(false, true); // above is preparation diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnLocalChangesAndRootsTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnLocalChangesAndRootsTest.java index ba4cf2160b50..6c2ae8f8bfeb 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnLocalChangesAndRootsTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnLocalChangesAndRootsTest.java @@ -64,9 +64,9 @@ public class SvnLocalChangesAndRootsTest extends Svn17TestCase { myFile.createNewFile(); sleep100(); - verify(runSvn("import", "-m", "test", myDir.getAbsolutePath(), myRepoUrl + "/" + name)); + runInAndVerifyIgnoreOutput("import", "-m", "test", myDir.getAbsolutePath(), myRepoUrl + "/" + name); FileUtil.delete(myDir); - verify(runSvn("co", myRepoUrl + "/" + name, myDir.getAbsolutePath())); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/" + name, myDir.getAbsolutePath()); myUnversioned = new File(myDir, "unversioned.txt"); myFile.createNewFile(); diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnMergeInfoTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnMergeInfoTest.java index 791c270a5ef2..c90212aec558 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnMergeInfoTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnMergeInfoTest.java @@ -82,19 +82,19 @@ public class SvnMergeInfoTest extends Svn17TestCase { new File(folder, "f2.txt").createNewFile(); Thread.sleep(100); - verify(runSvn("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk")); - verify(runSvn("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch")); + runInAndVerifyIgnoreOutput("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk"); + runInAndVerifyIgnoreOutput("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch"); FileUtil.delete(trunk); - verify(runSvn("co", myRepoUrl + "/trunk", trunk.getAbsolutePath())); - verify(runSvn("co", myRepoUrl + "/branch", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/trunk", trunk.getAbsolutePath()); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/branch", myBranchVcsRoot.getAbsolutePath()); // rev 3 final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(f1); editFileInCommand(myProject, vf, "123\n456\n123"); Thread.sleep(100); - verify(runSvn("ci", "-m", "test", trunk.getAbsolutePath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", trunk.getAbsolutePath()); final SvnVcs vcs = SvnVcs.getInstance(myProject); final CommittedChangesProvider<SvnChangeList,ChangeBrowserSettings> committedChangesProvider = vcs.getCommittedChangesProvider(); @@ -129,26 +129,26 @@ public class SvnMergeInfoTest extends Svn17TestCase { new File(folder, "f2.txt").createNewFile(); Thread.sleep(100); - verify(runSvn("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk")); - verify(runSvn("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch")); + runInAndVerifyIgnoreOutput("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk"); + runInAndVerifyIgnoreOutput("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch"); FileUtil.delete(trunk); - verify(runSvn("co", myRepoUrl + "/trunk", trunk.getAbsolutePath())); - verify(runSvn("co", myRepoUrl + "/branch", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/trunk", trunk.getAbsolutePath()); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/branch", myBranchVcsRoot.getAbsolutePath()); // rev 3 final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(f1); editFileInCommand(myProject, vf, "123\n456\n123"); Thread.sleep(100); - verify(runSvn("ci", "-m", "test", trunk.getAbsolutePath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", trunk.getAbsolutePath()); // rev 4: record as merged into branch - verify(runSvn("merge", "-c", "3", myRepoUrl + "/trunk", myBranchVcsRoot.getAbsolutePath(), "--record-only")); + runInAndVerifyIgnoreOutput("merge", "-c", "3", myRepoUrl + "/trunk", myBranchVcsRoot.getAbsolutePath(), "--record-only"); Thread.sleep(100); - verify(runSvn("ci", "-m", "test", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", myBranchVcsRoot.getAbsolutePath()); Thread.sleep(100); - verify(runSvn("up", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("up", myBranchVcsRoot.getAbsolutePath()); final SvnVcs vcs = SvnVcs.getInstance(myProject); final SVNWCClient wcClient = vcs.createWCClient(); @@ -188,34 +188,34 @@ public class SvnMergeInfoTest extends Svn17TestCase { new File(folder, "f2.txt").createNewFile(); Thread.sleep(100); - verify(runSvn("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk")); - verify(runSvn("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch")); + runInAndVerifyIgnoreOutput("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk"); + runInAndVerifyIgnoreOutput("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch"); FileUtil.delete(trunk); - verify(runSvn("co", myRepoUrl + "/trunk", trunk.getAbsolutePath())); - verify(runSvn("co", myRepoUrl + "/branch", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/trunk", trunk.getAbsolutePath()); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/branch", myBranchVcsRoot.getAbsolutePath()); // rev 3 final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(f1); editFileInCommand(myProject, vf, "123\n456\n123"); Thread.sleep(100); - verify(runSvn("ci", "-m", "test", trunk.getAbsolutePath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", trunk.getAbsolutePath()); // rev 4: record as merged into branch - verify(runSvn("merge", "-c", "3", myRepoUrl + "/trunk", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("merge", "-c", "3", myRepoUrl + "/trunk", myBranchVcsRoot.getAbsolutePath()); Thread.sleep(100); - verify(runSvn("ci", "-m", "test", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", myBranchVcsRoot.getAbsolutePath()); Thread.sleep(100); - verify(runSvn("up", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("up", myBranchVcsRoot.getAbsolutePath()); Thread.sleep(100); // rev5: put blocking empty mergeinfo - //verify(runSvn("merge", "-c", "-3", myRepoUrl + "/trunk/folder", new File(myBranchVcsRoot, "folder").getAbsolutePath(), "--record-only")); - verify(runSvn("merge", "-r", "3:2", myRepoUrl + "/trunk/folder", new File(myBranchVcsRoot, "folder").getAbsolutePath())); + //runInAndVerifyIgnoreOutput("merge", "-c", "-3", myRepoUrl + "/trunk/folder", new File(myBranchVcsRoot, "folder").getAbsolutePath(), "--record-only")); + runInAndVerifyIgnoreOutput("merge", "-r", "3:2", myRepoUrl + "/trunk/folder", new File(myBranchVcsRoot, "folder").getAbsolutePath()); Thread.sleep(100); - verify(runSvn("ci", "-m", "test", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", myBranchVcsRoot.getAbsolutePath()); Thread.sleep(100); - verify(runSvn("up", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("up", myBranchVcsRoot.getAbsolutePath()); final SvnVcs vcs = SvnVcs.getInstance(myProject); final SVNWCClient wcClient = vcs.createWCClient(); @@ -257,26 +257,26 @@ public class SvnMergeInfoTest extends Svn17TestCase { new File(folder, "f2.txt").createNewFile(); Thread.sleep(100); - verify(runSvn("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk")); - verify(runSvn("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch")); + runInAndVerifyIgnoreOutput("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk"); + runInAndVerifyIgnoreOutput("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch"); FileUtil.delete(trunk); - verify(runSvn("co", myRepoUrl + "/trunk", trunk.getAbsolutePath())); - verify(runSvn("co", myRepoUrl + "/branch", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/trunk", trunk.getAbsolutePath()); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/branch", myBranchVcsRoot.getAbsolutePath()); // rev 3 final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(f1); editFileInCommand(myProject, vf, "123\n456\n123"); Thread.sleep(100); - verify(runSvn("ci", "-m", "test", trunk.getAbsolutePath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", trunk.getAbsolutePath()); // rev 4: record non inheritable merge - verify(runSvn("propset", "svn:mergeinfo", "/trunk:3*", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("propset", "svn:mergeinfo", "/trunk:3*", myBranchVcsRoot.getAbsolutePath()); Thread.sleep(100); - verify(runSvn("ci", "-m", "test", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", myBranchVcsRoot.getAbsolutePath()); Thread.sleep(100); - verify(runSvn("up", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("up", myBranchVcsRoot.getAbsolutePath()); final SvnVcs vcs = SvnVcs.getInstance(myProject); final SVNWCClient wcClient = vcs.createWCClient(); @@ -316,35 +316,35 @@ public class SvnMergeInfoTest extends Svn17TestCase { new File(folder, "f2.txt").createNewFile(); Thread.sleep(100); - verify(runSvn("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk")); - verify(runSvn("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch")); + runInAndVerifyIgnoreOutput("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk"); + runInAndVerifyIgnoreOutput("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch"); FileUtil.delete(trunk); - verify(runSvn("co", myRepoUrl + "/trunk", trunk.getAbsolutePath())); - verify(runSvn("co", myRepoUrl + "/branch", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/trunk", trunk.getAbsolutePath()); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/branch", myBranchVcsRoot.getAbsolutePath()); // rev 3 final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(f1); editFileInCommand(myProject, vf, "123\n456\n123"); Thread.sleep(100); - verify(runSvn("ci", "-m", "test", trunk.getAbsolutePath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", trunk.getAbsolutePath()); Thread.sleep(100); // rev4 editFileInCommand(myProject, vf, "123\n456\n123\n4"); Thread.sleep(100); - verify(runSvn("ci", "-m", "test", trunk.getAbsolutePath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", trunk.getAbsolutePath()); Thread.sleep(100); - verify(runSvn("up", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("up", myBranchVcsRoot.getAbsolutePath()); Thread.sleep(100); // rev 4: record non inheritable merge - verify(runSvn("propset", "svn:mergeinfo", "/trunk:3,4", myBranchVcsRoot.getAbsolutePath())); - verify(runSvn("propset", "svn:mergeinfo", "/trunk:3", new File(myBranchVcsRoot, "folder").getAbsolutePath())); + runInAndVerifyIgnoreOutput("propset", "svn:mergeinfo", "/trunk:3,4", myBranchVcsRoot.getAbsolutePath()); + runInAndVerifyIgnoreOutput("propset", "svn:mergeinfo", "/trunk:3", new File(myBranchVcsRoot, "folder").getAbsolutePath()); Thread.sleep(100); - verify(runSvn("ci", "-m", "test", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", myBranchVcsRoot.getAbsolutePath()); Thread.sleep(100); - verify(runSvn("up", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("up", myBranchVcsRoot.getAbsolutePath()); final SvnVcs vcs = SvnVcs.getInstance(myProject); final SVNWCClient wcClient = vcs.createWCClient(); @@ -399,12 +399,12 @@ public class SvnMergeInfoTest extends Svn17TestCase { f2.createNewFile(); Thread.sleep(100); - verify(runSvn("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk")); - verify(runSvn("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch")); + runInAndVerifyIgnoreOutput("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk"); + runInAndVerifyIgnoreOutput("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch"); FileUtil.delete(trunk); - verify(runSvn("co", myRepoUrl + "/trunk", trunk.getAbsolutePath())); - verify(runSvn("co", myRepoUrl + "/branch", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/trunk", trunk.getAbsolutePath()); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/branch", myBranchVcsRoot.getAbsolutePath()); // rev 3 final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(f1); @@ -412,20 +412,20 @@ public class SvnMergeInfoTest extends Svn17TestCase { final VirtualFile vf2 = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(f2); editFileInCommand(myProject, vf2, "123\n456\n123"); Thread.sleep(100); - verify(runSvn("ci", "-m", "test", trunk.getAbsolutePath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", trunk.getAbsolutePath()); Thread.sleep(100); - verify(runSvn("up", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("up", myBranchVcsRoot.getAbsolutePath()); Thread.sleep(100); // rev 4: record non inheritable merge - verify(runSvn("propset", "svn:mergeinfo", "/trunk:3", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("propset", "svn:mergeinfo", "/trunk:3", myBranchVcsRoot.getAbsolutePath()); // this makes not merged for f2 path - verify(runSvn("propset", "svn:mergeinfo", "/trunk:3*", new File(myBranchVcsRoot, "folder/folder1").getAbsolutePath())); + runInAndVerifyIgnoreOutput("propset", "svn:mergeinfo", "/trunk:3*", new File(myBranchVcsRoot, "folder/folder1").getAbsolutePath()); Thread.sleep(100); - verify(runSvn("ci", "-m", "test", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", myBranchVcsRoot.getAbsolutePath()); Thread.sleep(100); - verify(runSvn("up", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("up", myBranchVcsRoot.getAbsolutePath()); final SvnVcs vcs = SvnVcs.getInstance(myProject); final SVNWCClient wcClient = vcs.createWCClient(); @@ -476,27 +476,27 @@ public class SvnMergeInfoTest extends Svn17TestCase { f2.createNewFile(); Thread.sleep(100); - verify(runSvn("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk")); - verify(runSvn("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch")); + runInAndVerifyIgnoreOutput("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk"); + runInAndVerifyIgnoreOutput("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch"); FileUtil.delete(trunk); - verify(runSvn("co", myRepoUrl + "/trunk", trunk.getAbsolutePath())); - verify(runSvn("co", myRepoUrl + "/branch", fullBranch.getAbsolutePath())); - verify(runSvn("co", myRepoUrl + "/branch/folder/folder1", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/trunk", trunk.getAbsolutePath()); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/branch", fullBranch.getAbsolutePath()); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/branch/folder/folder1", myBranchVcsRoot.getAbsolutePath()); // rev 3 : f2 changed final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(f2); editFileInCommand(myProject, vf, "123\n456\n123"); Thread.sleep(100); - verify(runSvn("ci", "-m", "test", trunk.getAbsolutePath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", trunk.getAbsolutePath()); // rev 4: record as merged into branch using full branch WC - verify(runSvn("merge", "-c", "3", myRepoUrl + "/trunk", fullBranch.getAbsolutePath(), "--record-only")); + runInAndVerifyIgnoreOutput("merge", "-c", "3", myRepoUrl + "/trunk", fullBranch.getAbsolutePath(), "--record-only"); Thread.sleep(100); - verify(runSvn("ci", "-m", "test", fullBranch.getAbsolutePath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", fullBranch.getAbsolutePath()); Thread.sleep(100); - verify(runSvn("up", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("up", myBranchVcsRoot.getAbsolutePath()); final SvnVcs vcs = SvnVcs.getInstance(myProject); @@ -531,23 +531,23 @@ public class SvnMergeInfoTest extends Svn17TestCase { new File(folder, "f2.txt").createNewFile(); Thread.sleep(100); - verify(runSvn("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk")); - verify(runSvn("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch")); + runInAndVerifyIgnoreOutput("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk"); + runInAndVerifyIgnoreOutput("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch"); FileUtil.delete(trunk); - verify(runSvn("co", myRepoUrl + "/trunk", trunk.getAbsolutePath())); - verify(runSvn("co", myRepoUrl + "/branch", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/trunk", trunk.getAbsolutePath()); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/branch", myBranchVcsRoot.getAbsolutePath()); // rev 3 final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(f1); editFileInCommand(myProject, vf, "123\n456\n123"); Thread.sleep(100); - verify(runSvn("ci", "-m", "test", trunk.getAbsolutePath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", trunk.getAbsolutePath()); // rev 4: record non inheritable merge - verify(runSvn("propset", "svn:mergeinfo", "/trunk:3", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("propset", "svn:mergeinfo", "/trunk:3", myBranchVcsRoot.getAbsolutePath()); Thread.sleep(100); - verify(runSvn("ci", "-m", "test", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", myBranchVcsRoot.getAbsolutePath()); Thread.sleep(100); // ! no update! @@ -573,7 +573,7 @@ public class SvnMergeInfoTest extends Svn17TestCase { assert SvnMergeInfoCache.MergeCheckResult.NOT_MERGED.equals(result); // and after update - verify(runSvn("up", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("up", myBranchVcsRoot.getAbsolutePath()); Thread.sleep(100); mergeChecker.clear(); diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnNativeListsTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnNativeListsTest.java index 9ec9da35ef40..60d206bc3bfe 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnNativeListsTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnNativeListsTest.java @@ -72,7 +72,7 @@ public class SvnNativeListsTest extends Svn17TestCase { ensureAddedToNativeList(); - verifySorted(runSvn("status"), "", "--- Changelist 'newOne':", "A a.txt"); + runAndVerifyStatus("","--- Changelist 'newOne':", "A a.txt"); } private void ensureAddedToNativeList() { @@ -104,7 +104,7 @@ public class SvnNativeListsTest extends Svn17TestCase { sleepABit(); ensureAddedToNativeList(); - verifySorted(runSvn("status"), "", "--- Changelist 'newOne':", "D a.txt"); + runAndVerifyStatus("","--- Changelist 'newOne':", "D a.txt"); } @Test @@ -128,7 +128,7 @@ public class SvnNativeListsTest extends Svn17TestCase { sleepABit(); ensureAddedToNativeList(); - verifySorted(runSvn("status"), "", "--- Changelist 'newOne':", "M a.txt"); + runAndVerifyStatus("", "--- Changelist 'newOne':", "M a.txt"); } @Test @@ -153,17 +153,17 @@ public class SvnNativeListsTest extends Svn17TestCase { sleepABit(); ensureAddedToNativeList(); - verifySorted(runSvn("status"), "", "--- Changelist 'newOne':", "M a.txt"); + runAndVerifyStatus("", "--- Changelist 'newOne':", "M a.txt"); renameFileInCommand(file, "b.txt"); myDirtyScopeManager.markEverythingDirty(); myChangeListManager.ensureUpToDate(false); sleepABit(); - verifySorted(runSvn("status"), "", "--- Changelist 'newOne':", "A + b.txt", "D a.txt"); + runAndVerifyStatus("", "--- Changelist 'newOne':", "A + b.txt", "D a.txt"); ensureAddedToNativeList(); - verifySorted(runSvn("status"), "", "--- Changelist 'newOne':", "A + b.txt", "D a.txt"); + runAndVerifyStatus("", "--- Changelist 'newOne':", "A + b.txt", "D a.txt"); } @Test @@ -189,7 +189,7 @@ public class SvnNativeListsTest extends Svn17TestCase { sleepABit(); ensureAddedToNativeList(); - verifySorted(runSvn("status"), "", "--- Changelist 'newOne':", "A + b.txt", "D a.txt"); + runAndVerifyStatus("", "--- Changelist 'newOne':", "A + b.txt", "D a.txt"); } @Test @@ -215,17 +215,17 @@ public class SvnNativeListsTest extends Svn17TestCase { sleepABit(); ensureAddedToNativeList(); - verifySorted(runSvn("status"), "", "--- Changelist 'newOne':", "A + b.txt", "D a.txt"); + runAndVerifyStatus("", "--- Changelist 'newOne':", "A + b.txt", "D a.txt"); renameFileInCommand(file, "c.txt"); myDirtyScopeManager.markEverythingDirty(); myChangeListManager.ensureUpToDate(false); sleepABit(); - verifySorted(runSvn("status"), "", "--- Changelist 'newOne':", "A + c.txt", "D a.txt"); + runAndVerifyStatus("", "--- Changelist 'newOne':", "A + c.txt", "D a.txt"); ensureAddedToNativeList(); - verifySorted(runSvn("status"), "", "--- Changelist 'newOne':", "A + c.txt", "D a.txt"); + runAndVerifyStatus("", "--- Changelist 'newOne':", "A + c.txt", "D a.txt"); } private void sleepABit() { diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnParseCommandLineParseTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnParseCommandLineParseTest.java index 45d2d133755c..3870bd3c6142 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnParseCommandLineParseTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnParseCommandLineParseTest.java @@ -16,6 +16,7 @@ package org.jetbrains.idea.svn; import com.intellij.openapi.util.SystemInfo; +import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.CharsetToolkit; import com.intellij.util.Consumer; @@ -43,6 +44,8 @@ import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException; import java.util.Date; +import java.util.HashSet; +import java.util.Set; /** * Created with IntelliJ IDEA. @@ -697,4 +700,185 @@ public class SvnParseCommandLineParseTest extends TestCase { parser.parse(new ByteArrayInputStream(status.getBytes(CharsetToolkit.UTF8_CHARSET)), handler[0]); final MultiMap<String,PortableStatus> changes = handler[0].getCurrentListChanges(); } + + public void testStatusWithSwitched() throws Exception { + final String s = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + + "<status>\n" + + "<target\n" + + " path=\".\">\n" + + "<entry\n" + + " path=\"root\\source\\s1.txt\">\n" + + "<wc-status\n" + + " props=\"none\"\n" + + " switched=\"true\"\n" + + " item=\"normal\"\n" + + " revision=\"5\">\n" + + "<commit\n" + + " revision=\"4\">\n" + + "<author>Irina.Chernushina</author>\n" + + "<date>2013-02-18T13:14:24.391537Z</date>\n" + + "</commit>\n" + + "</wc-status>\n" + + "</entry>\n" + + "<entry\n" + + " path=\"root\\target\">\n" + + "<wc-status\n" + + " props=\"none\"\n" + + " switched=\"true\"\n" + + " item=\"normal\"\n" + + " revision=\"5\">\n" + + "<commit\n" + + " revision=\"4\">\n" + + "<author>Irina.Chernushina</author>\n" + + "<date>2013-02-18T13:14:24.391537Z</date>\n" + + "</commit>\n" + + "</wc-status>\n" + + "</entry>\n" + + "</target>\n" + + "</status>"; + + final SvnStatusHandler[] handlerArr = new SvnStatusHandler[1]; + final boolean isWindows = SystemInfo.isWindows; + final String basePath = isWindows ? "C:/base/" : "/base33729/"; + final Set<PortableStatus> statuses = new HashSet<PortableStatus>(); + final SvnStatusHandler handler = new + SvnStatusHandler(new SvnStatusHandler.ExternalDataCallback() { + @Override + public void switchPath() { + statuses.add(handlerArr[0].getPending()); + handlerArr[0].getPending().getKind(); + } + + @Override + public void switchChangeList(String newList) { + } + }, new File(basePath), new Convertor<File, SVNInfo>() { + @Override + public SVNInfo convert(File o) { + try { + o.getCanonicalFile(); + } + catch (IOException e) { + throw new RuntimeException(e); + } + if (isWindows) { + final int idx = o.getPath().indexOf(":"); + Assert.assertTrue(idx > 0); + final int secondIdx = o.getPath().indexOf(":", idx + 1); + Assert.assertTrue(o.getPath(), secondIdx == -1); + } else { + if (o.getPath().contains(LINUX_ROOT)) { + Assert.assertFalse(o.getPath().contains(basePath)); + } + } + try { + return createStubInfo(basePath + "1", "http://a.b.c"); + } + catch (SVNException e) { + // + throw new RuntimeException(e); + } + } + }); + handlerArr[0] = handler; + + final String osChecked = changePathsIfNix(s); + SAXParser parser = SAXParserFactory.newInstance().newSAXParser(); + parser.parse(new ByteArrayInputStream(osChecked.getBytes(CharsetToolkit.UTF8_CHARSET)), handler); + + final String[] expected = {"root\\source\\s1.txt", "root\\target"}; + for (int i = 0; i < expected.length; i++) { + expected[i] = FileUtil.toSystemDependentName(expected[i]); + } + int cntMatched = 0; + for (PortableStatus status : statuses) { + Assert.assertTrue(status.isSwitched()); + final String path = FileUtil.toSystemDependentName(status.getPath()); + for (String s1 : expected) { + if (s1.equals(path)) { + ++ cntMatched; + break; + } + } + } + Assert.assertEquals(2, cntMatched); + } + + public void testOneFileInChangeListStatus() throws Exception { + final String s = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + + "<status>\n" + + "<target\n" + + " path=\".\">\n" + + "</target>\n" + + "<changelist\n" + + " name=\"target\">\n" + + "<entry\n" + + " path=\"a.txt\">\n" + + "<wc-status\n" + + " props=\"none\"\n" + + " item=\"added\"\n" + + " revision=\"-1\">\n" + + "</wc-status>\n" + + "</entry>\n" + + "</changelist>\n" + + "</status>"; + + final SvnStatusHandler[] handlerArr = new SvnStatusHandler[1]; + final boolean isWindows = SystemInfo.isWindows; + final String basePath = isWindows ? "C:/base/" : "/base33729/"; + final Set<PortableStatus> statuses = new HashSet<PortableStatus>(); + final String[] clName = new String[1]; + final SvnStatusHandler handler = new + SvnStatusHandler(new SvnStatusHandler.ExternalDataCallback() { + @Override + public void switchPath() { + final PortableStatus pending = handlerArr[0].getPending(); + pending.setChangelistName(clName[0]); + statuses.add(pending); + pending.getKind(); + } + + @Override + public void switchChangeList(String newList) { + clName[0] = newList; + } + }, new File(basePath), new Convertor<File, SVNInfo>() { + @Override + public SVNInfo convert(File o) { + try { + o.getCanonicalFile(); + } + catch (IOException e) { + throw new RuntimeException(e); + } + if (isWindows) { + final int idx = o.getPath().indexOf(":"); + Assert.assertTrue(idx > 0); + final int secondIdx = o.getPath().indexOf(":", idx + 1); + Assert.assertTrue(o.getPath(), secondIdx == -1); + } else { + if (o.getPath().contains(LINUX_ROOT)) { + Assert.assertFalse(o.getPath().contains(basePath)); + } + } + try { + return createStubInfo(basePath + "1", "http://a.b.c"); + } + catch (SVNException e) { + // + throw new RuntimeException(e); + } + } + }); + handlerArr[0] = handler; + + final String osChecked = changePathsIfNix(s); + SAXParser parser = SAXParserFactory.newInstance().newSAXParser(); + parser.parse(new ByteArrayInputStream(osChecked.getBytes(CharsetToolkit.UTF8_CHARSET)), handler); + + Assert.assertEquals(1, statuses.size()); + final PortableStatus next = statuses.iterator().next(); + Assert.assertEquals("a.txt", next.getPath()); + Assert.assertEquals("target", next.getChangelistName()); + } } diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnProtocolsTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnProtocolsTest.java new file mode 100644 index 000000000000..69e3b510f4b4 --- /dev/null +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnProtocolsTest.java @@ -0,0 +1,248 @@ +/* + * Copyright 2000-2013 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.progress.EmptyProgressIndicator; +import com.intellij.openapi.progress.ProcessCanceledException; +import com.intellij.openapi.util.Ref; +import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.vcs.*; +import com.intellij.openapi.vcs.actions.VcsContextFactory; +import com.intellij.openapi.vcs.changes.Change; +import com.intellij.openapi.vcs.changes.CurrentContentRevision; +import com.intellij.openapi.vcs.history.VcsAppendableHistoryPartnerAdapter; +import com.intellij.openapi.vcs.history.VcsFileRevision; +import com.intellij.openapi.vcs.history.VcsHistoryProvider; +import com.intellij.openapi.vcs.update.FileGroup; +import com.intellij.openapi.vcs.update.SequentialUpdatesContext; +import com.intellij.openapi.vcs.update.UpdateSession; +import com.intellij.openapi.vcs.update.UpdatedFiles; +import com.intellij.openapi.vfs.LocalFileSystem; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.util.Processor; +import com.intellij.util.containers.Convertor; +import junit.framework.Assert; +import org.jetbrains.idea.svn.checkout.SvnCheckoutProvider; +import org.junit.Before; +import org.tmatesoft.svn.core.*; +import org.tmatesoft.svn.core.auth.*; +import org.tmatesoft.svn.core.io.SVNRepository; +import org.tmatesoft.svn.core.wc.SVNRevision; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * Created with IntelliJ IDEA. + * User: Irina.Chernushina + * Date: 2/11/13 + * Time: 3:48 PM + */ +public class SvnProtocolsTest extends Svn17TestCase { + // todo correct URL + private final static String ourSSH_URL = "svn+ssh://unit-069:222/home/irina/svnrepo"; + + private final static String ourHTTP_URL = "http://unit-364.labs.intellij.net/svn/forMerge/tmp"; + private final static String ourHTTPS_URL = "https://"; + private final static String ourSVN_URL = "svn://"; + + //private final static String[] ourTestURL = {ourSSH_URL, ourHTTP_URL}; + // at the moment + private final static String[] ourTestURL = {ourHTTP_URL}; + + 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 SvnTestInteractiveAuthentication authentication = new SvnTestInteractiveAuthentication(interactiveManager) { + @Override + public int acceptServerAuthentication(SVNURL url, String realm, Object certificate, boolean resultMayBeStored) { + return ISVNAuthenticationProvider.ACCEPTED; + } + }; + interactiveManager.setAuthenticationProvider(authentication); + + final SvnAuthenticationManager manager = configuration.getAuthenticationManager(myVcs); + // will be the same as in interactive -> authentication notifier is not used + manager.setAuthenticationProvider(authentication); + + authentication.addAuthentication(ISVNAuthenticationManager.SSH, + new Convertor<SVNURL, SVNAuthentication>() { + @Override + public SVNAuthentication convert(SVNURL o) { + return new SVNSSHAuthentication(SSH_USER_NAME, SSH_PASSWORD, SSH_PORT_NUMBER, true, o, false); + } + }); + authentication.addAuthentication(ISVNAuthenticationManager.USERNAME, new Convertor<SVNURL, SVNAuthentication>() { + @Override + public SVNAuthentication convert(SVNURL o) { + return new SVNUserNameAuthentication(SSH_USER_NAME, true, o, false); + } + }); + authentication.addAuthentication(ISVNAuthenticationManager.PASSWORD, + new Convertor<SVNURL, SVNAuthentication>() { + @Override + public SVNAuthentication convert(SVNURL o) { + return new SVNPasswordAuthentication("sally", "abcde", true, o, false); + } + }); + } + + @Test + public void testBrowseRepository() throws Exception { + for (String s : ourTestURL) { + System.out.println("Testing URL: " + s); + testBrowseRepositoryImpl(s); + } + } + + private void testBrowseRepositoryImpl(final String url) throws SVNException { + final List<SVNDirEntry> list = new ArrayList<SVNDirEntry>(); + final SVNRepository repository = myVcs.createRepository(url); + repository.getDir(".", -1, null, new ISVNDirEntryHandler() { + @Override + public void handleDirEntry(SVNDirEntry dirEntry) throws SVNException { + list.add(dirEntry); + } + }); + + Assert.assertTrue(! list.isEmpty()); + } + + @Test + public void testCheckout() throws Exception { + for (String s : ourTestURL) { + System.out.println("Testing URL: " + s); + testCheckoutImpl(s); + } + } + + @Test + public void testHistory() throws Exception { + for (String s : ourTestURL) { + System.out.println("Testing URL: " + s); + testHistoryImpl(s); + } + } + + private void testHistoryImpl(String s) throws VcsException { + final VcsHistoryProvider provider = myVcs.getVcsHistoryProvider(); + final VcsAppendableHistoryPartnerAdapter partner = new VcsAppendableHistoryPartnerAdapter() { + @Override + public void acceptRevision(VcsFileRevision revision) { + super.acceptRevision(revision); + if(getSession().getRevisionList().size() > 1) { + throw new ProcessCanceledException(); + } + } + }; + try { + provider.reportAppendableHistory(VcsContextFactory.SERVICE.getInstance().createFilePathOnNonLocal(s, true), partner); + } catch (ProcessCanceledException e) { + //ok + } + final List<VcsFileRevision> list = partner.getSession().getRevisionList(); + Assert.assertTrue(! list.isEmpty()); + } + + // todo this test writes to repository - so it's disabled for now - while admins are preparing a server + /* + @Test + public void testUpdateAndCommit() throws Exception { + for (String url : ourTestURL) { + final File wc1 = testCheckoutImpl(url); + final File wc2 = testCheckoutImpl(url); + + final File file = testCommitImpl(wc1); + System.out.println("Committed file: " + file.getPath()); + testUpdateImpl(wc2, file); + } + }*/ + + private void testUpdateImpl(File wc1, final File created) { + Assert.assertTrue(wc1.isDirectory()); + final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(wc1); + final UpdatedFiles files = UpdatedFiles.create(); + final UpdateSession session = + myVcs.getUpdateEnvironment().updateDirectories(new FilePath[]{new FilePathImpl(vf)}, files, new EmptyProgressIndicator(), + new Ref<SequentialUpdatesContext>()); + Assert.assertTrue(session.getExceptions() == null || session.getExceptions().isEmpty()); + Assert.assertTrue(! session.isCanceled()); + Assert.assertTrue(! files.getGroupById(FileGroup.CREATED_ID).getFiles().isEmpty()); + final String path = files.getGroupById(FileGroup.CREATED_ID).getFiles().iterator().next(); + final String name = path.substring(path.lastIndexOf(File.separator) + 1); + Assert.assertEquals(created.getName(), name); + } + + private File testCommitImpl(File wc1) throws IOException { + Assert.assertTrue(wc1.isDirectory()); + final File file = FileUtil.createTempFile(wc1, "file", ".txt"); + final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file); + Assert.assertNotNull(vf); + final ArrayList<VirtualFile> files = new ArrayList<VirtualFile>(); + files.add(vf); + final List<VcsException> exceptions = myVcs.getCheckinEnvironment().scheduleUnversionedFilesForAddition(files); + Assert.assertTrue(exceptions.isEmpty()); + + final Change change = new Change(null, new CurrentContentRevision(new FilePathImpl(vf))); + final List<VcsException> commit = myVcs.getCheckinEnvironment().commit(Collections.singletonList(change), "commit"); + Assert.assertTrue(commit.isEmpty()); + return file; + } + + private File testCheckoutImpl(final String url) throws IOException { + final File root = FileUtil.createTempDirectory("checkoutRoot", ""); + root.deleteOnExit(); + Assert.assertTrue(root.exists()); + SvnCheckoutProvider + .checkout(myProject, root, url, SVNRevision.HEAD, SVNDepth.INFINITY, false, new CheckoutProvider.Listener() { + @Override + public void directoryCheckedOut(File directory, VcsKey vcs) { + } + + @Override + public void checkoutCompleted() { + } + }, WorkingCopyFormat.ONE_DOT_SEVEN); + final int[] cnt = new int[1]; + cnt[0] = 0; + FileUtil.processFilesRecursively(root, new Processor<File>() { + @Override + public boolean process(File file) { + ++ cnt[0]; + return ! (cnt[0] > 1); + } + }); + Assert.assertTrue(cnt[0] > 1); + return root; + } + + // disable tests for now + private @interface Test{} +} diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnResolveTreeAcceptVariantsTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnResolveTreeAcceptVariantsTest.java index 34760ae68284..071da76aee78 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnResolveTreeAcceptVariantsTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnResolveTreeAcceptVariantsTest.java @@ -17,11 +17,10 @@ package org.jetbrains.idea.svn; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.openapi.vcs.FilePath; -import com.intellij.openapi.vcs.FilePathImpl; -import com.intellij.openapi.vcs.VcsConfiguration; +import com.intellij.openapi.vcs.*; import com.intellij.openapi.vcs.changes.Change; import com.intellij.openapi.vcs.changes.ChangeListManager; +import com.intellij.openapi.vcs.changes.ChangeListManagerImpl; import com.intellij.openapi.vcs.changes.VcsDirtyScopeManager; import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VirtualFile; @@ -40,6 +39,7 @@ import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.Arrays; import java.util.Collection; +import java.util.Collections; /** * @author Irina.Chernushina @@ -98,21 +98,29 @@ public class SvnResolveTreeAcceptVariantsTest extends Svn17TestCase { myWorkingCopyDir = createDirInCommand(myWorkingCopyDir, "test--"); myTheirs = createDirInCommand(myTheirs, "theirs--"); // todo debug - //final TreeConflictData.Data data = TreeConflictData.DirToDir.MINE_EDIT_THEIRS_DELETE; + //final TreeConflictData.Data data = TreeConflictData.DirToDir.MINE_UNV_THEIRS_MOVE; + //final TreeConflictData.Data data = TreeConflictData.FileToFile.MINE_EDIT_THEIRS_MOVE; for (final TreeConflictData.Data data : TreeConflictData.ourAll) { if (myTraceClient) { System.out.println("========= TEST " + getTestName(data) + " ========="); } + ((ChangeListManagerImpl) myChangeListManager).stopEveryThingIfInTestMode(); myWorkingCopyDir = createDirInCommand(myWorkingCopyDir.getParent(), "test" + cnt); myTheirs = createDirInCommand(myTheirs.getParent(), "theirs" + cnt); mySvnClientRunner.checkout(myRepoUrl, myTheirs); mySvnClientRunner.checkout(myRepoUrl, myWorkingCopyDir); + sleep(200); - createSubTree(); + ProjectLevelVcsManager.getInstance(myProject).setDirectoryMappings( + Collections.singletonList(new VcsDirectoryMapping(myWorkingCopyDir.getPath(), myVcs.getName()))); + createSubTree(data); + myTheirs.refresh(false, true); final ConflictCreator creator = new ConflictCreator(myProject, myTheirs, myWorkingCopyDir, data, mySvnClientRunner); creator.create(); + sleep(200); + ((ChangeListManagerImpl)myChangeListManager).forceGoInTestMode(); myDirtyScopeManager.markEverythingDirty(); myChangeListManager.ensureUpToDate(false); myDirtyScopeManager.markEverythingDirty(); @@ -219,7 +227,7 @@ public class SvnResolveTreeAcceptVariantsTest extends Svn17TestCase { mySvnClientRunner.checkout(myRepoUrl, myTheirs); mySvnClientRunner.checkout(myRepoUrl, myWorkingCopyDir); - createSubTree(); + createSubTree(data); final ConflictCreator creator = new ConflictCreator(myProject, myTheirs, myWorkingCopyDir, data, mySvnClientRunner); creator.create(); @@ -313,7 +321,7 @@ public class SvnResolveTreeAcceptVariantsTest extends Svn17TestCase { return null; } - private void createSubTree() throws Exception { + private void createSubTree(TreeConflictData.Data data) throws Exception { enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD); enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE); diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnRollbackTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnRollbackTest.java index 5e4e300b6731..9065340bc3a9 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnRollbackTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnRollbackTest.java @@ -157,7 +157,7 @@ public class SvnRollbackTest extends Svn17TestCase { final File was = new File(deepUnverioned.getPath()); checkin(); - verify(runSvn("status"), "? root" + File.separator + "source" + File.separator + "inner" + File.separator + deepUnverioned.getName()); + runAndVerifyStatus("? root" + File.separator + "source" + File.separator + "inner" + File.separator + deepUnverioned.getName()); renameFileInCommand(myProject, tree.mySourceDir, "newName"); @@ -185,7 +185,7 @@ public class SvnRollbackTest extends Svn17TestCase { final VirtualFile innerFile = createFileInCommand(inner, "inInner.txt", "kdfjsdisdjiuewjfew wefn w"); checkin(); - verify(runSvn("status")); + runAndVerifyStatus(); editFileInCommand(myProject, innerFile, "some content"); renameFileInCommand(myProject, tree.mySourceDir, "newName"); @@ -222,7 +222,9 @@ public class SvnRollbackTest extends Svn17TestCase { final File wasInnerFile = new File(innerFile.getPath()); checkin(); - verify(runSvn("status")); + runAndVerifyStatus("? root" + File.separator + "source" + File.separator + "inner" + + File.separator + "inner1" + File.separator + "inner2" + File.separator + + "inner3" + File.separator + "deep.txt"); editFileInCommand(myProject, innerFile, "some content"); final File inner2Before = new File(inner2.getPath()); @@ -270,7 +272,7 @@ public class SvnRollbackTest extends Svn17TestCase { final VirtualFile innerFile = createFileInCommand(inner, "inInner.txt", "kdfjsdisdjiuewjfew wefn w"); checkin(); - verify(runSvn("status")); + runAndVerifyStatus(); final File fileBefore = new File(innerFile.getPath()); setProperty(fileBefore, "abc", "cde"); @@ -627,15 +629,17 @@ public class SvnRollbackTest extends Svn17TestCase { disableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE); deleteFileInCommand(myProject, tree.mySourceDir); - verify(runSvn("status"), "D root" + File.separator + "source", + runAndVerifyStatusSorted( + "! root" + File.separator + "target" + File.separator + "source", + "! root" + File.separator + "target" + File.separator + "source" + File.separator + "s1.txt", + "! root" + File.separator + "target" + File.separator + "source" + File.separator + "s2.txt", + "D root" + File.separator + "source", "D root" + File.separator + "source" + File.separator + "s1.txt", - "D root" + File.separator + "source" + File.separator + "s2.txt", - "! root" + File.separator + "target" + File.separator + "source", - "! root" + File.separator + "target" + File.separator + "source" + File.separator + "s1.txt", - "! root" + File.separator + "target" + File.separator + "source" + File.separator + "s2.txt"); + "D root" + File.separator + "source" + File.separator + "s2.txt" + ); rollbackLocallyDeleted(Collections.<FilePath>singletonList(new FilePathImpl(was, true)), Collections.<FilePath>emptyList()); - verify(runSvn("status"), "D root" + File.separator + "source", + runAndVerifyStatusSorted("D root" + File.separator + "source", "D root" + File.separator + "source" + File.separator + "s1.txt", "D root" + File.separator + "source" + File.separator + "s2.txt"); } diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnRootAboveTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnRootAboveTest.java index 9bb89bf28008..4a3741d90930 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnRootAboveTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnRootAboveTest.java @@ -85,6 +85,11 @@ public class SvnRootAboveTest extends Svn17TestCase { myClManager = ChangeListManager.getInstance(myProject);*/ } + @Override + public void tearDown() throws Exception { + // no setup - no tear down + } + private class SubTree { private final VirtualFile myOuterDir; private final VirtualFile myOuterFile; diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnTestInteractiveAuthentication.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnTestInteractiveAuthentication.java new file mode 100644 index 000000000000..c12cfbb055c1 --- /dev/null +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnTestInteractiveAuthentication.java @@ -0,0 +1,84 @@ +/* + * Copyright 2000-2013 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.util.containers.Convertor; +import org.jetbrains.idea.svn.auth.ProviderType; +import org.tmatesoft.svn.core.SVNErrorMessage; +import org.tmatesoft.svn.core.SVNURL; +import org.tmatesoft.svn.core.auth.*; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +/** +* Created with IntelliJ IDEA. +* User: Irina.Chernushina +* Date: 2/11/13 +* Time: 4:08 PM +*/ +public class SvnTestInteractiveAuthentication implements ISVNAuthenticationProvider { + private final SvnAuthenticationManager myManager; + private boolean mySaveData; + private final Map<String, Convertor<SVNURL, SVNAuthentication>> myData; + + public SvnTestInteractiveAuthentication(SvnAuthenticationManager manager) { + myManager = manager; + mySaveData = true; + myData = new HashMap<String, Convertor<SVNURL, SVNAuthentication>>(); + } + + public void setSaveData(boolean saveData) { + mySaveData = saveData; + } + + @Override + public int acceptServerAuthentication(SVNURL url, String realm, Object certificate, boolean resultMayBeStored) { + return ISVNAuthenticationProvider.REJECTED; + } + + public void addAuthentication(final String kind, final Convertor<SVNURL, SVNAuthentication> authentication) { + myData.put(kind, authentication); + } + + @Override + public SVNAuthentication requestClientAuthentication(String kind, + SVNURL url, + String realm, + SVNErrorMessage errorMessage, + SVNAuthentication previousAuth, + boolean authMayBeStored) { + authMayBeStored = authMayBeStored && mySaveData; + Convertor<SVNURL, SVNAuthentication> convertor = myData.get(kind); + SVNAuthentication result = convertor == null ? null : convertor.convert(url); + if (result == null) { + if (ISVNAuthenticationManager.USERNAME.equals(kind)) { + result = new SVNUserNameAuthentication("username", authMayBeStored); + } else if (ISVNAuthenticationManager.PASSWORD.equals(kind)) { + result = new SVNPasswordAuthentication("username", "abc", authMayBeStored, url, false); + } else if (ISVNAuthenticationManager.SSH.equals(kind)) { + result = new SVNSSHAuthentication("username", "abc", -1, authMayBeStored, url, false); + } else if (ISVNAuthenticationManager.SSL.equals(kind)) { + result = new SVNSSLAuthentication(new File("aaa"), "abc", authMayBeStored, url, false); + } + } + if (! ISVNAuthenticationManager.USERNAME.equals(kind)) { + myManager.requested(ProviderType.interactive, url, realm, kind, result == null); + } + return result; + } +} diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnAddTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnAddTest.java index 6ca93d4593d0..ce4844b6f1ba 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnAddTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnAddTest.java @@ -15,7 +15,6 @@ */ package org.jetbrains.idea.svn16; -import com.intellij.execution.process.ProcessOutput; import com.intellij.openapi.command.WriteCommandAction; import com.intellij.openapi.vcs.VcsConfiguration; import com.intellij.openapi.vcs.VcsException; @@ -39,7 +38,7 @@ public class SvnAddTest extends Svn16TestCase { final VirtualFile file = createFileInCommand("a.txt", "old content"); checkin(); copyFileInCommand(file, "b.txt"); - verify(runSvn("status"), "A + b.txt"); + runAndVerifyStatusSorted("A + b.txt"); } // IDEADEV-16268 @@ -59,8 +58,7 @@ public class SvnAddTest extends Svn16TestCase { } }.execute(); - final ProcessOutput result = runSvn("status"); - verify(result, "A child", "A child" + File.separatorChar + "a.txt"); + runAndVerifyStatusSorted("A child", "A child" + File.separatorChar + "a.txt"); } // IDEADEV-19308 @@ -70,7 +68,7 @@ public class SvnAddTest extends Svn16TestCase { final VirtualFile dir = createDirInCommand(myWorkingCopyDir, "dir"); final VirtualFile file = createFileInCommand(dir, "a.txt", "content"); - verify(runSvn("status"), "? dir"); + runAndVerifyStatusSorted("? dir"); final List<VirtualFile> files = new ArrayList<VirtualFile>(); files.add(file); @@ -86,7 +84,7 @@ public class SvnAddTest extends Svn16TestCase { createFileInCommand("a.txt", "old content"); checkin(); undo(); - verify(runSvn("status"), "D a.txt"); + runAndVerifyStatusSorted("D a.txt"); Assert.assertFalse(new File(myWorkingCopyDir.getPath(), "a.txt").exists()); } } diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnAnnotationIsClosedTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnAnnotationIsClosedTest.java index a83e25c9534e..ee6de3928a44 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnAnnotationIsClosedTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnAnnotationIsClosedTest.java @@ -110,7 +110,7 @@ public class SvnAnnotationIsClosedTest extends Svn17TestCase { checkin(); //#2 editFileInCommand(myProject, tree.myS1File, "1\n2\n3**\n4\n"); checkin(); //#3 - verify(runSvn("up", "-r", "2")); + runInAndVerifyIgnoreOutput("up", "-r", "2"); final VcsAnnotationLocalChangesListener listener = ProjectLevelVcsManager.getInstance(myProject).getAnnotationLocalChangesListener(); final FileAnnotation annotation = myVcs.getAnnotationProvider().annotate(tree.myS1File); @@ -138,7 +138,7 @@ public class SvnAnnotationIsClosedTest extends Svn17TestCase { checkin(); //#2 editFileInCommand(myProject, tree.myS1File, "1\n2\n3**\n4\n"); checkin(); //#3 - verify(runSvn("up", "-r", "2")); // take #2 + runInAndVerifyIgnoreOutput("up", "-r", "2"); // take #2 final VcsAnnotationLocalChangesListener listener = ProjectLevelVcsManager.getInstance(myProject).getAnnotationLocalChangesListener(); final FileAnnotation annotation = myVcs.getAnnotationProvider().annotate(tree.myS1File); @@ -168,7 +168,7 @@ public class SvnAnnotationIsClosedTest extends Svn17TestCase { checkin(); //#2 editFileInCommand(myProject, tree.myS1File, "1\n2\n3**\n4\n"); checkin(); //#3 - verify(runSvn("up", "-r", "2")); // take #2 + runInAndVerifyIgnoreOutput("up", "-r", "2"); // take #2 final VcsAnnotationLocalChangesListener listener = ProjectLevelVcsManager.getInstance(myProject).getAnnotationLocalChangesListener(); final FileAnnotation annotation = myVcs.getAnnotationProvider().annotate(tree.myS1File); @@ -318,19 +318,19 @@ public class SvnAnnotationIsClosedTest extends Svn17TestCase { final File sourceDir = new File(myWorkingCopyDir.getPath(), "source"); final File externalDir = new File(myWorkingCopyDir.getPath(), "source/external"); - verify(runSvn("ci", "-m", "test", sourceDir.getPath())); // #3 - verify(runSvn("ci", "-m", "test", externalDir.getPath())); // #4 + runInAndVerifyIgnoreOutput("ci", "-m", "test", sourceDir.getPath()); // #3 + runInAndVerifyIgnoreOutput("ci", "-m", "test", externalDir.getPath()); // #4 editFileInCommand(myProject, vf2, "test externals 12344444" + System.currentTimeMillis()); - verify(runSvn("ci", "-m", "test", externalDir.getPath())); // #5 + runInAndVerifyIgnoreOutput("ci", "-m", "test", externalDir.getPath()); // #5 final SvnDiffProvider diffProvider = (SvnDiffProvider) myVcs.getDiffProvider(); assertRevision(vf1, diffProvider, 3); assertRevision(vf2, diffProvider, 5); - verify(runSvn("up", "-r", "4", sourceDir.getPath())); - verify(runSvn("up", "-r", "4", externalDir.getPath())); + runInAndVerifyIgnoreOutput("up", "-r", "4", sourceDir.getPath()); + runInAndVerifyIgnoreOutput("up", "-r", "4", externalDir.getPath()); assertRevision(vf1, diffProvider, 3); assertRevision(vf2, diffProvider, 4); @@ -358,7 +358,7 @@ public class SvnAnnotationIsClosedTest extends Svn17TestCase { listener.registerAnnotation(vf1, annotation1); //up - verify(runSvn("up", sourceDir.getPath())); + runInAndVerifyIgnoreOutput("up", sourceDir.getPath()); imitateEvent(lfs.refreshAndFindFileByIoFile(sourceDir)); imitateEvent(lfs.refreshAndFindFileByIoFile(externalDir)); myChangeListManager.ensureUpToDate(false); diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnCommittedViewTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnCommittedViewTest.java index 26ee4206ffcc..5eae032b91e9 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnCommittedViewTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnCommittedViewTest.java @@ -114,8 +114,8 @@ public class SvnCommittedViewTest extends Svn16TestCase { checkin(); final String d1Path = new File(d1.getPath()).getAbsolutePath(); - verify(runSvn("delete", d1Path)); - verify(runSvn("add", d1Path)); + runInAndVerifyIgnoreOutput("delete", d1Path); + runInAndVerifyIgnoreOutput("add", d1Path); checkin(); @@ -202,8 +202,8 @@ public class SvnCommittedViewTest extends Svn16TestCase { new File(folder, "f2.txt").createNewFile(); Thread.sleep(100); - verify(runSvn("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk")); - verify(runSvn("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch")); + runInAndVerifyIgnoreOutput("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk"); + runInAndVerifyIgnoreOutput("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch"); final SvnVcs vcs = SvnVcs.getInstance(myProject); vcs.invokeRefreshSvnRoots(); @@ -226,12 +226,12 @@ public class SvnCommittedViewTest extends Svn16TestCase { new File(folder, "f2.txt").createNewFile(); Thread.sleep(100); - verify(runSvn("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk")); + runInAndVerifyIgnoreOutput("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk"); update(); - verify(runSvn("copy", myWorkingCopyDir.getPath() + "/trunk", myWorkingCopyDir.getPath() + "/branch")); - verify(runSvn("propset", "testprop", "testval", myWorkingCopyDir.getPath() + "/branch/folder")); + runInAndVerifyIgnoreOutput("copy", myWorkingCopyDir.getPath() + "/trunk", myWorkingCopyDir.getPath() + "/branch"); + runInAndVerifyIgnoreOutput("propset", "testprop", "testval", myWorkingCopyDir.getPath() + "/branch/folder"); checkin(); diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnConcurrentChangeListManagerTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnConcurrentChangeListManagerTest.java index 798d1b307d27..d4f0a90510e7 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnConcurrentChangeListManagerTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnConcurrentChangeListManagerTest.java @@ -73,8 +73,8 @@ public class SvnConcurrentChangeListManagerTest extends Svn16TestCase { final SubTree tree = new SubTree(myWorkingCopyDir); - verify(runSvn("switch", branchUrl + "/root/source/s1.txt", tree.myS1File.getPath())); - verify(runSvn("switch", branchUrl + "/root/target", tree.myTargetDir.getPath())); + runInAndVerifyIgnoreOutput("switch", branchUrl + "/root/source/s1.txt", tree.myS1File.getPath()); + runInAndVerifyIgnoreOutput("switch", branchUrl + "/root/target", tree.myTargetDir.getPath()); final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject); VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty(); diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnDeleteTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnDeleteTest.java index 635ad8ae1adb..f5c6b65a3997 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnDeleteTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnDeleteTest.java @@ -42,11 +42,11 @@ public class SvnDeleteTest extends Svn16TestCase { VirtualFile dir = createDirInCommand(myWorkingCopyDir, "child"); createFileInCommand(dir, "a.txt", "content"); - verify(runSvn("status"), "A child", "A child" + File.separatorChar + "a.txt"); + runAndVerifyStatus("A child", "A child" + File.separatorChar + "a.txt"); checkin(); deleteFileInCommand(dir); - verify(runSvn("status"), "D child", "D child" + File.separatorChar + "a.txt"); + runAndVerifyStatus("D child", "D child" + File.separatorChar + "a.txt"); refreshVfs(); @@ -72,12 +72,12 @@ public class SvnDeleteTest extends Svn16TestCase { VirtualFile dir = createDirInCommand(myWorkingCopyDir, "child"); createFileInCommand(dir, "a.txt", "content"); - verify(runSvn("status"), "A child", "A child" + File.separatorChar + "a.txt"); + runAndVerifyStatus("A child", "A child" + File.separatorChar + "a.txt"); checkin(); final File wasFile = new File(dir.getPath()); deleteFileInCommand(dir); - verify(runSvn("status"), "! child"); + runAndVerifyStatus("! child"); Assert.assertTrue(! wasFile.exists()); } } diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnExternalCommitNoticedTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnExternalCommitNoticedTest.java index 22953c7b7f21..079ca66955d8 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnExternalCommitNoticedTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnExternalCommitNoticedTest.java @@ -118,8 +118,8 @@ public class SvnExternalCommitNoticedTest extends Svn17TestCase { final String branchUrl = prepareBranchesStructure(); final SubTree tree = new SubTree(myWorkingCopyDir); - verify(runSvn("switch", branchUrl + "/root/source/s1.txt", tree.myS1File.getPath())); - verify(runSvn("switch", branchUrl + "/root/target", tree.myTargetDir.getPath())); + runInAndVerifyIgnoreOutput("switch", branchUrl + "/root/source/s1.txt", tree.myS1File.getPath()); + runInAndVerifyIgnoreOutput("switch", branchUrl + "/root/target", tree.myTargetDir.getPath()); myWorkingCopyDir.refresh(false, true); imitateEvent(myWorkingCopyDir); @@ -146,7 +146,7 @@ public class SvnExternalCommitNoticedTest extends Svn17TestCase { Assert.assertEquals(1, infos.size()); Assert.assertEquals(myRepoUrl + "/trunk", infos.get(0).getAbsoluteUrl()); - verify(runSvn("switch", branchUrl, myWorkingCopyDir.getPath())); + runInAndVerifyIgnoreOutput("switch", branchUrl, myWorkingCopyDir.getPath()); myWorkingCopyDir.refresh(false, true); imitateEvent(myWorkingCopyDir); @@ -186,8 +186,8 @@ public class SvnExternalCommitNoticedTest extends Svn17TestCase { // } - verify(runSvn("ci", "-m", "test", sourceDir.getPath())); - verify(runSvn("ci", "-m", "test", externalDir.getPath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", sourceDir.getPath()); + runInAndVerifyIgnoreOutput("ci", "-m", "test", externalDir.getPath()); myWorkingCopyDir.refresh(false, true); final LocalFileSystem lfs = LocalFileSystem.getInstance(); diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnExternalTests.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnExternalTests.java index 94d8ee2d6255..7d7fd274838d 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnExternalTests.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnExternalTests.java @@ -87,10 +87,10 @@ public class SvnExternalTests extends Svn17TestCase { sleep(200); myWorkingCopyDir.refresh(false, true); - verify(runSvn("co", myMainUrl)); + runInAndVerifyIgnoreOutput("co", myMainUrl); final File sourceDir = new File(myWorkingCopyDir.getPath(), "source"); final File innerDir = new File(sourceDir, "inner1/inner2/inner"); - verify(runSvn("co", myExternalURL, innerDir.getPath())); + runInAndVerifyIgnoreOutput("co", myExternalURL, innerDir.getPath()); sleep(100); myWorkingCopyDir.refresh(false, true); // above is preparation diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnLocalChangesAndRootsTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnLocalChangesAndRootsTest.java index 723ec2d09cba..bb08a1842ddc 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnLocalChangesAndRootsTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnLocalChangesAndRootsTest.java @@ -65,9 +65,9 @@ public class SvnLocalChangesAndRootsTest extends Svn16TestCase { myFile.createNewFile(); sleep100(); - verify(runSvn("import", "-m", "test", myDir.getAbsolutePath(), myRepoUrl + "/" + name)); + runInAndVerifyIgnoreOutput("import", "-m", "test", myDir.getAbsolutePath(), myRepoUrl + "/" + name); FileUtil.delete(myDir); - verify(runSvn("co", myRepoUrl + "/" + name, myDir.getAbsolutePath())); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/" + name, myDir.getAbsolutePath()); myUnversioned = new File(myDir, "unversioned.txt"); myFile.createNewFile(); diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnMergeInfoTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnMergeInfoTest.java index 0f3d5c1cd225..e8cc8e829cc6 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnMergeInfoTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnMergeInfoTest.java @@ -85,19 +85,19 @@ public class SvnMergeInfoTest extends Svn16TestCase { new File(folder, "f2.txt").createNewFile(); Thread.sleep(100); - verify(runSvn("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk")); - verify(runSvn("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch")); + runInAndVerifyIgnoreOutput("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk"); + runInAndVerifyIgnoreOutput("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch"); FileUtil.delete(trunk); - verify(runSvn("co", myRepoUrl + "/trunk", trunk.getAbsolutePath())); - verify(runSvn("co", myRepoUrl + "/branch", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/trunk", trunk.getAbsolutePath()); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/branch", myBranchVcsRoot.getAbsolutePath()); // rev 3 final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(f1); editFileInCommand(myProject, vf, "123\n456\n123"); Thread.sleep(100); - verify(runSvn("ci", "-m", "test", trunk.getAbsolutePath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", trunk.getAbsolutePath()); final SvnVcs vcs = SvnVcs.getInstance(myProject); final CommittedChangesProvider<SvnChangeList,ChangeBrowserSettings> committedChangesProvider = vcs.getCommittedChangesProvider(); @@ -132,26 +132,26 @@ public class SvnMergeInfoTest extends Svn16TestCase { new File(folder, "f2.txt").createNewFile(); Thread.sleep(100); - verify(runSvn("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk")); - verify(runSvn("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch")); + runInAndVerifyIgnoreOutput("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk"); + runInAndVerifyIgnoreOutput("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch"); FileUtil.delete(trunk); - verify(runSvn("co", myRepoUrl + "/trunk", trunk.getAbsolutePath())); - verify(runSvn("co", myRepoUrl + "/branch", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/trunk", trunk.getAbsolutePath()); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/branch", myBranchVcsRoot.getAbsolutePath()); // rev 3 final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(f1); editFileInCommand(myProject, vf, "123\n456\n123"); Thread.sleep(100); - verify(runSvn("ci", "-m", "test", trunk.getAbsolutePath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", trunk.getAbsolutePath()); // rev 4: record as merged into branch - verify(runSvn("merge", "-c", "3", myRepoUrl + "/trunk", myBranchVcsRoot.getAbsolutePath(), "--record-only")); + runInAndVerifyIgnoreOutput("merge", "-c", "3", myRepoUrl + "/trunk", myBranchVcsRoot.getAbsolutePath(), "--record-only"); Thread.sleep(100); - verify(runSvn("ci", "-m", "test", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", myBranchVcsRoot.getAbsolutePath()); Thread.sleep(100); - verify(runSvn("up", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("up", myBranchVcsRoot.getAbsolutePath()); final SvnVcs vcs = SvnVcs.getInstance(myProject); final SVNWCClient wcClient = vcs.createWCClient(); @@ -191,34 +191,34 @@ public class SvnMergeInfoTest extends Svn16TestCase { new File(folder, "f2.txt").createNewFile(); Thread.sleep(100); - verify(runSvn("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk")); - verify(runSvn("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch")); + runInAndVerifyIgnoreOutput("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk"); + runInAndVerifyIgnoreOutput("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch"); FileUtil.delete(trunk); - verify(runSvn("co", myRepoUrl + "/trunk", trunk.getAbsolutePath())); - verify(runSvn("co", myRepoUrl + "/branch", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/trunk", trunk.getAbsolutePath()); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/branch", myBranchVcsRoot.getAbsolutePath()); // rev 3 final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(f1); editFileInCommand(myProject, vf, "123\n456\n123"); Thread.sleep(100); - verify(runSvn("ci", "-m", "test", trunk.getAbsolutePath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", trunk.getAbsolutePath()); // rev 4: record as merged into branch - verify(runSvn("merge", "-c", "3", myRepoUrl + "/trunk", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("merge", "-c", "3", myRepoUrl + "/trunk", myBranchVcsRoot.getAbsolutePath()); Thread.sleep(100); - verify(runSvn("ci", "-m", "test", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", myBranchVcsRoot.getAbsolutePath()); Thread.sleep(100); - verify(runSvn("up", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("up", myBranchVcsRoot.getAbsolutePath()); Thread.sleep(100); // rev5: put blocking empty mergeinfo - //verify(runSvn("merge", "-c", "-3", myRepoUrl + "/trunk/folder", new File(myBranchVcsRoot, "folder").getAbsolutePath(), "--record-only")); - verify(runSvn("merge", "-r", "3:2", myRepoUrl + "/trunk/folder", new File(myBranchVcsRoot, "folder").getAbsolutePath())); + //runInAndVerifyIgnoreOutput("merge", "-c", "-3", myRepoUrl + "/trunk/folder", new File(myBranchVcsRoot, "folder").getAbsolutePath(), "--record-only")); + runInAndVerifyIgnoreOutput("merge", "-r", "3:2", myRepoUrl + "/trunk/folder", new File(myBranchVcsRoot, "folder").getAbsolutePath()); Thread.sleep(100); - verify(runSvn("ci", "-m", "test", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", myBranchVcsRoot.getAbsolutePath()); Thread.sleep(100); - verify(runSvn("up", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("up", myBranchVcsRoot.getAbsolutePath()); final SvnVcs vcs = SvnVcs.getInstance(myProject); final SVNWCClient wcClient = vcs.createWCClient(); @@ -260,26 +260,26 @@ public class SvnMergeInfoTest extends Svn16TestCase { new File(folder, "f2.txt").createNewFile(); Thread.sleep(100); - verify(runSvn("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk")); - verify(runSvn("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch")); + runInAndVerifyIgnoreOutput("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk"); + runInAndVerifyIgnoreOutput("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch"); FileUtil.delete(trunk); - verify(runSvn("co", myRepoUrl + "/trunk", trunk.getAbsolutePath())); - verify(runSvn("co", myRepoUrl + "/branch", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/trunk", trunk.getAbsolutePath()); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/branch", myBranchVcsRoot.getAbsolutePath()); // rev 3 final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(f1); editFileInCommand(myProject, vf, "123\n456\n123"); Thread.sleep(100); - verify(runSvn("ci", "-m", "test", trunk.getAbsolutePath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", trunk.getAbsolutePath()); // rev 4: record non inheritable merge - verify(runSvn("propset", "svn:mergeinfo", "/trunk:3*", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("propset", "svn:mergeinfo", "/trunk:3*", myBranchVcsRoot.getAbsolutePath()); Thread.sleep(100); - verify(runSvn("ci", "-m", "test", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", myBranchVcsRoot.getAbsolutePath()); Thread.sleep(100); - verify(runSvn("up", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("up", myBranchVcsRoot.getAbsolutePath()); final SvnVcs vcs = SvnVcs.getInstance(myProject); final SVNWCClient wcClient = vcs.createWCClient(); @@ -319,35 +319,35 @@ public class SvnMergeInfoTest extends Svn16TestCase { new File(folder, "f2.txt").createNewFile(); Thread.sleep(100); - verify(runSvn("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk")); - verify(runSvn("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch")); + runInAndVerifyIgnoreOutput("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk"); + runInAndVerifyIgnoreOutput("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch"); FileUtil.delete(trunk); - verify(runSvn("co", myRepoUrl + "/trunk", trunk.getAbsolutePath())); - verify(runSvn("co", myRepoUrl + "/branch", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/trunk", trunk.getAbsolutePath()); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/branch", myBranchVcsRoot.getAbsolutePath()); // rev 3 final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(f1); editFileInCommand(myProject, vf, "123\n456\n123"); Thread.sleep(100); - verify(runSvn("ci", "-m", "test", trunk.getAbsolutePath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", trunk.getAbsolutePath()); Thread.sleep(100); // rev4 editFileInCommand(myProject, vf, "123\n456\n123\n4"); Thread.sleep(100); - verify(runSvn("ci", "-m", "test", trunk.getAbsolutePath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", trunk.getAbsolutePath()); Thread.sleep(100); - verify(runSvn("up", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("up", myBranchVcsRoot.getAbsolutePath()); Thread.sleep(100); // rev 4: record non inheritable merge - verify(runSvn("propset", "svn:mergeinfo", "/trunk:3,4", myBranchVcsRoot.getAbsolutePath())); - verify(runSvn("propset", "svn:mergeinfo", "/trunk:3", new File(myBranchVcsRoot, "folder").getAbsolutePath())); + runInAndVerifyIgnoreOutput("propset", "svn:mergeinfo", "/trunk:3,4", myBranchVcsRoot.getAbsolutePath()); + runInAndVerifyIgnoreOutput("propset", "svn:mergeinfo", "/trunk:3", new File(myBranchVcsRoot, "folder").getAbsolutePath()); Thread.sleep(100); - verify(runSvn("ci", "-m", "test", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", myBranchVcsRoot.getAbsolutePath()); Thread.sleep(100); - verify(runSvn("up", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("up", myBranchVcsRoot.getAbsolutePath()); final SvnVcs vcs = SvnVcs.getInstance(myProject); final SVNWCClient wcClient = vcs.createWCClient(); @@ -402,12 +402,12 @@ public class SvnMergeInfoTest extends Svn16TestCase { f2.createNewFile(); Thread.sleep(100); - verify(runSvn("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk")); - verify(runSvn("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch")); + runInAndVerifyIgnoreOutput("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk"); + runInAndVerifyIgnoreOutput("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch"); FileUtil.delete(trunk); - verify(runSvn("co", myRepoUrl + "/trunk", trunk.getAbsolutePath())); - verify(runSvn("co", myRepoUrl + "/branch", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/trunk", trunk.getAbsolutePath()); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/branch", myBranchVcsRoot.getAbsolutePath()); // rev 3 final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(f1); @@ -415,20 +415,20 @@ public class SvnMergeInfoTest extends Svn16TestCase { final VirtualFile vf2 = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(f2); editFileInCommand(myProject, vf2, "123\n456\n123"); Thread.sleep(100); - verify(runSvn("ci", "-m", "test", trunk.getAbsolutePath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", trunk.getAbsolutePath()); Thread.sleep(100); - verify(runSvn("up", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("up", myBranchVcsRoot.getAbsolutePath()); Thread.sleep(100); // rev 4: record non inheritable merge - verify(runSvn("propset", "svn:mergeinfo", "/trunk:3", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("propset", "svn:mergeinfo", "/trunk:3", myBranchVcsRoot.getAbsolutePath()); // this makes not merged for f2 path - verify(runSvn("propset", "svn:mergeinfo", "/trunk:3*", new File(myBranchVcsRoot, "folder/folder1").getAbsolutePath())); + runInAndVerifyIgnoreOutput("propset", "svn:mergeinfo", "/trunk:3*", new File(myBranchVcsRoot, "folder/folder1").getAbsolutePath()); Thread.sleep(100); - verify(runSvn("ci", "-m", "test", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", myBranchVcsRoot.getAbsolutePath()); Thread.sleep(100); - verify(runSvn("up", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("up", myBranchVcsRoot.getAbsolutePath()); final SvnVcs vcs = SvnVcs.getInstance(myProject); final SVNWCClient wcClient = vcs.createWCClient(); @@ -479,27 +479,27 @@ public class SvnMergeInfoTest extends Svn16TestCase { f2.createNewFile(); Thread.sleep(100); - verify(runSvn("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk")); - verify(runSvn("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch")); + runInAndVerifyIgnoreOutput("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk"); + runInAndVerifyIgnoreOutput("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch"); FileUtil.delete(trunk); - verify(runSvn("co", myRepoUrl + "/trunk", trunk.getAbsolutePath())); - verify(runSvn("co", myRepoUrl + "/branch", fullBranch.getAbsolutePath())); - verify(runSvn("co", myRepoUrl + "/branch/folder/folder1", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/trunk", trunk.getAbsolutePath()); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/branch", fullBranch.getAbsolutePath()); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/branch/folder/folder1", myBranchVcsRoot.getAbsolutePath()); // rev 3 : f2 changed final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(f2); editFileInCommand(myProject, vf, "123\n456\n123"); Thread.sleep(100); - verify(runSvn("ci", "-m", "test", trunk.getAbsolutePath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", trunk.getAbsolutePath()); // rev 4: record as merged into branch using full branch WC - verify(runSvn("merge", "-c", "3", myRepoUrl + "/trunk", fullBranch.getAbsolutePath(), "--record-only")); + runInAndVerifyIgnoreOutput("merge", "-c", "3", myRepoUrl + "/trunk", fullBranch.getAbsolutePath(), "--record-only"); Thread.sleep(100); - verify(runSvn("ci", "-m", "test", fullBranch.getAbsolutePath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", fullBranch.getAbsolutePath()); Thread.sleep(100); - verify(runSvn("up", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("up", myBranchVcsRoot.getAbsolutePath()); final SvnVcs vcs = SvnVcs.getInstance(myProject); @@ -534,23 +534,23 @@ public class SvnMergeInfoTest extends Svn16TestCase { new File(folder, "f2.txt").createNewFile(); Thread.sleep(100); - verify(runSvn("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk")); - verify(runSvn("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch")); + runInAndVerifyIgnoreOutput("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk"); + runInAndVerifyIgnoreOutput("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch"); FileUtil.delete(trunk); - verify(runSvn("co", myRepoUrl + "/trunk", trunk.getAbsolutePath())); - verify(runSvn("co", myRepoUrl + "/branch", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/trunk", trunk.getAbsolutePath()); + runInAndVerifyIgnoreOutput("co", myRepoUrl + "/branch", myBranchVcsRoot.getAbsolutePath()); // rev 3 final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(f1); editFileInCommand(myProject, vf, "123\n456\n123"); Thread.sleep(100); - verify(runSvn("ci", "-m", "test", trunk.getAbsolutePath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", trunk.getAbsolutePath()); // rev 4: record non inheritable merge - verify(runSvn("propset", "svn:mergeinfo", "/trunk:3", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("propset", "svn:mergeinfo", "/trunk:3", myBranchVcsRoot.getAbsolutePath()); Thread.sleep(100); - verify(runSvn("ci", "-m", "test", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("ci", "-m", "test", myBranchVcsRoot.getAbsolutePath()); Thread.sleep(100); // ! no update! @@ -560,7 +560,7 @@ public class SvnMergeInfoTest extends Svn16TestCase { final SVNPropertyData data = wcClient.doGetProperty(myBranchVcsRoot, "svn:mergeinfo", SVNRevision.UNDEFINED, SVNRevision.WORKING); assert data != null && data.getValue() != null && "/trunk:3".equals(data.getValue().getString()); - final SVNInfo f1info = wcClient.doInfo(new File(myBranchVcsRoot, "folder/f1.txt"), SVNRevision.WORKING); + final SVNInfo f1info = wcClient.doInfo(new File(myBranchVcsRoot, "folder/f1.txt"), SVNRevision.UNDEFINED); assert f1info.getRevision().getNumber() == 2; final CommittedChangesProvider<SvnChangeList,ChangeBrowserSettings> committedChangesProvider = vcs.getCommittedChangesProvider(); @@ -576,7 +576,7 @@ public class SvnMergeInfoTest extends Svn16TestCase { assert SvnMergeInfoCache.MergeCheckResult.NOT_MERGED.equals(result); // and after update - verify(runSvn("up", myBranchVcsRoot.getAbsolutePath())); + runInAndVerifyIgnoreOutput("up", myBranchVcsRoot.getAbsolutePath()); Thread.sleep(100); mergeChecker.clear(); diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnNativeListsTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnNativeListsTest.java index 1496bc689d6f..cc915237c921 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnNativeListsTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnNativeListsTest.java @@ -60,6 +60,7 @@ public class SvnNativeListsTest extends Svn16TestCase { @Test public void testAdd() throws Throwable { final LocalChangeList newL = myChangeListManager.addChangeList("newOne", null); + sleepABit(); myDirtyScopeManager.markEverythingDirty(); myChangeListManager.ensureUpToDate(false); @@ -67,10 +68,13 @@ public class SvnNativeListsTest extends Svn16TestCase { enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD); final VirtualFile file = createFileInCommand("a.txt", "old content"); + myDirtyScopeManager.markEverythingDirty(); + myChangeListManager.ensureUpToDate(false); + sleepABit(); ensureAddedToNativeList(); - verify(runSvn("status"), "", "--- Changelist 'newOne':", "A a.txt"); + runAndVerifyStatus("","--- Changelist 'newOne':", "A a.txt"); } private void ensureAddedToNativeList() { @@ -83,6 +87,7 @@ public class SvnNativeListsTest extends Svn16TestCase { @Test public void testDeleted() throws Throwable { final LocalChangeList newL = myChangeListManager.addChangeList("newOne", null); + sleepABit(); myDirtyScopeManager.markEverythingDirty(); myChangeListManager.ensureUpToDate(false); @@ -91,17 +96,23 @@ public class SvnNativeListsTest extends Svn16TestCase { enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD); enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE); final VirtualFile file = createFileInCommand("a.txt", "old content"); + myDirtyScopeManager.markEverythingDirty(); + myChangeListManager.ensureUpToDate(false); + sleepABit(); checkin(); deleteFileInCommand(file); - + myDirtyScopeManager.markEverythingDirty(); + myChangeListManager.ensureUpToDate(false); + sleepABit(); ensureAddedToNativeList(); - verify(runSvn("status"), "", "--- Changelist 'newOne':", "D a.txt"); + runAndVerifyStatus("","--- Changelist 'newOne':", "D a.txt"); } @Test public void testEdit() throws Throwable { final LocalChangeList newL = myChangeListManager.addChangeList("newOne", null); + sleepABit(); myDirtyScopeManager.markEverythingDirty(); myChangeListManager.ensureUpToDate(false); @@ -109,18 +120,23 @@ public class SvnNativeListsTest extends Svn16TestCase { enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD); final VirtualFile file = createFileInCommand("a.txt", "old content"); + myDirtyScopeManager.markEverythingDirty(); + myChangeListManager.ensureUpToDate(false); + sleepABit(); checkin(); editFileInCommand(myProject, file, "111"); - + myDirtyScopeManager.markEverythingDirty(); + myChangeListManager.ensureUpToDate(false); + sleepABit(); ensureAddedToNativeList(); - verify(runSvn("status"), "", "--- Changelist 'newOne':", "M a.txt"); + runAndVerifyStatus("", "--- Changelist 'newOne':", "M a.txt"); } @Test public void testEditAndMove() throws Throwable { final LocalChangeList newL = myChangeListManager.addChangeList("newOne", null); - + sleepABit(); myDirtyScopeManager.markEverythingDirty(); myChangeListManager.ensureUpToDate(false); @@ -129,29 +145,33 @@ public class SvnNativeListsTest extends Svn16TestCase { enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD); enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE); final VirtualFile file = createFileInCommand("a.txt", "old content"); + myDirtyScopeManager.markEverythingDirty(); + myChangeListManager.ensureUpToDate(false); + sleepABit(); checkin(); editFileInCommand(myProject, file, "111"); - + myDirtyScopeManager.markEverythingDirty(); + myChangeListManager.ensureUpToDate(false); + sleepABit(); ensureAddedToNativeList(); - verify(runSvn("status"), "", "--- Changelist 'newOne':", "M a.txt"); + runAndVerifyStatus("", "--- Changelist 'newOne':", "M a.txt"); renameFileInCommand(file, "b.txt"); - /*A + b.txt - - --- Changelist 'newOne': - D a.txt - */ - verify(runSvn("status"), "", "--- Changelist 'newOne':", "A + b.txt", "D a.txt"); + myDirtyScopeManager.markEverythingDirty(); + myChangeListManager.ensureUpToDate(false); + sleepABit(); + runAndVerifyStatus("", "--- Changelist 'newOne':", "A + b.txt", "D a.txt"); ensureAddedToNativeList(); - verify(runSvn("status"), "", "--- Changelist 'newOne':", "A + b.txt", "D a.txt"); + runAndVerifyStatus("", "--- Changelist 'newOne':", "A + b.txt", "D a.txt"); } @Test public void testMove() throws Throwable { final LocalChangeList newL = myChangeListManager.addChangeList("newOne", null); + sleepABit(); myDirtyScopeManager.markEverythingDirty(); myChangeListManager.ensureUpToDate(false); @@ -160,17 +180,24 @@ public class SvnNativeListsTest extends Svn16TestCase { enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD); enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE); final VirtualFile file = createFileInCommand("a.txt", "old content"); + myDirtyScopeManager.markEverythingDirty(); + myChangeListManager.ensureUpToDate(false); + sleepABit(); checkin(); renameFileInCommand(file, "b.txt"); + myDirtyScopeManager.markEverythingDirty(); + myChangeListManager.ensureUpToDate(false); + sleepABit(); ensureAddedToNativeList(); - verify(runSvn("status"), "", "--- Changelist 'newOne':", "A + b.txt", "D a.txt"); + runAndVerifyStatus("", "--- Changelist 'newOne':", "A + b.txt", "D a.txt"); } @Test public void testMoveMove() throws Throwable { final LocalChangeList newL = myChangeListManager.addChangeList("newOne", null); + sleepABit(); myDirtyScopeManager.markEverythingDirty(); myChangeListManager.ensureUpToDate(false); @@ -179,18 +206,36 @@ public class SvnNativeListsTest extends Svn16TestCase { enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD); enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE); final VirtualFile file = createFileInCommand("a.txt", "old content"); + myDirtyScopeManager.markEverythingDirty(); + myChangeListManager.ensureUpToDate(false); + sleepABit(); checkin(); renameFileInCommand(file, "b.txt"); + myDirtyScopeManager.markEverythingDirty(); + myChangeListManager.ensureUpToDate(false); + sleepABit(); ensureAddedToNativeList(); - verify(runSvn("status"), "", "--- Changelist 'newOne':", "A + b.txt", "D a.txt"); + runAndVerifyStatus("", "--- Changelist 'newOne':", "A + b.txt", "D a.txt"); renameFileInCommand(file, "c.txt"); - verify(runSvn("status"), "", "--- Changelist 'newOne':", "A + c.txt", "D a.txt"); + myDirtyScopeManager.markEverythingDirty(); + myChangeListManager.ensureUpToDate(false); + sleepABit(); + runAndVerifyStatus("", "--- Changelist 'newOne':", "A + c.txt", "D a.txt"); ensureAddedToNativeList(); - verify(runSvn("status"), "", "--- Changelist 'newOne':", "A + c.txt", "D a.txt"); + runAndVerifyStatus("", "--- Changelist 'newOne':", "A + c.txt", "D a.txt"); + } + + private void sleepABit() { + try { + Thread.sleep(50); + } + catch (InterruptedException e) { + // + } } } diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnRollbackTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnRollbackTest.java index 23b6764cb887..93fd18491fba 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnRollbackTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnRollbackTest.java @@ -159,7 +159,7 @@ public class SvnRollbackTest extends Svn17TestCase { final File was = new File(deepUnverioned.getPath()); checkin(); - verify(runSvn("status"), "? root" + File.separator + "source" + File.separator + "inner" + File.separator + deepUnverioned.getName()); + runAndVerifyStatusSorted("? root" + File.separator + "source" + File.separator + "inner" + File.separator + deepUnverioned.getName()); renameFileInCommand(myProject, tree.mySourceDir, "newName"); @@ -187,7 +187,7 @@ public class SvnRollbackTest extends Svn17TestCase { final VirtualFile innerFile = createFileInCommand(inner, "inInner.txt", "kdfjsdisdjiuewjfew wefn w"); checkin(); - verify(runSvn("status")); + runAndVerifyStatusSorted(); editFileInCommand(myProject, innerFile, "some content"); renameFileInCommand(myProject, tree.mySourceDir, "newName"); @@ -224,7 +224,9 @@ public class SvnRollbackTest extends Svn17TestCase { final File wasInnerFile = new File(innerFile.getPath()); checkin(); - verify(runSvn("status")); + runAndVerifyStatusSorted("? root" + File.separator + "source" + File.separator + "inner" + + File.separator + "inner1" + File.separator + "inner2" + File.separator + + "inner3" + File.separator + "deep.txt"); editFileInCommand(myProject, innerFile, "some content"); final File inner2Before = new File(inner2.getPath()); @@ -272,7 +274,7 @@ public class SvnRollbackTest extends Svn17TestCase { final VirtualFile innerFile = createFileInCommand(inner, "inInner.txt", "kdfjsdisdjiuewjfew wefn w"); checkin(); - verify(runSvn("status")); + runAndVerifyStatus(); final File fileBefore = new File(innerFile.getPath()); setProperty(fileBefore, "abc", "cde"); @@ -629,15 +631,17 @@ public class SvnRollbackTest extends Svn17TestCase { disableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE); deleteFileInCommand(myProject, tree.mySourceDir); - verify(runSvn("status"), "D root" + File.separator + "source", + runAndVerifyStatusSorted( + "! root" + File.separator + "target" + File.separator + "source", + "! root" + File.separator + "target" + File.separator + "source" + File.separator + "s1.txt", + "! root" + File.separator + "target" + File.separator + "source" + File.separator + "s2.txt", + "D root" + File.separator + "source", "D root" + File.separator + "source" + File.separator + "s1.txt", - "D root" + File.separator + "source" + File.separator + "s2.txt", - "! root" + File.separator + "target" + File.separator + "source", - "! root" + File.separator + "target" + File.separator + "source" + File.separator + "s1.txt", - "! root" + File.separator + "target" + File.separator + "source" + File.separator + "s2.txt"); + "D root" + File.separator + "source" + File.separator + "s2.txt" + ); rollbackLocallyDeleted(Collections.<FilePath>singletonList(new FilePathImpl(was, true)), Collections.<FilePath>emptyList()); - verify(runSvn("status"), "D root" + File.separator + "source", + runAndVerifyStatusSorted("D root" + File.separator + "source", "D root" + File.separator + "source" + File.separator + "s1.txt", "D root" + File.separator + "source" + File.separator + "s2.txt"); } diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnRootAboveTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnRootAboveTest.java index 90a69bdec346..99834173c94f 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnRootAboveTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnRootAboveTest.java @@ -86,6 +86,11 @@ public class SvnRootAboveTest extends Svn16TestCase { myClManager = ChangeListManager.getInstance(myProject);*/ } + @Override + public void tearDown() throws Exception { + // no setup - no tear down + } + private class SubTree { private final VirtualFile myOuterDir; private final VirtualFile myOuterFile; |