def git_push():
 app = get_app()
 if (not have_git):
  session.flash = GIT_MISSING
  redirect(URL('site'))
 form = SQLFORM.factory(Field('changelog', requires=IS_NOT_EMPTY()))
 form.element('input[type=submit]')['_value'] = T('Push')
 form.add_button(T('Cancel'), URL('site'))
 form.process()
 if form.accepted:
  try:
   repo = git.Repo(os.path.join(apath(r=request), app))
   index = repo.index
   index.add([((apath(r=request) + app) + '/*')])
   new_commit = index.commit(form.vars.changelog)
   origin = repo.remotes.origin
   origin.push()
   session.flash = T('Git repo updated with latest application changes.')
   redirect(URL('site'))
  except git.UnmergedEntriesError:
   session.flash = T('Push failed, there are unmerged entries in the cache. Resolve merge issues manually and try again.')
   redirect(URL('site'))
 return dict(app=app, form=form)

def git_push ( ) : app = get_app ( ) if ( not have_git ) : session . flash = GIT_MISSING redirect ( URL ( 'site' ) ) form = SQLFORM . factory ( Field ( 'changelog' , requires = IS_NOT_EMPTY ( ) ) ) form . element ( 'input[type=submit]' ) [ '_value' ] = T ( 'Push' ) form . add_button ( T ( 'Cancel' ) , URL ( 'site' ) ) form . process ( ) if form . accepted : try : repo = git . Repo ( os . path . join ( apath ( r = request ) , app ) ) index = repo . index index . add ( [ ( ( apath ( r = request ) + app ) + '/*' ) ] ) new_commit = index . commit ( form . vars . changelog ) origin = repo . remotes . origin origin . push ( ) session . flash = T ( 'Git repo updated with latest application changes.' ) redirect ( URL ( 'site' ) ) except git . UnmergedEntriesError : session . flash = T ( 'Push failed, there are unmerged entries in the cache. Resolve merge issues manually and try again.' ) redirect ( URL ( 'site' ) ) return dict ( app = app , form = form )
git push handler .