hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aajis...@apache.org
Subject hadoop git commit: HADOOP-14985. Remove subversion related code from VersionInfoMojo.java. Contributed by Ajay Kumar.
Date Tue, 05 Dec 2017 05:32:38 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2.9 55df9df9f -> 981f117a1


HADOOP-14985. Remove subversion related code from VersionInfoMojo.java. Contributed by Ajay
Kumar.

(cherry picked from commit 9f1bdafedb60f83598819c6a682f659d6e168eb0)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/981f117a
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/981f117a
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/981f117a

Branch: refs/heads/branch-2.9
Commit: 981f117a1bb29d8f281210175331df10bc9530a8
Parents: 55df9df
Author: Akira Ajisaka <aajisaka@apache.org>
Authored: Tue Dec 5 14:30:46 2017 +0900
Committer: Akira Ajisaka <aajisaka@apache.org>
Committed: Tue Dec 5 14:32:34 2017 +0900

----------------------------------------------------------------------
 .../plugin/versioninfo/VersionInfoMojo.java     | 85 +++-----------------
 1 file changed, 12 insertions(+), 73 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/981f117a/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/versioninfo/VersionInfoMojo.java
----------------------------------------------------------------------
diff --git a/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/versioninfo/VersionInfoMojo.java
b/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/versioninfo/VersionInfoMojo.java
index f6faea0..ca970c6 100644
--- a/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/versioninfo/VersionInfoMojo.java
+++ b/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/versioninfo/VersionInfoMojo.java
@@ -72,10 +72,7 @@ public class VersionInfoMojo extends AbstractMojo {
   @Parameter(defaultValue="git")
   private String gitCommand;
 
-  @Parameter(defaultValue="svn")
-  private String svnCommand;
-
-  private enum SCM {NONE, SVN, GIT}
+  private enum SCM {NONE, GIT}
 
   @Override
   public void execute() throws MojoExecutionException {
@@ -104,7 +101,7 @@ public class VersionInfoMojo extends AbstractMojo {
   private List<String> scmOut;
 
   /**
-   * Determines which SCM is in use (Subversion, git, or none) and captures
+   * Determines which SCM is in use (git or none) and captures
    * output of the SCM command for later parsing.
    * 
    * @return SCM in use for this build
@@ -114,27 +111,24 @@ public class VersionInfoMojo extends AbstractMojo {
     Exec exec = new Exec(this);
     SCM scm = SCM.NONE;
     scmOut = new ArrayList<String>();
-    int ret = exec.run(Arrays.asList(svnCommand, "info"), scmOut);
+    int ret;
+    ret = exec.run(Arrays.asList(gitCommand, "branch"), scmOut);
     if (ret == 0) {
-      scm = SCM.SVN;
-    } else {
-      ret = exec.run(Arrays.asList(gitCommand, "branch"), scmOut);
-      if (ret == 0) {
-        ret = exec.run(Arrays.asList(gitCommand, "remote", "-v"), scmOut);
+      ret = exec.run(Arrays.asList(gitCommand, "remote", "-v"), scmOut);
+      if (ret != 0) {
+        scm = SCM.NONE;
+        scmOut = null;
+      } else {
+        ret = exec.run(Arrays.asList(gitCommand, "log", "-n", "1"), scmOut);
         if (ret != 0) {
           scm = SCM.NONE;
           scmOut = null;
         } else {
-          ret = exec.run(Arrays.asList(gitCommand, "log", "-n", "1"), scmOut);
-          if (ret != 0) {
-            scm = SCM.NONE;
-            scmOut = null;
-          } else {
-            scm = SCM.GIT;
-          }
+          scm = SCM.GIT;
         }
       }
     }
+
     if (scmOut != null) {
       getLog().debug(scmOut.toString());
     }
@@ -143,35 +137,6 @@ public class VersionInfoMojo extends AbstractMojo {
   }
 
   /**
-   * Return URI and branch of Subversion repository.
-   * 
-   * @param str String Subversion info output containing URI and branch
-   * @return String[] containing URI and branch
-   */
-  private String[] getSvnUriInfo(String str) {
-    String[] res = new String[]{"Unknown", "Unknown"};
-    String path = str;
-    int index = path.indexOf("trunk");
-    if (index > -1) {
-      res[0] = path.substring(0, index - 1);
-      res[1] = "trunk";
-    } else {
-      index = path.indexOf("branches");
-      if (index > -1) {
-        res[0] = path.substring(0, index - 1);
-        int branchIndex = index + "branches".length() + 1;
-        index = path.indexOf('/', branchIndex);
-        if (index > -1) {
-          res[1] = path.substring(branchIndex, index);
-        } else {
-          res[1] = path.substring(branchIndex);
-        }
-      }
-    }
-    return res;
-  }
-
-  /**
    * Parses SCM output and returns URI of SCM.
    * 
    * @param scm SCM in use for this build
@@ -180,15 +145,6 @@ public class VersionInfoMojo extends AbstractMojo {
   private String getSCMUri(SCM scm) {
     String uri = "Unknown";
     switch (scm) {
-      case SVN:
-        for (String s : scmOut) {
-          if (s.startsWith("URL:")) {
-            uri = s.substring(4).trim();
-            uri = getSvnUriInfo(uri)[0];
-            break;
-          }
-        }
-        break;
       case GIT:
         for (String s : scmOut) {
           if (s.startsWith("origin") && s.endsWith("(fetch)")) {
@@ -211,14 +167,6 @@ public class VersionInfoMojo extends AbstractMojo {
   private String getSCMCommit(SCM scm) {
     String commit = "Unknown";
     switch (scm) {
-      case SVN:
-        for (String s : scmOut) {
-          if (s.startsWith("Revision:")) {
-            commit = s.substring("Revision:".length());
-            break;
-          }
-        }
-        break;
       case GIT:
         for (String s : scmOut) {
           if (s.startsWith("commit")) {
@@ -240,15 +188,6 @@ public class VersionInfoMojo extends AbstractMojo {
   private String getSCMBranch(SCM scm) {
     String branch = "Unknown";
     switch (scm) {
-      case SVN:
-        for (String s : scmOut) {
-          if (s.startsWith("URL:")) {
-            branch = s.substring(4).trim();
-            branch = getSvnUriInfo(branch)[1];
-            break;
-          }
-        }
-        break;
       case GIT:
         for (String s : scmOut) {
           if (s.startsWith("*")) {


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message