Mercurial Changegroup Key Depends On Branches

Does Mercurial have an existing hook that, like changegroup, allows me to perform actions on click, but allows me to perform several actions (or change them) based on which branches are affected by the change sets there?

For example, I need to notify the listener by the URL when the push is done, but ideally it will notify different URLs based on which branch is affected, just not covering them all.

+6
mercurial hook
source share
1 answer

There are no hangs on the branch, but you can do this logic in the hook itself. For example, in hgrc :

 [hooks] changeset = actions-by-branch.sh 

and then in actions-by-branch.sh :

 #!/bin/bash BRANCH=$(hg log --template '{branch}' -r $HG_NODE) BRANCH=${BRANCH:-default} # set value to 'default' if it was empty if [ "$BRANCH" == "default" ] ; then do something elif [ "$BRANCH" == "release" ] ; then do something else else do a different thing fi 

Note that I used a change set, not a changegroup hook. One group of changes can have a set of changes in several branches, which complicates the logic. If you decide to go this route, you need to loop from $HG_NODE all the way to tip in order to act on each set of changes in the change group.

+7
source share

All Articles