<p>George Joseph <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/8292">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Joshua Colp: Looks good to me, but someone else must approve
Corey Farrell: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved; Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">mkrelease: Delete old release branches<br><br>This patch makes it so when the first version of a new release (like a .0 or a<br>cert1 without other modifiers) is done the old release branch is automatically<br>deleted from the Asterisk repository.<br><br>Change-Id: I3928831feef237051c01413ef38ac1e82ffcb9cb<br>---<br>M digium_git.py<br>M mkrelease.py<br>2 files changed, 29 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/digium_git.py b/digium_git.py<br>index e28642f..c76c953 100644<br>--- a/digium_git.py<br>+++ b/digium_git.py<br>@@ -54,6 +54,31 @@<br> return DigiumGitRepo(path, repo_url=repo_url, show_progress=show_progress)<br> <br> <br>+def delete_previous_branch(repo, version):<br>+ """Using the given version object, get the last version and delete the<br>+ branch associated with that version.<br>+<br>+ Keyword Arguments:<br>+ repo - The repo containing the branch to delete<br>+ version - The current version being built (a version object)<br>+ """<br>+<br>+ # Only delete the previous branch when a first new release is made, which<br>+ # corresponds to a ".0" patch number or "cert1". Without any modifiers.<br>+ if not version.is_first():<br>+ return<br>+<br>+ # Find the last tag. We'll then use that as that to extract the branch name<br>+ prev = repo.find_last_tag(version)<br>+ if not prev:<br>+ return<br>+<br>+ branch = prev.branch_name()<br>+<br>+ LOGGER.debug("Deleting previous branch '{0}'".format(branch))<br>+ repo.delete_branch(branch)<br>+<br>+<br> class GitProgressBar(RemoteProgress):<br> """A progress bar that maintains the state of a Git operation<br> """<br>diff --git a/mkrelease.py b/mkrelease.py<br>index 1a71067..83d85a1 100755<br>--- a/mkrelease.py<br>+++ b/mkrelease.py<br>@@ -18,7 +18,7 @@<br> from datetime import datetime<br> from optparse import OptionParser<br> <br>-from digium_git import get_repo<br>+from digium_git import get_repo, delete_previous_branch<br> from version_parser import AsteriskVersion<br> from release_summary import ReleaseSummary, ReleaseSummaryOptions<br> from alembic_creator import create_db_script<br>@@ -432,6 +432,9 @@<br> <br> prompt_to_continue("Confirm tag creation of '{0}'".format(version))<br> repo.create_tag(version)<br>+ if options.project.lower() == 'asterisk':<br>+ # Delete the previous branch if needed<br>+ delete_previous_branch(repo, version_object)<br> <br> <br> def create_hashes(archive, mod=None):<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/8292">change 8292</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/8292"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: repotools </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I3928831feef237051c01413ef38ac1e82ffcb9cb </div>
<div style="display:none"> Gerrit-Change-Number: 8292 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>