]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5643 Ignore whitespace differences in SVN blame like in Git
authorJulien HENRY <julien.henry@sonarsource.com>
Tue, 4 Nov 2014 16:41:38 +0000 (17:41 +0100)
committerJulien HENRY <julien.henry@sonarsource.com>
Tue, 4 Nov 2014 16:49:36 +0000 (17:49 +0100)
plugins/sonar-svn-plugin/src/main/java/org/sonar/plugins/scm/svn/SvnBlameCommand.java
plugins/sonar-svn-plugin/src/test/java/org/sonar/plugins/scm/svn/SvnBlameCommandTest.java

index d34f1c26740b6eba014cada022e167783b0520f9..2e1038f162b220092b8fbac884353b3b8682bdf4 100644 (file)
@@ -128,8 +128,9 @@ public class SvnBlameCommand extends BlameCommand {
     cl.setDirectory(baseDir);
     cl.addArgument("blame");
     cl.addArgument("--xml");
-    cl.addArgument(filename);
     cl.addArgument("--non-interactive");
+    cl.addArgument("-x");
+    cl.addArgument("-w");
     String configDir = configuration.configDir();
     if (configDir != null) {
       cl.addArgument("--config-dir");
@@ -148,6 +149,7 @@ public class SvnBlameCommand extends BlameCommand {
     if (configuration.trustServerCert()) {
       cl.addArgument("--trust-server-cert");
     }
+    cl.addArgument(filename);
     return cl;
   }
 }
index b85b71d2fdb1bde48bd1df1bf7f2995c8d6b82ff..6bc94b51ddd26e7e485e8b429bddd6e903d3521d 100644 (file)
@@ -191,7 +191,7 @@ public class SvnBlameCommandTest {
     });
 
     thrown.expect(IllegalStateException.class);
-    thrown.expectMessage("The svn blame command [svn blame --xml src/foo.xoo --non-interactive] failed: My error");
+    thrown.expectMessage("The svn blame command [svn blame --xml --non-interactive -x -w src/foo.xoo] failed: My error");
 
     when(input.filesToBlame()).thenReturn(Arrays.<InputFile>asList(inputFile));
     new SvnBlameCommand(commandExecutor, mock(SvnConfiguration.class)).blame(input, result);
@@ -204,21 +204,21 @@ public class SvnBlameCommandTest {
     SvnBlameCommand svnBlameCommand = new SvnBlameCommand(commandExecutor, new SvnConfiguration(settings));
 
     Command commandLine = svnBlameCommand.createCommandLine(baseDir, "src/main/java/Foo.java");
-    assertThat(commandLine.toCommandLine()).isEqualTo("svn blame --xml src/main/java/Foo.java --non-interactive");
-    assertThat(commandLine.toString()).isEqualTo("svn blame --xml src/main/java/Foo.java --non-interactive");
+    assertThat(commandLine.toCommandLine()).isEqualTo("svn blame --xml --non-interactive -x -w src/main/java/Foo.java");
+    assertThat(commandLine.toString()).isEqualTo("svn blame --xml --non-interactive -x -w src/main/java/Foo.java");
 
     settings.setProperty(SvnConfiguration.USER_PROP_KEY, "myUser");
     settings.setProperty(SvnConfiguration.PASSWORD_PROP_KEY, "myPass");
     commandLine = svnBlameCommand.createCommandLine(baseDir, "src/main/java/Foo.java");
-    assertThat(commandLine.toCommandLine()).isEqualTo("svn blame --xml src/main/java/Foo.java --non-interactive --username myUser --password myPass");
-    assertThat(commandLine.toString()).isEqualTo("svn blame --xml src/main/java/Foo.java --non-interactive --username ******** --password ********");
+    assertThat(commandLine.toCommandLine()).isEqualTo("svn blame --xml --non-interactive -x -w --username myUser --password myPass src/main/java/Foo.java");
+    assertThat(commandLine.toString()).isEqualTo("svn blame --xml --non-interactive -x -w --username ******** --password ******** src/main/java/Foo.java");
 
     settings.setProperty(SvnConfiguration.CONFIG_DIR_PROP_KEY, "/home/julien/.svn");
     settings.setProperty(SvnConfiguration.TRUST_SERVER_PROP_KEY, "true");
     commandLine = svnBlameCommand.createCommandLine(baseDir, "src/main/java/Foo.java");
     assertThat(commandLine.toCommandLine())
-      .isEqualTo("svn blame --xml src/main/java/Foo.java --non-interactive --config-dir /home/julien/.svn --username myUser --password myPass --trust-server-cert");
+      .isEqualTo("svn blame --xml --non-interactive -x -w --config-dir /home/julien/.svn --username myUser --password myPass --trust-server-cert src/main/java/Foo.java");
     assertThat(commandLine.toString()).isEqualTo(
-      "svn blame --xml src/main/java/Foo.java --non-interactive --config-dir /home/julien/.svn --username ******** --password ******** --trust-server-cert");
+      "svn blame --xml --non-interactive -x -w --config-dir /home/julien/.svn --username ******** --password ******** --trust-server-cert src/main/java/Foo.java");
   }
 }