def CMDUpload(self, options, git_diff_args, orig_args):
    'Uploads a change to codereview.'
    if git_diff_args:
        base_branch = git_diff_args[0]
    else:
        if (self.GetBranch() is None):
            DieWithError("Can't upload from detached HEAD state. Get on a branch!")
        base_branch = self.GetCommonAncestorWithUpstream()
        git_diff_args = [base_branch, 'HEAD']
    self._codereview_impl.EnsureAuthenticated(force=options.force)
    change = self.GetChange(base_branch, None)
    watchlist = watchlists.Watchlists(change.RepositoryRoot())
    files = [f.LocalPath() for f in change.AffectedFiles()]
    if (not options.bypass_watchlists):
        self.SetWatchers(watchlist.GetWatchersForPaths(files))
    if (not options.bypass_hooks):
        if (options.reviewers or options.tbr_owners):
            change_description = ChangeDescription(change.FullDescriptionText())
            change_description.update_reviewers(options.reviewers, options.tbr_owners, change)
            change.SetDescriptionText(change_description.description)
        hook_results = self.RunHook(committing=False, may_prompt=(not options.force), verbose=options.verbose, change=change)
        if (not hook_results.should_continue()):
            return 1
        if ((not options.reviewers) and hook_results.reviewers):
            options.reviewers = hook_results.reviewers.split(',')
    if self.GetIssue():
        latest_patchset = self.GetMostRecentPatchset()
        local_patchset = self.GetPatchset()
        if (latest_patchset and local_patchset and (local_patchset != latest_patchset)):
            print(('The last upload made from this repository was patchset #%d but the most recent patchset on the server is #%d.' % (local_patchset, latest_patchset)))
            print("Uploading will still work, but if you've uploaded to this issue from another machine or branch the patch you're uploading now might not include those changes.")
            ask_for_data('About to upload; enter to confirm.')
    print_stats(options.similarity, options.find_copies, git_diff_args)
    ret = self.CMDUploadChange(options, git_diff_args, change)
    if (not ret):
        git_set_branch_value('last-upload-hash', RunGit(['rev-parse', 'HEAD']).strip())
        if settings.GetRunPostUploadHook():
            presubmit_support.DoPostUploadExecuter(change, self, settings.GetRoot(), options.verbose, sys.stdout)
        if options.dependencies:
            print()
            print('--dependencies has been specified.')
            print('All dependent local branches will be re-uploaded.')
            print()
            orig_args.remove('--dependencies')
            ret = upload_branch_deps(self, orig_args)
    return ret
Uploads a change to codereview.
def CMDUpload(self, options, git_diff_args, orig_args):
    
    if git_diff_args:
        base_branch = git_diff_args[0]
    else:
        if (self.GetBranch() is None):
            DieWithError("Can't upload from detached HEAD state. Get on a branch!")
        base_branch = self.GetCommonAncestorWithUpstream()
        git_diff_args = [base_branch, 'HEAD']
    self._codereview_impl.EnsureAuthenticated(force=options.force)
    change = self.GetChange(base_branch, None)
    watchlist = watchlists.Watchlists(change.RepositoryRoot())
    files = [f.LocalPath() for f in change.AffectedFiles()]
    if (not options.bypass_watchlists):
        self.SetWatchers(watchlist.GetWatchersForPaths(files))
    if (not options.bypass_hooks):
        if (options.reviewers or options.tbr_owners):
            change_description = ChangeDescription(change.FullDescriptionText())
            change_description.update_reviewers(options.reviewers, options.tbr_owners, change)
            change.SetDescriptionText(change_description.description)
        hook_results = self.RunHook(committing=False, may_prompt=(not options.force), verbose=options.verbose, change=change)
        if (not hook_results.should_continue()):
            return 1
        if ((not options.reviewers) and hook_results.reviewers):
            options.reviewers = hook_results.reviewers.split(',')
    if self.GetIssue():
        latest_patchset = self.GetMostRecentPatchset()
        local_patchset = self.GetPatchset()
        if (latest_patchset and local_patchset and (local_patchset != latest_patchset)):
            print(('The last upload made from this repository was patchset #%d but the most recent patchset on the server is #%d.' % (local_patchset, latest_patchset)))
            print("Uploading will still work, but if you've uploaded to this issue from another machine or branch the patch you're uploading now might not include those changes.")
            ask_for_data('About to upload; enter to confirm.')
    print_stats(options.similarity, options.find_copies, git_diff_args)
    ret = self.CMDUploadChange(options, git_diff_args, change)
    if (not ret):
        git_set_branch_value('last-upload-hash', RunGit(['rev-parse', 'HEAD']).strip())
        if settings.GetRunPostUploadHook():
            presubmit_support.DoPostUploadExecuter(change, self, settings.GetRoot(), options.verbose, sys.stdout)
        if options.dependencies:
            print()
            print('--dependencies has been specified.')
            print('All dependent local branches will be re-uploaded.')
            print()
            orig_args.remove('--dependencies')
            ret = upload_branch_deps(self, orig_args)
    return ret