parameters: ()
docstring: Main function to push the commits in this branch as review requests.
docstring_summary: Main function to push the commits in this branch as review requests.
docstring_tokens: Main function to push the commits in this branch as review requests .
function: def main():
      """Main function to push the commits in this branch as review requests."""
      options = parse_options()
  
      current_branch_ref = _check_output(['git', 'symbolic-ref', 'HEAD']).strip()
      current_branch = current_branch_ref.replace('refs/heads/', '', 1)
  
      if current_branch != 'master':
          print('Please run this script from master branch')
          sys.exit(1)
  
      remote_tracking_branch = _check_output(['git',
                                              'rev-parse',
                                              '--abbrev-ref',
                                              'master@{upstream}']).strip()
  
      merge_base = _check_output([
          'git',
          'merge-base',
          remote_tracking_branch,
          'master']).strip()
  
      if merge_base == current_branch_ref:
          print('No new commits found to push')
          sys.exit(1)
  
      reviews = get_reviews(merge_base + ".." + current_branch_ref)
  
      # Push the current branch to remote master.
      remote = _check_output(['git',
                              'config',
                              '--get',
                              'branch.master.remote']).strip()
  
      print('Pushing commits to', remote)
  
      if options['dry_run']:
          _check_output(['git',
                         'push',
                         '--dry-run',
                         remote,
                         'master:master'])
      else:
          _check_output(['git',
                         'push',
                         remote,
                         'master:master'])
  
      # Now mark the reviews as submitted.
      close_reviews(reviews, options)
function_tokens: def main ( ) : options = parse_options ( ) current_branch_ref = _check_output ( [ 'git' , 'symbolic-ref' , 'HEAD' ] ) . strip ( ) current_branch = current_branch_ref . replace ( 'refs/heads/' , '' , 1 ) if current_branch != 'master' : print ( 'Please run this script from master branch' ) sys . exit ( 1 ) remote_tracking_branch = _check_output ( [ 'git' , 'rev-parse' , '--abbrev-ref' , 'master@{upstream}' ] ) . strip ( ) merge_base = _check_output ( [ 'git' , 'merge-base' , remote_tracking_branch , 'master' ] ) . strip ( ) if merge_base == current_branch_ref : print ( 'No new commits found to push' ) sys . exit ( 1 ) reviews = get_reviews ( merge_base + ".." + current_branch_ref ) # Push the current branch to remote master. remote = _check_output ( [ 'git' , 'config' , '--get' , 'branch.master.remote' ] ) . strip ( ) print ( 'Pushing commits to' , remote ) if options [ 'dry_run' ] : _check_output ( [ 'git' , 'push' , '--dry-run' , remote , 'master:master' ] ) else : _check_output ( [ 'git' , 'push' , remote , 'master:master' ] ) # Now mark the reviews as submitted. close_reviews ( reviews , options )