<p>Joshua Colp <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/repotools/+/11425">View Change</a></p><div style="white-space:pre-wrap">Approvals:
George Joseph: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, approved; Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">build: Start with a current branch during release.<br><br>When running the scripts manually during the release, the second script<br>failed because there was no starting branch. Now, an option can be<br>passed to get_repo that will check out the specified branch. This allows<br>the script to commit and push changes to the appropriate branch without<br>having to constantly switch branches manually.<br><br>Change-Id: I5c3496a1cc362895fb1f88e0061cbf0eea440f97<br>---<br>M commit-staging-changes<br>M digium_git.py<br>M process-staging-changes<br>3 files changed, 14 insertions(+), 5 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/commit-staging-changes b/commit-staging-changes</span><br><span>index fc4c1f7..3c4d331 100755</span><br><span>--- a/commit-staging-changes</span><br><span>+++ b/commit-staging-changes</span><br><span>@@ -15,13 +15,15 @@</span><br><span> help="The local root to work from", default="/tmp")</span><br><span> parser.add_argument("-v", "--version", dest="version",</span><br><span> help="The version to be released", required=True)</span><br><span style="color: hsl(120, 100%, 40%);">+ parser.add_argument("-b", "--branch", dest="branch",</span><br><span style="color: hsl(120, 100%, 40%);">+ help="The branch we are currently on", required=True)</span><br><span> </span><br><span> (ns, args) = parser.parse_known_args()</span><br><span> </span><br><span> logging.basicConfig(level=logging.DEBUG, format="%(module)s:%(lineno)d - %(message)s")</span><br><span> </span><br><span> # Default to asterisk and gerrit URL</span><br><span style="color: hsl(0, 100%, 40%);">- repo = get_repo(local_root=ns.local_root)</span><br><span style="color: hsl(120, 100%, 40%);">+ repo = get_repo(local_root=ns.local_root, ns.branch)</span><br><span> </span><br><span> LOGGER.debug("Adding and committing all staging changes")</span><br><span> </span><br><span>diff --git a/digium_git.py b/digium_git.py</span><br><span>index bbf1463..5741064 100644</span><br><span>--- a/digium_git.py</span><br><span>+++ b/digium_git.py</span><br><span>@@ -30,7 +30,7 @@</span><br><span> </span><br><span> </span><br><span> def get_repo(project=None, local_root=None, remote_url=None,</span><br><span style="color: hsl(0, 100%, 40%);">- show_progress=False):</span><br><span style="color: hsl(120, 100%, 40%);">+ show_progress=False, branch=None):</span><br><span> """Prepare the repo that the release will be made from</span><br><span> </span><br><span> Keyword Arguments:</span><br><span>@@ -39,6 +39,7 @@</span><br><span> checked out under (default '/tmp')</span><br><span> remote_url - The remote url for the repository (default GERRIT)</span><br><span> show_progress - False (default) if a progress bar should not be shown</span><br><span style="color: hsl(120, 100%, 40%);">+ branch - The branch to initially checkout</span><br><span> </span><br><span> Returns:</span><br><span> A DigiumGitRepo object</span><br><span>@@ -51,7 +52,8 @@</span><br><span> repo_url = '{0}/{1}'.format(remote_url, project)</span><br><span> </span><br><span> LOGGER.debug("Cloning from '{0}' to '{1}'".format(repo_url, path))</span><br><span style="color: hsl(0, 100%, 40%);">- return DigiumGitRepo(path, repo_url=repo_url, show_progress=show_progress)</span><br><span style="color: hsl(120, 100%, 40%);">+ return DigiumGitRepo(path, repo_url=repo_url, show_progress=show_progress,</span><br><span style="color: hsl(120, 100%, 40%);">+ branch=branch)</span><br><span> </span><br><span> </span><br><span> def delete_previous_branch(repo, version):</span><br><span>@@ -176,7 +178,8 @@</span><br><span> and fetching the repo, providing useful logs/summaries, etc.</span><br><span> """</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- def __init__(self, local_path, repo_url=None, show_progress=False):</span><br><span style="color: hsl(120, 100%, 40%);">+ def __init__(self, local_path, repo_url=None, show_progress=False,</span><br><span style="color: hsl(120, 100%, 40%);">+ branch=None):</span><br><span> """Constructor</span><br><span> </span><br><span> Keyword Arguments:</span><br><span>@@ -191,6 +194,7 @@</span><br><span> provided.</span><br><span> show_progress - If True, print out a progress bar for the various</span><br><span> operations being performed.</span><br><span style="color: hsl(120, 100%, 40%);">+ branch - The branch to initially check out, if any.</span><br><span> """</span><br><span> </span><br><span> self.show_progress = show_progress</span><br><span>@@ -220,6 +224,9 @@</span><br><span> origin.fetch(progress=self.progress)</span><br><span> origin.fetch("--tags")</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ if branch is not None:</span><br><span style="color: hsl(120, 100%, 40%);">+ self.checkout(branch)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> @property</span><br><span> def progress(self):</span><br><span> """Get a progress bar if set to show"""</span><br><span>diff --git a/process-staging-changes b/process-staging-changes</span><br><span>index 4efe98b..ce9086c 100755</span><br><span>--- a/process-staging-changes</span><br><span>+++ b/process-staging-changes</span><br><span>@@ -27,6 +27,6 @@</span><br><span> if ns.local_root != "/tmp/":</span><br><span> used_l_opt = "-l {0} ".format(ns.local_root)</span><br><span> print("Done! Check {0}asterisk and make sure everything looks right. "</span><br><span style="color: hsl(0, 100%, 40%);">- "Then run 'commit-staging-changes {1}-v {2}'.".format(ns.local_root, used_l_opt, ns.end_version))</span><br><span style="color: hsl(120, 100%, 40%);">+ "Then run 'commit-staging-changes {1}-v {2}' -b <current_branch>.".format(ns.local_root, used_l_opt, ns.end_version))</span><br><span> else:</span><br><span> print("Error! Check the logs and remember to clean up {0}asterisk".format(ns.local_root))</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/repotools/+/11425">change 11425</a>. To unsubscribe, or for help writing mail filters, 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/c/repotools/+/11425"/><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-Change-Id: I5c3496a1cc362895fb1f88e0061cbf0eea440f97 </div>
<div style="display:none"> Gerrit-Change-Number: 11425 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Benjamin Keith Ford <bford@digium.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-MessageType: merged </div>