default.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:web3py 作者: web2py 项目源码 文件源码
def git_push():
    """ Git Push handler """
    app = get_app()
    if not have_git:
        session.flash = GIT_MISSING
        redirect(URL('site'))
    form = Form([Field('changelog', requires=IS_NOT_EMPTY())])
    #form.element('input[type=submit]')['_value'] = T('Push')
    #form.add_button(T('Cancel'), URL('site'))

    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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号