Skip to content

Commit

Permalink
Revert "[SCM-1011] Consider interactive flag for SvnExeScmProvider"
Browse files Browse the repository at this point in the history
This reverts commit 882ae31.
  • Loading branch information
kwin committed Jul 20, 2023
1 parent 882ae31 commit de504e3
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 88 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ ScmProviderRepository makeProviderScmRepository(File path)
throws ScmRepositoryException, UnknownRepositoryStructure;

/**
* Sets the interactive mode, which by default (i.e. if not called) is assumed to be true by providers.
* Sets the interactive mode.
*
* @param interactive either {@code true} in case user may be prompted for information, otherwise {@code false}.
* @param interactive either {@code true} in case user may be prompted for information, otherwise {@code false}
* @since 2.0.0-M2
*/
default void setInteractive(boolean interactive) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<groupId>org.codehaus.modello</groupId>
<artifactId>modello-maven-plugin</artifactId>
<configuration>
<version>2.1.0</version>
<version>1.1.0</version>
<models>
<model>src/main/mdo/svn-settings.mdo</model>
</models>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<type>boolean</type>
<defaultValue>true</defaultValue>
<description><![CDATA[
Switch off if you do not like to use <code>--non-interactive</code> e.g. on Leopard (see SCM-402) when used with non-interactive SVN provider.
Switch off if you do not like to use <code>--non-interactive</code> e.g. on Leopard (see SCM-402).
]]></description>
</field>
<field>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,6 @@
@Singleton
@Named("svn")
public class SvnExeScmProvider extends AbstractSvnScmProvider {
private boolean interactive;

@Override
public void setInteractive(boolean interactive) {
this.interactive = interactive;
}

/**
* {@inheritDoc}
*/
Expand Down Expand Up @@ -92,15 +85,15 @@ protected SvnCommand getChangeLogCommand() {
*/
@Override
protected SvnCommand getCheckInCommand() {
return new SvnCheckInCommand(interactive);
return new SvnCheckInCommand();
}

/**
* {@inheritDoc}
*/
@Override
protected SvnCommand getCheckOutCommand() {
return new SvnCheckOutCommand(interactive);
return new SvnCheckOutCommand();
}

/**
Expand Down Expand Up @@ -156,7 +149,7 @@ protected SvnCommand getUntagCommand() {
*/
@Override
protected SvnCommand getUpdateCommand() {
return new SvnUpdateCommand(interactive);
return new SvnUpdateCommand();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,7 @@ public static void addTarget(Commandline cl, List<File> 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");
Expand Down Expand Up @@ -126,7 +112,7 @@ public static Commandline getBaseSvnCommandLine(
cl.createArg().setValue("--no-auth-cache");
}

if (!interactive && SvnUtil.getSettings().isUseNonInteractive()) {
if (SvnUtil.getSettings().isUseNonInteractive()) {
cl.createArg().setValue("--non-interactive");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@
*
*/
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 {
Expand Down Expand Up @@ -110,13 +104,7 @@ protected CheckInScmResult executeCheckInCommand(

public static Commandline createCommandLine(
SvnScmProviderRepository repository, ScmFileSet fileSet, File messageFile) throws ScmException {
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);
Commandline cl = SvnCommandLineUtils.getBaseSvnCommandLine(fileSet.getBasedir(), repository);

cl.createArg().setValue("commit");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,6 @@
*
*/
public class SvnCheckOutCommand extends AbstractCheckOutCommand implements SvnCommand {
private final boolean interactive;

public SvnCheckOutCommand(boolean interactive) {
this.interactive = interactive;
}

/**
* {@inheritDoc}
*/
Expand All @@ -72,7 +66,7 @@ protected CheckOutScmResult executeCheckOutCommand(

url = SvnCommandUtils.fixUrl(url, repository.getUser());

Commandline cl = createCommandLine(repository, fileSet.getBasedir(), version, url, recursive, interactive);
Commandline cl = createCommandLine(repository, fileSet.getBasedir(), version, url, recursive);

SvnCheckOutConsumer consumer = new SvnCheckOutConsumer(fileSet.getBasedir());

Expand Down Expand Up @@ -138,29 +132,7 @@ public static Commandline createCommandLine(
ScmVersion version,
String url,
boolean recursive) {
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 <code>true</code> if recursive check out is wanted, <code>false</code> otherwise.
* @param interactive <code>true</code> if executed in interactive mode, <code>false</code> 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);
Commandline cl = SvnCommandLineUtils.getBaseSvnCommandLine(workingDirectory.getParentFile(), repository);

cl.createArg().setValue("checkout");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@
*
*/
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 {
Expand Down Expand Up @@ -98,13 +92,9 @@ 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) {
SvnScmProviderRepository repository, File workingDirectory, ScmVersion version) {
Settings settings = SvnUtil.getSettings();

String workingDir = workingDirectory.getAbsolutePath();
Expand All @@ -119,7 +109,7 @@ public static Commandline createCommandLine(
version = null;
}

Commandline cl = SvnCommandLineUtils.getBaseSvnCommandLine(workingDirectory, repository, interactive);
Commandline cl = SvnCommandLineUtils.getBaseSvnCommandLine(workingDirectory, repository);

if (version == null || SvnTagBranchUtils.isRevisionSpecifier(version)) {
cl.createArg().setValue("update");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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, false);
Commandline cl =
SvnCheckInCommand.createCommandLine(svnRepository, new ScmFileSet(workingDirectory), messageFile);

assertCommandLine(commandLine, workingDirectory, cl);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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, false);
svnRepository, workingDirectory, new ScmRevision(revision), svnRepository.getUrl(), recursive);

assertCommandLine(commandLine, workingDirectory.getParentFile(), cl);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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, false);
Commandline cl = SvnUpdateCommand.createCommandLine(getSvnRepository(scmUrl), workingDirectory, version);

assertCommandLine(commandLine, workingDirectory, cl);
}
Expand Down

0 comments on commit de504e3

Please sign in to comment.