[asterisk-commits] release summary, mkrelease: Use a consistent local branch (repotools[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jun 9 17:46:29 CDT 2015


Joshua Colp has submitted this change and it was merged.

Change subject: release_summary, mkrelease: Use a consistent local branch
......................................................................


release_summary, mkrelease: Use a consistent local branch

The prepare_branch function does the proper work of calculating what the
local branch should be for all future operations, even in the presence
of a prefix on the tagged version name. However, the resulting name of
the local branch was not used in later operations where the script must
switch back and forth between previous tags and the working local
branch. This patch stores the calculated branch name in the variable
'branch', and makes other operations use that branch name instead of
attempting to recalculate it themselves.

Change-Id: I904407c7f0297d2d9e6092fcbda6fc0e0201f0ac
---
M mkrelease.py
M release_summary.py
2 files changed, 11 insertions(+), 4 deletions(-)

Approvals:
  Mark Michelson: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Verified



diff --git a/mkrelease.py b/mkrelease.py
index ab1706c..b0e7f1d 100755
--- a/mkrelease.py
+++ b/mkrelease.py
@@ -49,6 +49,9 @@
 # Whether or not we should display debug information.
 debug = False
 
+# The working branch for the release
+branch = None
+
 
 class ExitException(Exception):
     """Exception raised by prompt_to_continue to stop the script"""
@@ -130,6 +133,7 @@
     Keyword Arguments:
     repo    - The prepared repo
     """
+    global branch
 
     if version_object.prefix:
         mainline = '{0}/{1}.{2}'.format(version_object.prefix,
@@ -245,7 +249,7 @@
         dprint("Copied '{0}' to '{1}'".format(change_log_path, old_log_path))
 
         # Switch back to our branch
-        repo.switch_local_branch(version[:version.rindex('.')])
+        repo.switch_local_branch(branch)
 
         # Actually create the new ChangeLog
         with open(change_log_path, 'w') as c_file:
@@ -516,7 +520,6 @@
         Keyword Arguments:
         path - The location of the extracted Asterisk release
         """
-        branch = version[:version.index('.')]
         curdir = os.getcwd()
         os.chdir(path)
         dprint("Running build_tools/prep_tarball")
diff --git a/release_summary.py b/release_summary.py
index 39b59a5..971717d 100755
--- a/release_summary.py
+++ b/release_summary.py
@@ -111,7 +111,7 @@
         "bugfix": RELEASE_TYPE_BUGFIX,
         "feature": RELEASE_TYPE_FEATURE,
         "security": RELEASE_TYPE_SECURITY
-        }
+    }
 
     @classmethod
     def get_release_type(cls, release_type):
@@ -139,6 +139,7 @@
         self.release_type = ReleaseSummaryOptions.RELEASE_TYPE_BUGFIX
         self.advisories = []
         self.local_root = DEFAULT_REPO_ROOT
+        self.branch = None
 
 
 class ReleaseSummary(object):
@@ -198,7 +199,10 @@
         self.repo = DigiumGitRepo(path, gerrit_repo, show_progress=self.debug)
 
         # Infer the branch from the version
-        branch = self.options.version[:self.options.version.rindex('.')]
+        if not self.options.branch:
+            branch = self.options.version[:self.options.version.rindex('.')]
+        else:
+            branch = self.options.branch
         self.repo.checkout_remote_branch(branch)
 
         self.raw_log_messages = self.repo.get_commits_by_tags(

-- 
To view, visit https://gerrit.asterisk.org/612
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I904407c7f0297d2d9e6092fcbda6fc0e0201f0ac
Gerrit-PatchSet: 2
Gerrit-Project: repotools
Gerrit-Branch: master
Gerrit-Owner: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-commits mailing list