Hooks for flow

Issue #96 resolved
denis ramic
created an issue

Hello, I have a question regarding hooks and flow:

Is is possible to write custom hooks that integrate into flow workflow?

Like for example:

Am I able to create a custom hook after feature close before merge to develop with the current version?

In detail (why this question): I would like to start some tool to lint and test the code from the feature before it even can land on develop

Comments (5)

  1. denis ramic reporter

    Do you think this could become part of the flow extension?

    Probably new properties in hgrc/mercurial.ini like

    hook_before_feature_close = some exe/bat call (if return is 0 then operation is aborted)
    hook_before_release_close = some exe/bat call (if return is 0 then operation is aborted)
  2. Yujie Wu repo owner

    Yeah, it could be.
    Meanwhile, for your purposes, I think you utilize the builtin pre-<command> hook. For example, add this in your mercurial.ini file:

    pre-flow = "flow_hook.py"

    and you have to implement the "flow_hook.py" yourself. The document for pre-<command> is below:


    Run before executing the associated command. The contents of the command line are passed
    as "$HG_ARGS". Parsed command line arguments are passed as "$HG_PATS" and "$HG_OPTS".
    These contain string representations of the data internally passed to . "$HG_OPTS" is a dictionary
    of options (with unspecified options set to their defaults). "$HG_PATS" is a list of arguments. If the
    hook returns failure, the command doesn't execute and Mercurial returns the failure code.

    The flow_hook.py has to do a little bit parsing to know the command is a feature close or what.

  3. Log in to comment