[Asterisk-code-review] Add remote url option and allow more stop conditions (repotools[master])

Kevin Harwell asteriskteam at digium.com
Thu Mar 24 16:54:49 CDT 2016


Kevin Harwell has uploaded a new change for review.

  https://gerrit.asterisk.org/2461

Change subject: Add remote url option and allow more stop conditions
......................................................................

Add remote url option and allow more stop conditions

digium_git.py:

When branches and tags were created it would immediately push those items to
the remote, and then push subsequent changes/commits again later. This patch
makes it so any new items and/or changes are only pushed when the consuming
module is ready to do so (Namely once all work has been done - mkrelease.py
has been updated to account for these changes).

mkrelease.py & release_summary.py:

For the most part the mkrelease script would push changes upstream along the
way. The remote url was also hardcoded. Both of these things made testing the
script/release process hard.

This patch adds the ability to point the remote repo url to a "test" repo
if needed. It also adds more exit points during the process (when using the
interactive option). One of those points being "push changes", which means
everything is done locally up to that point (nothing has been pushed to the
remote yet). Also converted some of the [debug] logging (and added some) to
use python logger.

Change-Id: I51db48fa146d201b93a388a426ec3ba766e981ae
---
M digium_git.py
M mkrelease.py
M release_summary.py
3 files changed, 197 insertions(+), 173 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/repotools refs/changes/61/2461/1

diff --git a/digium_git.py b/digium_git.py
index 05a5454..5001bf3 100644
--- a/digium_git.py
+++ b/digium_git.py
@@ -10,11 +10,14 @@
 Matt Jordan <mjordan at digium.com>
 """
 
+import logging
 import os
 
 from progressbar import ProgressBar
 from digium_commits import DigiumCommitMessageParser
 from git import Repo, RemoteProgress
+
+LOGGER = logging.getLogger(__name__)
 
 
 class GitProgressBar(RemoteProgress):
@@ -140,121 +143,123 @@
                 raise ValueError("local_path {0} does not exist and "
                                  "repo is None".format(local_path))
             os.makedirs(local_path)
-            if self.show_progress:
-                progress = GitProgressBar()
             self.repo = Repo.clone_from(url=repo_url,
                                         to_path=local_path,
-                                        progress=progress)
+                                        progress=self.progress)
             origin = self.repo.remotes.origin
-        if self.show_progress:
-            progress = GitProgressBar()
-        origin.fetch(progress=progress)
-        if self.show_progress:
-            progress = GitProgressBar()
-        origin.fetch(progress=progress)
 
-    def checkout_remote_branch(self, branch_name, local_name=None):
-        """Set up a local tracking branch of a remote branch
+        origin.fetch(progress=self.progress)
+        origin.fetch(progress=self.progress)
+
+
+    @property
+    def progress(self):
+        """Get a progress bar if set to show"""
+        return GitProgressBar() if self.show_progress else None
+
+
+    def _set_tracking(self, branch, tracking):
+        """Set up tracking on a branch"""
+
+        if branch.tracking_branch():
+            return True
+
+        try:
+            branch.set_tracking_branch(self.repo.remotes.origin.refs[tracking])
+            return True
+        except:
+            # No remote branch, so branch is probably a new local branch.
+            # Tracking will get set later once the branch is pushed
+            pass
+        return False
+
+    def _push_branch(self):
+        """Push the currently checked out local branch to the remote"""
+
+        assert self.current_branch is not None
+
+        LOGGER.debug("Pushing branch {0} to remote".format(self.current_branch))
+        self.repo.remotes.origin.push(refspec='refs/heads/{0}:refs/heads/{1}'.format(
+            self.current_branch, self.current_branch), progress=self.progress)
+        self._set_tracking(self.repo.heads[self.current_branch], self.current_branch)
+
+
+    def branch_exists(self, name):
+        """Determine if a branch exists
 
         Keyword Arguments:
-        branch_name - The remote branch to track
-        local_name  - The name of the local branch. If not specified, will
-                      default to the name of the remote branch
-        """
-        if not local_name:
-            local_name = branch_name
-
-        self.current_branch = local_name
-        origin = self.repo.remotes.origin
-        if local_name in self.repo.heads:
-            # Local version already exists, just use it
-            local_branch = self.repo.heads[local_name]
-        else:
-            remote_ref = [ref for ref in origin.refs
-                          if branch_name in ref.name][0]
-
-            local_branch = self.repo.create_head(local_name, remote_ref)
-            local_branch.set_tracking_branch(remote_ref)
-            self.push_changes()
-
-        local_branch.checkout()
-	origin.pull(refspec=['refs/heads/{0}:refs/heads/{0}'.format(local_name)])
-
-
-    def switch_local_branch(self, name):
-        """Switch to a local branch or tag
-
-        Keyword Arguments:
-        name - The local tag or branch name to switch to
-        """
-        tag = self.get_tag(name)
-        if tag:
-            self.repo.head.reference = tag
-        else:
-            local_branch = self.repo.heads[name]
-            self.repo.head.reference = local_branch
-
-        assert not self.repo.head.is_detached
-        self.current_branch = name
-        self.repo.head.reset(index=True, working_tree=True)
-
-
-    def remote_branch_exists(self, branch_name):
-        """Determine if a remote branch exists
-
-        Keyword Arguments:
-        branch_name - The remote branch to look for
+        name - The name of the branch to look for
 
         Returns:
         True if the branch exists
         False if the branch does not
         """
