hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject hbase git commit: HBASE-15909 Use Yetus' patch naming rules in submit-patch.py. (Apekshit)
Date Sun, 29 May 2016 04:55:24 GMT
Repository: hbase
Updated Branches:
  refs/heads/master f2b00e61a -> 74442fde0


HBASE-15909 Use Yetus' patch naming rules in submit-patch.py. (Apekshit)

Change-Id: I4d71c94da550efe8b24ea73edcde73d9bba84b8a

Signed-off-by: stack <stack@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/74442fde
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/74442fde
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/74442fde

Branch: refs/heads/master
Commit: 74442fde0fc1ea1aa78ca510956b43343282b1ef
Parents: f2b00e6
Author: Apekshit <apeksharma@gmail.com>
Authored: Sat May 28 01:50:06 2016 -0700
Committer: stack <stack@apache.org>
Committed: Sat May 28 21:55:17 2016 -0700

----------------------------------------------------------------------
 dev-support/submit-patch.py | 41 ++++++++++++++++++----------------------
 1 file changed, 18 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/74442fde/dev-support/submit-patch.py
----------------------------------------------------------------------
diff --git a/dev-support/submit-patch.py b/dev-support/submit-patch.py
index 5554c3f..236f31d 100755
--- a/dev-support/submit-patch.py
+++ b/dev-support/submit-patch.py
@@ -17,9 +17,9 @@
 # limitations under the License.
 #
 # Makes a patch for the current branch, creates/updates the review board request and uploads
new
-# patch to jira. Patch is named as JIRAID_BRANCH_VERSION.patch. If no jira is specified,
-# patch will be named BRANCH_v0.patch and jira and review board are not updated.
-# Review board id is retrieved from the remote link in the jira.
+# patch to jira. Patch is named as (JIRA).(branch name).(patch number).patch as per Yetus'
naming
+# rules. If no jira is specified, patch will be named (branch name).patch and jira and review
board
+# are not updated. Review board id is retrieved from the remote link in the jira.
 # Print help: submit-patch.py --h
 import argparse
 import getpass
@@ -54,7 +54,7 @@ parser.add_argument("-jid", "--jira-id",
                     help = "Jira id of the issue. If set, we deduce next patch version from
"
                            "attachments in the jira and also upload the new patch. Script
will "
                            "ask for jira username/password for authentication. If not set,
"
-                           "patch is named <branch>_v0.patch.")
+                           "patch is named <branch>.patch.")
 
 # Arguments related to Review Board.
 parser.add_argument("-srb", "--skip-review-board",
@@ -123,24 +123,19 @@ def get_base_branch():
         return tracking_branch.name
 
 
-# Returns patch name having format "JIRAID_BRANCH_VERSION.patch". If no jira is specified,
-# the format changes to "BRANCH_v0.patch".
+# Returns patch name having format (JIRA).(branch name).(patch number).patch. If no jira
is
+# specified, patch is name (branch name).patch.
 def get_patch_name(branch):
-    patch_name = ""
-    if args.jira_id is not None:
-        patch_name = args.jira_id.upper() + "_"
-
-    patch_name = patch_name + branch
-    patch_version = get_next_patch_version(patch_name)
-    return patch_name + "_v" + patch_version + ".patch"
+    if args.jira_id is None:
+        return branch + ".patch"
 
+    patch_name_prefix = args.jira_id.upper() + "." + branch
+    return get_patch_name_with_version(patch_name_prefix)
 
-# Fetches list of attachments in specified jira (--jira-id) and deduces next version of patch
for
-# the given patch_name_prefix. If no jira is specified, returns 0.
-def get_next_patch_version(patch_name_prefix):
-    if args.jira_id is None:
-        return "0"
 
+# Fetches list of attachments from the jira, deduces next version for the patch and returns
final
+# patch name.
+def get_patch_name_with_version(patch_name_prefix):
     # JIRA's rest api is broken wrt to attachments. https://jira.atlassian.com/browse/JRA-27637.
     # Using crude way to get list of attachments.
     url = "https://issues.apache.org/jira/browse/" + args.jira_id
@@ -152,11 +147,10 @@ def get_next_patch_version(patch_name_prefix):
         log_fatal_and_exit(" Cannot fetch jira information. Status code %s", html.status_code)
     # Iterate over patch names starting from version 1 and return when name is not already
used.
     content = unicode(html.content, 'utf-8')
-    for i in range(1, 100):
-        name = patch_name_prefix + "_v" + str(i) + ".patch"
-        print name
-        if content.find(name) == -1:
-            return str(i)
+    for i in range(1, 1000):
+        name = patch_name_prefix + "." + ('{0:03d}'.format(i)) + ".patch"
+        if name not in content:
+            return name
 
 
 # Validates that patch directory exists, if not, creates it.
@@ -196,6 +190,7 @@ def get_credentials():
     creds_filepath = os.path.expanduser("~/.apache-creds")
     if os.path.exists(creds_filepath):
         try:
+            logger.info(" Reading ~/.apache-creds for Jira and ReviewBoard credentials")
             content = subprocess.check_output("openssl enc -aes-256-cbc -d -in " + creds_filepath,
                                               shell=True)
         except subprocess.CalledProcessError as e:


Mime
View raw message