You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2022/05/22 20:55:56 UTC

[maven-scm] branch SCM-986 updated: [SCM-986] SvnExe's SvnRemoteInfoCommand incorrectly implemented

This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch SCM-986
in repository https://gitbox.apache.org/repos/asf/maven-scm.git


The following commit(s) were added to refs/heads/SCM-986 by this push:
     new 0e85a1bd7 [SCM-986] SvnExe's SvnRemoteInfoCommand incorrectly implemented
0e85a1bd7 is described below

commit 0e85a1bd74cc675a635916007c24fbc02a533f91
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Sun May 22 22:44:09 2022 +0200

    [SCM-986] SvnExe's SvnRemoteInfoCommand incorrectly implemented
    
    The fix
---
 .../svn/svnexe/command/remoteinfo/SvnRemoteInfoCommand.java  | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

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/remoteinfo/SvnRemoteInfoCommand.java b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/remoteinfo/SvnRemoteInfoCommand.java
index 74de1ee0f..1f577123f 100644
--- a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/remoteinfo/SvnRemoteInfoCommand.java
+++ b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/remoteinfo/SvnRemoteInfoCommand.java
@@ -54,9 +54,9 @@ public class SvnRemoteInfoCommand
         String url = ( (SvnScmProviderRepository) repository ).getUrl();
         // use a default svn layout, url is here http://svn.apache.org/repos/asf/maven/maven-3/trunk
         // so as we presume we have good users using standard svn layout, we calculate tags and branches url
-        String baseUrl = StringUtils.endsWith( url, "/" )
-            ? StringUtils.substringAfter( StringUtils.removeEnd( url, "/" ), "/" )
-            : StringUtils.substringBeforeLast( url, "/" );
+        url = StringUtils.removeEnd( url, "/" );
+        int idx = url.lastIndexOf( "/" );
+        String baseUrl = url.substring( 0, idx );
 
         Commandline cl = SvnCommandLineUtils.getBaseSvnCommandLine( fileSet == null ? null : fileSet.getBasedir(),
                                                                     (SvnScmProviderRepository) repository );
@@ -67,7 +67,7 @@ public class SvnRemoteInfoCommand
 
         CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
 
-        LsConsumer consumer = new LsConsumer( baseUrl );
+        LsConsumer consumer = new LsConsumer( baseUrl + "/tags" );
 
         int exitCode = 0;
 
@@ -94,11 +94,11 @@ public class SvnRemoteInfoCommand
 
         cl.createArg().setValue( "ls" );
 
-        cl.createArg().setValue( baseUrl + "/tags" + "@" );
+        cl.createArg().setValue( baseUrl + "/branches" + "@" );
 
         stderr = new CommandLineUtils.StringStreamConsumer();
 
-        consumer = new LsConsumer( baseUrl );
+        consumer = new LsConsumer( baseUrl + "/branches" );
 
         Map<String, String> branchesInfos = null;