自动化审查请求,ReviewBoard和Mercurial使用Python挂钩 [英] Automating Review Requests with ReviewBoard and Mercurial using Python hooks

查看:215
本文介绍了自动化审查请求,ReviewBoard和Mercurial使用Python挂钩的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我的问题:

我有一个远程变幻无常的存储库,其中挂钩会是建立传入或changegroup,我得到了一个不同的服务器上安装ReviewBoard。
我们的想法是审查要求票代推后,从开发者到自动化远程仓库。
当然,我需要一个调用后的审查也使用提交,作为使用水银的API,它提取用户的钩子(ctx.user()),否则所有审核要求的门票将在用户的名称远程仓库连接到服务器reviewboard

I got a remote mercurial repository where the hook is gonna be setup either incoming or changegroup, and I got a ReviewBoard setup on a different server. The idea is to automate review request tickets generation upon push from devs into the remote repository. Of course, I would need a hook that invoke post-review that also uses submit-as user which extracted using the mercurial api (ctx.user()), or else all the review requests tickets would be in the name of the user that connects the remote repository to the reviewboard server.

我的主要困境实际上是越来越开始修订和终止的修订,如果我用我进来会得到所有节点的变更,但当然钩越来越每次调用,所以没有状态保持每次调用之间。在另一方面,如果我用changegroup我只得到了第一个变更,我不能很好地为comparaison compare.As我需要一种方法来保持previous提示将其发送到后审查基本上是:

My main dilemma is actually getting the start revision and the stop revision , if I use incoming I'll be getting all changesets nodes but of course the hook is getting invoked everytime so there is no status kept between each invocation. On the other hand if I use changegroup I only get the first changeset and I cannot compare.As well for comparaison I need a way to keep the previous tip to send it to post-review basically :

post-review --revision-range=previoustip:newtip --submit-as=ctx.user() 

如果你有关于如何解决这个问题的任何想法,我会很高兴。我明明用Python写了钩。

If you got any ideas on how to solve the problem, I would be happy. I am writing the hook in python obviously.

推荐答案

不知道这是你需要相当的东西,但是这是我使用的执行提交信息检查在pretty大致相同的情况下,必须检查每一个变化,并验证基于所述用户信息。以同样的方式,我需要检查用户的变更是,不是推的用户。
它应该是很容易做的是这样建立的变化的套,同时通过在changegroup的变化循环的特定用户,并在块的开始和结束的版本。

Not sure if this is quite what you need, but this is something I use for executing a commit message check in pretty much the same circumstances, it has to check each change and verify information based on the user. In the same way I need to check the user the changelist is for, not the 'pushing' user. It should be fairly easy to do something like build up the sets of changes for a particular user and the start and end revisions in 'chunks' whilst looping through the changes in the changegroup.

的返回,是因为它被用作pretxnchangegroup钩

The return is because it is used as a pretxnchangegroup hook

def checkAllCommitMessage(ui, repo, node, **kwargs):
    """    
    Checks all inbound changeset messages from a push for adherence to the commit message rules.
    """

    # for each change being submitted
    # get all the details, and call the trigger
    fail = False

    for rev in xrange(repo[node].rev(), len(repo)):
        # get context (change)
        ctx = repo[rev]

        # user who commited the change (NOT necessarily the one who is doing push)
        user = ctx.user()

        # do the hook stuff here...
        # set fail to True if something goes wrong

    return fail

这篇关于自动化审查请求,ReviewBoard和Mercurial使用Python挂钩的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