-        origin = self.repo.remotes.origin
-        remote_ref = [ref for ref in origin.refs if branch_name in ref.name]
-        return (len(remote_ref) != 0)
+
+        return name in self.repo.heads
 
 
-    def create_remote_branch(self, branch_name, tracking='master'):
-        """Create a new remote branch
+    def _push_tags(self):
+        """Push any locally created tags to the remote"""
+
+        LOGGER.debug("Pushing any locally created tag(s) to remote")
+        self.repo.remotes.origin.push(progress=self.progress, tags=True)
+
+
+    def tag_exists(self, name):
+        """Determine if a tag exists locally
 
         Keyword Arguments:
-        branch_name - The remote branch to create
-        tracking    - The branch to track. Defaults to 'master'.
-        """
-        self.checkout_remote_branch(tracking, local_name=branch_name)
-        self.push_changes()
-
-
-    def get_tag(self, tag_name):
-        """Retrieve a particular tag ref from the repo
-
-        Keyword Arguments:
-        tag_name - The name of the tag to retrieve
+        name - The name of the tag to look for
 
         Returns:
-        The tag object, or None
+        True if the tag exists
+        False if the tag does not
         """
-        tag = [t for t in self.repo.tags if t.name == tag_name]
-        if len(tag) == 0:
-            return None
-        return tag[0]
 
-    def create_tag(self, tag_name):
+        return name in self.repo.tags
+
+
+    def create_tag(self, name):
         """Create a new local tag
 
         Keyword Arguments:
-        tag_name - The name of the tag to retrieve
+        name - The name of the tag to create
         """
-        progress = None
 
-        if self.get_tag(tag_name):
-            raise ValueError("Tag '{0}' already exists!".format(tag_name))
-        self.repo.create_tag(tag_name, message="Create '{0}'".format(tag_name))
+        if self.tag_exists(name):
+            raise ValueError("Tag '{0}' already exists!".format(name))
+        self.repo.create_tag(name, message="Create '{0}'".format(name))
+        LOGGER.debug("Created tag {0}".format(name))
 
-        origin = self.repo.remotes.origin
-        if self.show_progress:
-            progress = GitProgressBar()
-        origin.push(progress=progress, tags=True)
+
+    def checkout(self, name):
+        """Checkout the specified tag or branch
+
+        Keyword Arguments:
+        name - The tag or branch to checkout
+        """
+
+        self.current_branch = name
+
+        if self.tag_exists(name):
+            LOGGER.debug("Checking out tag {0}".format(name))
+            self.repo.git.checkout(name)
+            return
+
+        try:
+            branch = self.repo.heads[name]
+        except:
+            LOGGER.debug("Creating local branch {0}".format(name))
+            branch = self.repo.create_head(name)
+
+        branch.checkout()
+
+        # Set up tracking if in the remote
+        if self._set_tracking(branch, name):
+            self.repo.remotes.origin.pull()
+
+        LOGGER.debug("Local branch set to {0}".format(name))
+
 
     def _convert_git_to_digium_commit(self, git_commit):
         """Convert a Git commit into a Digium/Asterisk commit
