'Commits the transaction, making the new app version available.
All the files returned by Begin() must have been uploaded with UploadFile()
before Commit() can be called.
This tries the new \'deploy\' method; if that fails it uses the old \'commit\'.
Returns:
An appinfo.AppInfoSummary if one was returned from the Deploy, None
otherwise.
Raises:
RuntimeError: Some required files were not uploaded.
CannotStartServingError: Another operation is in progress on this version.'

def Commit(self):

    assert self.in_transaction, 'Begin()    must    be    called    before    Commit().'
    if self.files:
        raise RuntimeError('Not    all    required    files    have    been    uploaded.')
    def PrintRetryMessage(_, delay):
        StatusUpdate(('Will    check    again    in    %s    seconds.' % delay), self.error_fh)
    app_summary = self.Deploy()
    (success, unused_contents) = RetryWithBackoff((lambda : (self.IsReady(), None)), PrintRetryMessage, 1, 2, 60, 20)
    if (not success):
        logging.warning('Version    still    not    ready    to    serve,    aborting.')
        raise RuntimeError('Version    not    ready.')
    result = self.StartServing()
    if (not result):
        self.in_transaction = False
    else:
        if (result == '0'):
            raise CannotStartServingError('Another    operation    on    this    version    is    in    progress.')
        (success, response) = RetryNoBackoff(self.IsServing, PrintRetryMessage)
        if (not success):
            logging.warning('Version    still    not    serving,    aborting.')
            raise RuntimeError('Version    not    ready.')
        check_config_updated = response.get('check_endpoints_config')
        if check_config_updated:
            (unused_done, (last_state, user_error)) = RetryWithBackoff(self.IsEndpointsConfigUpdated, PrintRetryMessage, 1, 2, 60, 20)
            if (last_state != EndpointsState.SERVING):
                self.HandleEndpointsError(user_error)
        self.in_transaction = False
    return app_summary
