hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sur...@apache.org
Subject svn commit: r1408994 - /hadoop/common/branches/branch-trunk-win/dev-support/saveVersion.py
Date Tue, 13 Nov 2012 22:25:02 GMT
Author: suresh
Date: Tue Nov 13 22:25:01 2012
New Revision: 1408994

URL: http://svn.apache.org/viewvc?rev=1408994&view=rev
Log:
HADOOP-9011. saveVersion.py does not include branch in version annotation. Contributed by
Chris Nauroth.

Modified:
    hadoop/common/branches/branch-trunk-win/dev-support/saveVersion.py

Modified: hadoop/common/branches/branch-trunk-win/dev-support/saveVersion.py
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/dev-support/saveVersion.py?rev=1408994&r1=1408993&r2=1408994&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/dev-support/saveVersion.py (original)
+++ hadoop/common/branches/branch-trunk-win/dev-support/saveVersion.py Tue Nov 13 22:25:01
2012
@@ -39,7 +39,7 @@ template_string = \
 '''/*
  * Generated by saveVersion.py
  */
-%s(version="%s", revision="%s",
+%s(version="%s", revision="%s", branch="%s",
   user="%s", date="%s", url="%s",
   srcChecksum="%s")
 package %s;
@@ -108,8 +108,8 @@ def main(argv=None):
     branch = subprocessOutput(['git', 'branch'])
 
     filter_current_branch = re.compile(r'^\* (.*)$', re.MULTILINE)
-    current_branch = filter_current_branch.search(branch).group(1).strip()
-    url = "%s on branch %s" % (origin, current_branch)
+    branch = filter_current_branch.search(branch).group(1).strip()
+    url = "%s on branch %s" % (origin, branch)
   else:
     svn_info = subprocessOutput(['svn', 'info'])
     filter_last_revision = re.compile(r'^Last Changed Rev: (.*)$', re.MULTILINE)
@@ -118,6 +118,10 @@ def main(argv=None):
     filter_url = re.compile(r'^URL: (.*)$', re.MULTILINE)
     url = filter_url.search(svn_info).group(1).strip()
 
+    # Get canonical branch (branches/X, tags/X, or trunk)
+    filter_current_branch = re.compile(r'.*((branches/.*$)|(tags/.*$)|.*(trunk)$)')
+    branch = filter_current_branch.search(url).group(1).strip()
+
   filter_java = re.compile(r'.+\.java$')
   file_list = []
   for root, dirs, files in os.walk(os.path.normpath(src_checksum_root_dir)):
@@ -143,7 +147,7 @@ def main(argv=None):
 
   target_file = os.path.join(target_dir, 'package-info.java')
   fout = open(target_file, "w")
-  fout.write(template_string % (annotation, version, revision, user, date, url, srcChecksum,
package))
+  fout.write(template_string % (annotation, version, revision, branch, user, date, url, srcChecksum,
package))
   fout.close()
 
   print("Checksummed %s src/**.java files" % file_count)



Mime
View raw message