@@ -274,6 +279,7 @@
                 git_commit.author.email).encode('utf-8')
         return digium_commit
 
+
     def _convert_git_to_digium_commits(self, git_commits):
         """Convert a series of Git commits to Digium/Asterisk commits
 
@@ -283,41 +289,57 @@
         Returns:
         A DigiumCommitMessageParser object
         """
+
         digium_commits = []
         for git_commit in git_commits:
             digium_commit = self._convert_git_to_digium_commit(git_commit)
             digium_commits.append(digium_commit)
         return digium_commits
 
-    def get_commits_by_tags(self, start_tag, end_tag):
+
+    def get_commits_by_tags(self, start, end):
         """Retrieve a sequence of commits between two tags
 
         Keyword Arguments:
-        start_tag - The start tag to begin pulling history
-        end_tag   - The end tag to stop at
+        start - The start tag to begin pulling history
+        end   - The end tag to stop at
 
         Returns:
         A list of DigiumCommitMessageParser objects
         """
-        commit_start = self.repo.commit(start_tag)
-        commit_end = self.repo.commit(end_tag)
+
+        commit_start = self.repo.commit(start)
+        commit_end = self.repo.commit(end)
+
+        LOGGER.debug("Retrieve commits between {0} and {1} tags"
+                     .format(start, end))
+
         return self._convert_git_to_digium_commits(
                 list(self.repo.iter_commits(rev='{0}..{1}'.format(
                         commit_start, commit_end))))
 
-    def get_commits_by_date(self, branch, start_date, end_date):
+
+    def get_commits_by_date(self, branch, start, end):
         """Retrieve a sequence of commits between two dates
 
         Keyword Arguments:
-        start_date - The start date to pull history from
-        end_date   - The end date to stop at
+        start - The start date to pull history from
+        end   - The end date to stop at
 
         Returns:
         A list of DigiumCommitMessageParser objects
         """
+
+        commit_start = str(start)
+        commit_end = str(end)
+
+        LOGGER.debug("Retrieve commits between {0} and {1} dates"
+                     .format(start, end))
+
         return self._convert_git_to_digium_commits(
                 list(self.repo.iter_commits(rev=branch,
-                    after=str(start_date), before=str(end_date))))
+                    after=commit_start, before=commit_end)))
+
 
     def add_and_commit(self, files, commit_msg):
         """Add and commit modified files
@@ -326,20 +348,17 @@
         files - The files to add and commit
         commit_msg - Our commit message for the changes
         """
+
+        LOGGER.debug("Adding and committing changes to branch {0}"
+                     .format(self.current_branch))
+
         self.repo.index.add(files)
         self.repo.index.commit(commit_msg)
 
+
     def push_changes(self):
-        """Push branch changes upstream
-        """
-        progress = None
-        origin = self.repo.remotes.origin
+        """Push any changes (branch, tags, etc...) upstream"""
 
-        if self.show_progress:
-            progress = GitProgressBar()
-
-        assert self.current_branch is not None
-        origin.push(refspec='refs/heads/{0}:refs/heads/{1}'.format(self.current_branch,
-                                                                   self.current_branch),
-                    progress=progress)
+        self._push_tags()
+        self._push_branch()
 
