| 1 | hg2pubsub is a small script to make it easy to post Mercurial commits to an XMPP pubsub (XEP-0060) service. |
| 2 | |
| 3 | It posts the commits in the standard ATOM format, so they can be easily consumed by existing tools, |
| 4 | clients (for example, Gajim) and bots (for example, Riddim). |
| 5 | |
| 6 | Installation: |
| 7 | |
| 8 | - Requires Verse: http://code.matthewwild.co.uk/verse |
| 9 | - Run 'make install' to install to /usr/local/bin |
| 10 | |
| 11 | Usage: |
| 12 | |
| 13 | hg2pubsub CONFIG SERVICE NODE ID URL |
| 14 | |
| 15 | Where the parameters are as follows: |
| 16 | |
| 17 | - CONFIG: The filename of the config file containing the XMPP server credentials. The file |
| 18 | is a simple text file, with the first line as the JID and the second line as the password. |
| 19 | Ensure the permissions on this file prevent other users on the system from reading it. |
| 20 | - SERVICE: The pubsub service to publish to, e.g. 'pubsub.example.com'. |
| 21 | - NODE: The pubsub node to publish to, e.g. 'commits' |
| 22 | - ID: The item id. Use the project name or branch - e.g. 'trunk'. |
| 23 | - URL: If your repository is accessible via the web, set this to the root of your project, |
| 24 | e.g. 'http://code.example.com/'. |
| 25 | |
| 26 | You need to pipe to hg2pubsub the commits you want it to announce as XML. Mercurial supports XML output natively |
| 27 | using '--style xml'. |
| 28 | |
| 29 | Here is an example commit hook that would go in ~/.hgrc (system-wide) or project/.hg/hgrc (project only) to |
| 30 | publish commits: |
| 31 | |
| 32 | [hooks] |
| 33 | changegroup.pubsub = hg log -r $HG_NODE: --style xml | hg2pubsub ~/.hg2pubsub pubsub.example.com commits $(basename $PWD) http://code.example.com/ >/dev/null |