2

これが私の問題です:

フックが着信または変更グループのいずれかでセットアップされるリモート mercurial リポジトリを取得し、別のサーバーで ReviewBoard をセットアップしました。アイデアは、開発者からリモート リポジトリへのプッシュ時にレビュー リクエスト チケットの生成を自動化することです。もちろん、mercurial API (ctx.user()) を使用して抽出したユーザーとして送信することも使用するポストレビューを呼び出すフックが必要です。そうしないと、すべてのレビュー要求チケットがそのユーザーの名前になります。リモートリポジトリをレビューボードサーバーに接続します。

私の主なジレンマは、実際には開始リビジョンと停止リビジョンを取得することです.incomingを使用すると、すべての変更セットノードを取得しますが、もちろんフックは毎回呼び出されるため、各呼び出しの間にステータスは保持されません. 一方、changegroup を使用すると、最初の変更セットしか取得できず、比較できません。また、比較のために、以前のヒントを保持して、基本的にポストレビューに送信する方法が必要です。

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

問題を解決する方法について何かアイデアがありましたら、幸いです。私は明らかにPythonでフックを書いています。

4

1 に答える 1

7

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.

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
于 2011-12-23T10:53:26.260 に答える