diff --git a/mkrelease.py b/mkrelease.py
index a66fe07..a3b02c4 100755
--- a/mkrelease.py
+++ b/mkrelease.py
@@ -6,6 +6,7 @@
 Matt Jordan <mjordan at digium.com>
 """
 
+import logging
 import sys
 import os
 import copy
@@ -21,6 +22,14 @@
 from version_parser import AsteriskVersion
 from release_summary import ReleaseSummary, ReleaseSummaryOptions
 from alembic_creator import create_db_script
+
+LOGGER = logging.getLogger(__name__)
+
+# Bump up the log level for the requests and urllib3
+# modules so we don't see so many messages
+logging.getLogger("requests").setLevel(logging.WARNING)
+logging.getLogger("urllib3").setLevel(logging.WARNING)
+
 
 # The one and only Gerrit/Git server.
 GERRIT = 'ssh://gerrit.asterisk.org:29418'
@@ -46,9 +55,6 @@
 # Whether or not we should prompt as we go along.
 interactive = False
 
-# Whether or not we should display debug information.
-debug = False
-
 # The working branch for the release
 branch = None
 
@@ -61,16 +67,6 @@
 class ExitException(Exception):
     """Exception raised by prompt_to_continue to stop the script"""
     pass
-
-
-def dprint(string):
-    """Print out a debug statement
-
-    Keyword Arguments:
-    string  - The string to print
-    """
-    if debug:
-        print "  > {0}".format(string)
 
 
 def prompt_to_continue(prompt=None):
@@ -105,14 +101,12 @@
     global version_object
     global release_name
     global interactive
-    global debug
     global ftp_project
 
     version = options.version
     version_object = AsteriskVersion.create_from_string(version)
     release_name = '{0}-{1}'.format(options.project, version.replace('/', '-'))
     interactive = options.interactive
-    debug = options.debug
 
     i = version.find('/')
     ftp_project = ('{0}-{1}'.format(version[:i], options.project) if i > 0
@@ -130,10 +124,11 @@
     """
 
     path = os.path.join(options.local_root, options.project)
-    repo_url = '{0}/{1}'.format(GERRIT, options.project)
+    repo_url = '{0}/{1}'.format(options.remote_url, options.project)
 
-    dprint("Cloning from '{0}' to '{1}'".format(repo_url, path))
-    repo = DigiumGitRepo(path, repo_url=repo_url, show_progress=debug)
+    LOGGER.debug("Cloning from '{0}' to '{1}'".format(repo_url, path))
+    repo = DigiumGitRepo(path, repo_url=repo_url,
+                         show_progress=options.loglevel == logging.DEBUG)
     return repo
 
 
@@ -156,19 +151,13 @@
         branch = '{0}.{1}'.format(version_object.major,
                                   version_object.minor)
 
-    if repo.remote_branch_exists(branch):
-        dprint("Remote branch {0} exists already".format(branch))
+    if repo.branch_exists(branch):
+        LOGGER.debug("Branch {0} exists already".format(branch))
     else:
-        dprint("Remote branch {0} does not exist".format(branch))
+        LOGGER.debug("Branch {0} does not exist".format(branch))
         prompt_to_continue()
-        repo.create_remote_branch(branch, tracking=mainline)
-        repo.push_changes()
-        dprint("Remote branch {0} (tracking {1}) created.".format(
-            branch, mainline))
 
-    repo.checkout_remote_branch(branch)
-    dprint("Local branch set to {0}".format(branch))
-    return
+    repo.checkout(branch)
 
 
 def extract_tags(options, repo):
@@ -188,21 +177,26 @@
 
     previous = version_object.get_previous_version()
 
+    start_tag = None
     if len(version_object.modifiers) == 0 and version_object.patch == 0:
         # If there are no modifiers and this is the first full release in a
         # series, find the last modified version (RC, beta, etc.)
         search = True
         i = 1
         while search:
