Automate Validation Requests with ReviewBoard and Mercurial Using Python Interceptors

Here is my problem:

I have a remote mercury repository in which the hook will be configured for both the incoming and the variable groups, and I got the ReviewBoard setting on another server. The idea is to automate the generation of requests for a request for a request after moving from developers to a remote repository. Of course, I need a hook that calls a post-review, which also uses a submit-as user, which is retrieved using the mercurial api (ctx.user ()), or all requests for feedback requests will be in the name of the user who connects the remote repository to view server.

My main dilemma is actually getting the initial revision and stop version, if I use the inbox, I get all the nodes of the change sets, but, of course, every time the call is called, the call is not saved between each call. On the other hand, if I use changegroup, I get only the first set of changes, and I can not compare. Also for comparaison, I need a way to keep the previous tip in order to send it to the post review basically:

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

If you have ideas on how to solve the problem, I will be happy. I am writing a hook in python.

+2
source share
1 answer

, , , , , . , , "pushing". - "" .

- , pretxnchangegroup

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
+7

Source: https://habr.com/ru/post/1762729/


All Articles