maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] michael-o closed pull request #75: add fileNamesOnly property to only show file names
Date Fri, 28 Dec 2018 13:10:18 GMT
michael-o closed pull request #75: add fileNamesOnly property to only show file names
URL: https://github.com/apache/maven-scm/pull/75
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/DiffMojo.java b/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/DiffMojo.java
index c8c515c4f..331d056e7 100644
--- a/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/DiffMojo.java
+++ b/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/DiffMojo.java
@@ -23,6 +23,7 @@
 import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.scm.ScmException;
+import org.apache.maven.scm.ScmFile;
 import org.apache.maven.scm.command.diff.DiffScmResult;
 import org.apache.maven.scm.repository.ScmRepository;
 import org.codehaus.plexus.util.FileUtils;
@@ -69,6 +70,13 @@
     @Parameter( property = "outputFile", defaultValue = "${project.artifactId}.diff" )
     private File outputFile;
 
+    /**
+     * Whether the entire diff to be shown or just the names of the changed files.
+     */
+    @Parameter( property = "fileNamesOnly", defaultValue = "false" )
+    private Boolean fileNamesOnly;
+
+
     /** {@inheritDoc} */
     public void execute()
         throws MojoExecutionException
@@ -91,7 +99,15 @@ public void execute()
             {
                 if ( outputFile != null )
                 {
-                    FileUtils.fileWrite( outputFile.getAbsolutePath(), result.getPatch()
);
+                    if (fileNamesOnly) {
+                        StringBuilder changedFilesList = new StringBuilder();
+                        for (ScmFile file : result.getChangedFiles()) {
+                            changedFilesList.append(file.getPath()).append("\n");
+                        }
+                        FileUtils.fileWrite( outputFile.getAbsolutePath(), changedFilesList.toString()
);
+                    } else {
+                        FileUtils.fileWrite( outputFile.getAbsolutePath(), result.getPatch()
);
+                    }
                 }
             }
             catch ( IOException e )


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message