-            if repo.get_tag('{0}-rc{1}'.format(version, i)):
+            if repo.tag_exists('{0}-rc{1}'.format(version, i)):
                 start_tag = AsteriskVersion.create_from_string(
                     '{0}-rc{1}'.format(str(version), i))
-            elif repo.get_tag('{0}-beta{1}'.format(version, i)):
+            elif repo.tag_exists('{0}-beta{1}'.format(version, i)):
                 start_tag = AsteriskVersion.create_from_string(
                     '{0}-beta{1}'.format(version, i))
             else:
                 search = False
             i += 1
+
+        if not start_tag:
+            # If we couldn't find it then start from previous
+            start_tag = copy.deepcopy(previous)
     elif (len(version_object.modifiers) > 0 and
           all([num == 1 for mod, num in version_object.modifiers])):
         # If all modifiers are the first of their kind, then our start tag
@@ -260,7 +254,8 @@
             sum_opts.project = options.project
             sum_opts.branch = branch
 
-            summary = ReleaseSummary(sum_opts, debug=debug)
+            summary = ReleaseSummary(
+                sum_opts, debug=options.loglevel == logging.DEBUG)
 
         change_log_path = os.path.join(options.local_root, options.project,
                                        'ChangeLog')
@@ -268,18 +263,18 @@
                                     'OldLog')
 
         if os.path.isfile(change_log_path):
-            dprint("Removing old ChangeLog")
+            LOGGER.debug("Removing old ChangeLog")
             os.unlink(change_log_path)
 
         # Check out the start tag and copy over its ChangeLog
-        dprint("Getting previous change log from '{0}'".format(start_version))
-        repo.switch_local_branch(start_version)
+        LOGGER.debug("Getting previous change log from '{0}'".format(start_version))
+        repo.checkout(start_version)
         shutil.copyfile(change_log_path, old_log_path)
-        dprint("Copied '{0}' to '{1}'".format(change_log_path, old_log_path))
+        LOGGER.debug("Copied '{0}' to '{1}'".format(change_log_path, old_log_path))
 
         # Switch back to our branch
-        dprint("Switching back to {0}".format(branch))
-        repo.switch_local_branch(branch)
+        LOGGER.debug("Switching back to {0}".format(branch))
+        repo.checkout(branch)
 
         # Actually create the new ChangeLog
         with open(change_log_path, 'w') as c_file:
@@ -297,10 +292,10 @@
                 for line in old_file:
                     c_file.write(line)
 
-        dprint("Removing temporary OldLog file")
+        LOGGER.debug("Removing temporary OldLog file")
         os.unlink(old_log_path)
 
-        dprint("Commiting changes to ChangeLog")
+        LOGGER.debug("Commiting changes to ChangeLog")
         repo.add_and_commit([change_log_path],
                             "ChangeLog: Updated for {0}\n".format(version))
         return
@@ -319,7 +314,7 @@
         for f_name in os.listdir(file_dir):
             project = options.project
             if fnmatch.fnmatch(f_name, '{0}-*-summary.*'.format(project)):
-                dprint("Removing old summary: '{0}'".format(f_name))
+                LOGGER.debug("Removing old summary: '{0}'".format(f_name))
                 f_path = os.path.join(file_dir, f_name)
                 os.unlink(f_path)
                 repo.repo.git.rm(f_path)
@@ -342,7 +337,7 @@
         sum_opts.local_root = options.local_root
         sum_opts.project = options.project
         sum_opts.branch = branch
