diff --git a/maven-scm-api/src/main/java/org/apache/maven/scm/provider/ScmProvider.java b/maven-scm-api/src/main/java/org/apache/maven/scm/provider/ScmProvider.java index 72593d5ef..2aa7eedf9 100644 --- a/maven-scm-api/src/main/java/org/apache/maven/scm/provider/ScmProvider.java +++ b/maven-scm-api/src/main/java/org/apache/maven/scm/provider/ScmProvider.java @@ -70,7 +70,8 @@ ScmProviderRepository makeProviderScmRepository(File path) throws ScmRepositoryException, UnknownRepositoryStructure; /** - * Sets the interactive mode. + * Sets the interactive mode, which by default (i.e. if not called) is assumed to be {@code true} by providers. + * As providers are usually singletons, this affects every usage of this provider. * * @param interactive either {@code true} in case user may be prompted for information, otherwise {@code false} * @since 2.0.0-M2 diff --git a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/pom.xml b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/pom.xml index 03a286027..c0ac39883 100644 --- a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/pom.xml +++ b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/pom.xml @@ -59,7 +59,7 @@ org.codehaus.modello modello-maven-plugin - 1.1.0 + 2.1.0 src/main/mdo/svn-settings.mdo diff --git a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/src/main/mdo/svn-settings.mdo b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/src/main/mdo/svn-settings.mdo index 92f7e40cb..1ff2a151c 100644 --- a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/src/main/mdo/svn-settings.mdo +++ b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/src/main/mdo/svn-settings.mdo @@ -70,7 +70,7 @@ boolean true --non-interactive e.g. on Leopard (see SCM-402). + Switch off if you do not like to use --non-interactive e.g. on Leopard (see SCM-402) when used with non-interactive SVN provider. ]]> diff --git a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/SvnExeScmProvider.java b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/SvnExeScmProvider.java index f2b6d120e..adb51e02e 100644 --- a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/SvnExeScmProvider.java +++ b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/SvnExeScmProvider.java @@ -56,6 +56,13 @@ @Singleton @Named("svn") public class SvnExeScmProvider extends AbstractSvnScmProvider { + private boolean interactive; + + @Override + public void setInteractive(boolean interactive) { + this.interactive = interactive; + } + /** * {@inheritDoc} */ @@ -85,7 +92,7 @@ protected SvnCommand getChangeLogCommand() { */ @Override protected SvnCommand getCheckInCommand() { - return new SvnCheckInCommand(); + return new SvnCheckInCommand(interactive); } /** @@ -93,7 +100,7 @@ protected SvnCommand getCheckInCommand() { */ @Override protected SvnCommand getCheckOutCommand() { - return new SvnCheckOutCommand(); + return new SvnCheckOutCommand(interactive); } /** @@ -149,7 +156,7 @@ protected SvnCommand getUntagCommand() { */ @Override protected SvnCommand getUpdateCommand() { - return new SvnUpdateCommand(); + return new SvnUpdateCommand(interactive); } /** diff --git a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/SvnCommandLineUtils.java b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/SvnCommandLineUtils.java index cca583245..b8addc007 100644 --- a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/SvnCommandLineUtils.java +++ b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/SvnCommandLineUtils.java @@ -71,7 +71,21 @@ public static void addTarget(Commandline cl, List files) throws IOExceptio targets.deleteOnExit(); } + /** + * Shortcut for {@link #getBaseSvnCommandLine(File, SvnScmProviderRepository, boolean)} with the last argument being {@code false}. + * Although usually the interactive mode defaults to {@code true} the SVN provider always assumed non-interactive in the past. + * @param workingDirectory + * @param repository + * @return + * @deprecated Use {@link #getBaseSvnCommandLine(File, SvnScmProviderRepository, boolean)} instead + */ + @Deprecated public static Commandline getBaseSvnCommandLine(File workingDirectory, SvnScmProviderRepository repository) { + return getBaseSvnCommandLine(workingDirectory, repository, false); + } + + public static Commandline getBaseSvnCommandLine( + File workingDirectory, SvnScmProviderRepository repository, boolean interactive) { Commandline cl = new Commandline(); cl.setExecutable("svn"); @@ -112,7 +126,7 @@ public static Commandline getBaseSvnCommandLine(File workingDirectory, SvnScmPro cl.createArg().setValue("--no-auth-cache"); } - if (SvnUtil.getSettings().isUseNonInteractive()) { + if (!interactive && SvnUtil.getSettings().isUseNonInteractive()) { cl.createArg().setValue("--non-interactive"); } diff --git a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/checkin/SvnCheckInCommand.java b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/checkin/SvnCheckInCommand.java index 7f8ecdc45..f177817a1 100644 --- a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/checkin/SvnCheckInCommand.java +++ b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/checkin/SvnCheckInCommand.java @@ -43,6 +43,12 @@ * */ public class SvnCheckInCommand extends AbstractCheckInCommand implements SvnCommand { + private final boolean interactive; + + public SvnCheckInCommand(boolean interactive) { + this.interactive = interactive; + } + /** {@inheritDoc} */ protected CheckInScmResult executeCheckInCommand( ScmProviderRepository repo, ScmFileSet fileSet, String message, ScmVersion version) throws ScmException { @@ -104,7 +110,13 @@ protected CheckInScmResult executeCheckInCommand( public static Commandline createCommandLine( SvnScmProviderRepository repository, ScmFileSet fileSet, File messageFile) throws ScmException { - Commandline cl = SvnCommandLineUtils.getBaseSvnCommandLine(fileSet.getBasedir(), repository); + return createCommandLine(repository, fileSet, messageFile, true); + } + + public static Commandline createCommandLine( + SvnScmProviderRepository repository, ScmFileSet fileSet, File messageFile, boolean interactive) + throws ScmException { + Commandline cl = SvnCommandLineUtils.getBaseSvnCommandLine(fileSet.getBasedir(), repository, interactive); cl.createArg().setValue("commit"); diff --git a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/checkout/SvnCheckOutCommand.java b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/checkout/SvnCheckOutCommand.java index 6acd729ec..79b9c1c99 100644 --- a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/checkout/SvnCheckOutCommand.java +++ b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/checkout/SvnCheckOutCommand.java @@ -46,6 +46,12 @@ * */ public class SvnCheckOutCommand extends AbstractCheckOutCommand implements SvnCommand { + private final boolean interactive; + + public SvnCheckOutCommand(boolean interactive) { + this.interactive = interactive; + } + /** * {@inheritDoc} */ @@ -66,7 +72,7 @@ protected CheckOutScmResult executeCheckOutCommand( url = SvnCommandUtils.fixUrl(url, repository.getUser()); - Commandline cl = createCommandLine(repository, fileSet.getBasedir(), version, url, recursive); + Commandline cl = createCommandLine(repository, fileSet.getBasedir(), version, url, recursive, interactive); SvnCheckOutConsumer consumer = new SvnCheckOutConsumer(fileSet.getBasedir()); @@ -132,7 +138,29 @@ public static Commandline createCommandLine( ScmVersion version, String url, boolean recursive) { - Commandline cl = SvnCommandLineUtils.getBaseSvnCommandLine(workingDirectory.getParentFile(), repository); + return createCommandLine(repository, workingDirectory, version, url, recursive, true); + } + /** + * Create SVN check out command line. + * + * @param repository not null + * @param workingDirectory not null + * @param version not null + * @param url not null + * @param recursive true if recursive check out is wanted, false otherwise. + * @param interactive true if executed in interactive mode, false otherwise. + * @return the SVN command line for the SVN check out. + * @since 2.1.0 + */ + public static Commandline createCommandLine( + SvnScmProviderRepository repository, + File workingDirectory, + ScmVersion version, + String url, + boolean recursive, + boolean interactive) { + Commandline cl = + SvnCommandLineUtils.getBaseSvnCommandLine(workingDirectory.getParentFile(), repository, interactive); cl.createArg().setValue("checkout"); diff --git a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/update/SvnUpdateCommand.java b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/update/SvnUpdateCommand.java index 75286bd99..171a9cf8c 100644 --- a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/update/SvnUpdateCommand.java +++ b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/update/SvnUpdateCommand.java @@ -48,6 +48,12 @@ * */ public class SvnUpdateCommand extends AbstractUpdateCommand implements SvnCommand { + private final boolean interactive; + + public SvnUpdateCommand(boolean interactive) { + this.interactive = interactive; + } + /** {@inheritDoc} */ protected UpdateScmResult executeUpdateCommand(ScmProviderRepository repo, ScmFileSet fileSet, ScmVersion version) throws ScmException { @@ -92,9 +98,13 @@ protected UpdateScmResult executeUpdateCommand(ScmProviderRepository repo, ScmFi // ---------------------------------------------------------------------- // // ---------------------------------------------------------------------- - public static Commandline createCommandLine( SvnScmProviderRepository repository, File workingDirectory, ScmVersion version) { + return createCommandLine(repository, workingDirectory, version, true); + } + + public static Commandline createCommandLine( + SvnScmProviderRepository repository, File workingDirectory, ScmVersion version, boolean interactive) { Settings settings = SvnUtil.getSettings(); String workingDir = workingDirectory.getAbsolutePath(); @@ -109,7 +119,7 @@ public static Commandline createCommandLine( version = null; } - Commandline cl = SvnCommandLineUtils.getBaseSvnCommandLine(workingDirectory, repository); + Commandline cl = SvnCommandLineUtils.getBaseSvnCommandLine(workingDirectory, repository, interactive); if (version == null || SvnTagBranchUtils.isRevisionSpecifier(version)) { cl.createArg().setValue("update"); diff --git a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/checkin/SvnCheckInCommandTest.java b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/checkin/SvnCheckInCommandTest.java index 7e8b02e6a..af3908406 100644 --- a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/checkin/SvnCheckInCommandTest.java +++ b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/checkin/SvnCheckInCommandTest.java @@ -100,8 +100,8 @@ private void testCommandLine(String scmUrl, String commandLine) throws Exception SvnScmProviderRepository svnRepository = (SvnScmProviderRepository) repository.getProviderRepository(); - Commandline cl = - SvnCheckInCommand.createCommandLine(svnRepository, new ScmFileSet(workingDirectory), messageFile); + Commandline cl = SvnCheckInCommand.createCommandLine( + svnRepository, new ScmFileSet(workingDirectory), messageFile, false); assertCommandLine(commandLine, workingDirectory, cl); } diff --git a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/checkout/SvnCheckOutCommandTest.java b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/checkout/SvnCheckOutCommandTest.java index 8b9d1d176..05600f4bc 100644 --- a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/checkout/SvnCheckOutCommandTest.java +++ b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/checkout/SvnCheckOutCommandTest.java @@ -108,7 +108,7 @@ private void testCommandLine(ScmManager scmManager, String scmUrl, String revisi SvnScmProviderRepository svnRepository = (SvnScmProviderRepository) repository.getProviderRepository(); Commandline cl = SvnCheckOutCommand.createCommandLine( - svnRepository, workingDirectory, new ScmRevision(revision), svnRepository.getUrl(), recursive); + svnRepository, workingDirectory, new ScmRevision(revision), svnRepository.getUrl(), recursive, false); assertCommandLine(commandLine, workingDirectory.getParentFile(), cl); } diff --git a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/update/SvnUpdateCommandTest.java b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/update/SvnUpdateCommandTest.java index d9b87493b..3646f4ba6 100644 --- a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/update/SvnUpdateCommandTest.java +++ b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/update/SvnUpdateCommandTest.java @@ -197,7 +197,7 @@ private void testCommandLine(String scmUrl, ScmVersion version, String commandLi private void testCommandLine(String scmUrl, ScmVersion version, String commandLine, File workingDirectory) throws Exception { - Commandline cl = SvnUpdateCommand.createCommandLine(getSvnRepository(scmUrl), workingDirectory, version); + Commandline cl = SvnUpdateCommand.createCommandLine(getSvnRepository(scmUrl), workingDirectory, version, false); assertCommandLine(commandLine, workingDirectory, cl); }