-        dprint("Creating release summary, starting from {0}".format(
+        LOGGER.debug("Creating release summary, starting from {0}".format(
             sum_opts.start_tag))
 
         if len(options.advisories) != 0:
@@ -355,9 +350,10 @@
         file_name = '{0}-summary'.format(release_name)
         file_path = os.path.join(file_dir, file_name)
 
-        summary = ReleaseSummary(sum_opts, debug=debug)
+        summary = ReleaseSummary(
+            sum_opts, debug=options.loglevel == logging.DEBUG)
         summary.to_html(out_file=file_path)
-        dprint("Release summaries created as '{0}'".format(file_path))
+        LOGGER.debug("Release summaries created as '{0}'".format(file_path))
 
         msg = "Release summaries: Add summaries for {0}\n".format(version)
         repo.add_and_commit(['{0}.html'.format(file_path),
@@ -373,7 +369,7 @@
         with open(ver_file_path, 'w') as ver_file:
             ver_file.write(version)
 
-        dprint(".version file written as '{0}'".format(version))
+        LOGGER.debug(".version file written as '{0}'".format(version))
         repo.add_and_commit([ver_file_path],
                             ".version: Update for {0}\n".format(version))
         return
@@ -430,7 +426,6 @@
     create_change_log(summary)
 
     prompt_to_continue("Confirm tag creation of '{0}'".format(version))
-    repo.push_changes()
     repo.create_tag(version)
 
 
@@ -472,7 +467,7 @@
     if prev_obj.major != version_object.major:
         # Different major version. This means this is a *big* jump that
         # can't be expressed in a diff. Bail.
-        dprint("This version '{0}' is a new major version; bypassing "
+        LOGGER.debug("This version '{0}' is a new major version; bypassing "
                "diff".format(version))
         return
 
@@ -481,7 +476,7 @@
     curdir = os.getcwd()
     os.chdir(os.path.join(options.local_root, options.project))
     file_name = '{0}-patch'.format(release_name)
-    dprint("Generating diff from '{0}' to '{1}'".format(start_version,
+    LOGGER.debug("Generating diff from '{0}' to '{1}'".format(start_version,
                                                         version))
     os.system('git diff {0}..{1} > {2}'.format(start_version,
                                                version,
@@ -498,7 +493,7 @@
         tar_obj.add(file_name)
     sign_archive(out_file, '{0}.tar.gz.asc'.format(diff_file))
 
-    dprint("Created diff file '{0}'".format(out_file))
+    LOGGER.debug("Created diff file '{0}'".format(out_file))
     create_hashes(out_file, mod='patch')
 
     os.unlink(diff_file)
@@ -518,7 +513,7 @@
     file_name = '{0}-staging.tar.gz'.format(release_name)
     out_file = os.path.join(os.curdir, file_name)
 
-    dprint("Creating staging archive '{0}'".format(out_file))
+    LOGGER.debug("Creating staging archive '{0}'".format(out_file))
     with open(out_file, 'w') as fs:
         repo.repo.archive(fs, treeish=version, format='tar.gz')
 
@@ -534,7 +529,7 @@
 
     def extract_archive():
         """Extract the specified archive."""
-        dprint("Extract '{0}' to '{1}'".format(archive, release_name))
+        LOGGER.debug("Extract '{0}' to '{1}'".format(archive, release_name))
         with tarfile.open(name=archive, mode='r:gz') as tar_obj:
             tar_obj.extractall(path=release_name)
 
@@ -562,7 +557,7 @@
         """
         curdir = os.getcwd()
         os.chdir(path)
-        dprint("Running build_tools/prep_tarball with {0}".format(mainline))
+        LOGGER.debug("Running build_tools/prep_tarball with {0}".format(mainline))
         os.system('./build_tools/prep_tarball {0}'.format(mainline))
         os.chdir(curdir)
 
@@ -573,7 +568,7 @@
         path - The location of the extracted prep Asterisk release
         """
         name = '{0}.tar.gz'.format(release_name)
-        dprint("Creating final archive '{0}'".format(name))
+        LOGGER.debug("Creating final archive '{0}'".format(name))
         with tarfile.open(name=name, mode='w:gz') as tar_obj:
             tar_obj.add(path)
         sign_archive(name, '{0}.tar.gz.asc'.format(release_name))
@@ -586,7 +581,7 @@
     final_archive = create_archive(release_name)
     create_hashes(final_archive)
 
-    dprint("Cleaning up '{0}' and '{1}'".format(archive, release_name))
+    LOGGER.debug("Cleaning up '{0}' and '{1}'".format(archive, release_name))
     os.unlink(archive)
     shutil.rmtree(release_name)
     return
@@ -606,14 +601,18 @@
     parser.add_option("-a", "--advisory", action="append", default=list(),
                       dest="advisories",
                       help="A security advisory to advertise.")
-    parser.add_option("-d", "--debug", action="store_true", default=False,
-                      dest="debug", help="Provide debug detail")
+    parser.add_option("-d", "--debug", action="store_const",
+                      const=logging.DEBUG, default=logging.INFO,
+                      dest="loglevel", help="Provide debug detail")
     parser.add_option("-i", "--interactive", action="store_true",
                       default=False, dest="interactive",
                       help="Provide interactive prompts")
     parser.add_option("-l", "--local-root", action="store", type="string",
                       dest="local_root", help="The local root to work from",
                       default="/tmp")
+    parser.add_option("-r", "--remote-url", action="store", type="string",
+                      dest="remote_url", help="The remote url",
+                      default=GERRIT)
     parser.add_option("-p", "--project", action="store", type="string",
                       dest="project", help="The project to work from",
                       default="asterisk")
@@ -632,9 +631,12 @@
     if not options.version:
         parser.error("A version is required.")
 
-    if options.interactive and not options.debug:
+    if options.interactive and options.loglevel != logging.DEBUG:
         print "Interactive is True, setting 'debug' to True"
-        options.debug = True
+        options.loglevel = logging.DEBUG
+
+    logging.basicConfig(level=options.loglevel,
+                        format="%(module)s:%(lineno)d - %(message)s")
 
     # The following are all various set up steps that extract options, prepare
     # the environment, and calculate what it is we are trying to create.
@@ -643,8 +645,8 @@
     prepare_branch(repo)
     extract_tags(options, repo)
 
-    if repo.get_tag(version):
-        dprint("Tag '{0}' exists; bypassing tag creation".format(version))
+    if repo.tag_exists(version):
+        LOGGER.debug("Tag '{0}' exists; bypassing tag creation".format(version))
     else:
         prompt_to_continue("Creating tag '{0}', starting history at '{1}', "
                            "with previous version {2}.".format(version,
@@ -652,13 +654,16 @@
                                                                prev_version))
         create_tag(options, repo)
 
-    prompt_to_continue("Tag created, proceeding to tarball.")
+    prompt_to_continue("Tag created, pushing changes to remote.")
+    repo.push_changes()
+
+    prompt_to_continue("Proceeding to tarball.")
     create_patch_archive(options)
     tag_archive = create_tag_archive(repo)
     create_final_archive(tag_archive)
 
-    # Push it live!
-    os.system('push-release.sh {0} {1}'.format(version.replace('/', '-'), ftp_project))
+    prompt_to_continue("Pushing live.")
+    #os.system('push-release.sh {0} {1}'.format(version.replace('/', '-'), ftp_project))
 
     print "Congratulations on the successful creation of {0} {1}!".format(
         options.project, options.version)
diff --git a/release_summary.py b/release_summary.py
index 1ae2d3d..b39f264 100755
--- a/release_summary.py
+++ b/release_summary.py
@@ -203,7 +203,7 @@
             branch = self.options.version[:self.options.version.rindex('.')]
         else:
             branch = self.options.branch
-        self.repo.checkout_remote_branch(branch)
+        self.repo.checkout(branch)
 
         self.raw_log_messages = self.repo.get_commits_by_tags(
                 options.start_tag,

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I51db48fa146d201b93a388a426ec3ba766e981ae
Gerrit-PatchSet: 1
Gerrit-Project: repotools
Gerrit-Branch: master
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>



More information about the asterisk-code-review mailing list