mercurial-hook

Setting Environment Variables for Mercurial Hook

I am trying to call a shell script that sets a bunch of environment variables on our server from a mercurial hook. The shell script gets called fine when a new changegroup comes in, but the environment variables aren't carrying over past the call to the shell script. My hgrc file on the respository looks like this: [hooks] changegroup...

Mercurial hook not executing properly

This should be a very simple thing to have run, but for some reason it won't work with my Mercurial repository. All I want is for the remote repo to automatically run hg update whenever someone pushes to it. So I have this in my .hg/hgrc file: [hook] changegroup = hg update Simple, right? But for some reason, this never executes. I al...

Using Mercurial hooks to create/load database dumps for versioning

I've started using Mercurial for version-controlling my Drupal project source files (I'm both a VCS and Mercurial newbie). However, the database is still "version-controlled" using a directory of dated .sql.gz files. What I want is to have a single database dump file somewhere within my repository, that would be overwritten with a curre...

Mercurial outgoing Hook

I'm looking to create a Mercurial hook that pushes to a backup remote repository when I push to a local repository. I thought I could hook the 'outgoing' hook, but this creates a infinite loop that isn't pretty. So is there like a post-push hook, or would it be best to have the repository I am pushing to have an 'incoming' hook to push...

Mercurial hook to disallow committing large binary files

I want to have a Mercurial hook that will run before committing a transaction that will abort the transaction if a binary file being committed is greater than 1 megabyte. I found the following code which works fine except for one problem. If my changeset involves removing a file, this hook will throw an exception. The hook (I'm using ...

Getting Mercurial in-process hook to run on Windows

I'm trying to get a Mercurial in-process hook to run on Windows. The problem is not how to write the hook (I want to use an existing one, in this case BugTracker.Net's hook for Mercurial integration - I didn't find a direct link to the file, but you can see it if you download BT.net here, it's in the "mercurial" subfolder). The problem i...

Get list of changesets in a changegroup (mercurial python hook)

I want a mercurial hook that will run JSLint/PyChecker/etc on all files that are modified. However, I do not have control over all hg clients, and want this to run on push to the master repository (which I have control), so a pretxnchangegroup hook on the master seems best. How can I get a list of all changesets that are in the changegr...

Using hooks vs. wrapping commands in mercurial

What are the relative pros and cons for using hooks vs. using an extension that wraps a command for a particular task? In other words, what are the criteria for deciding whether to use hooks or wrap a command? Please also list the cases where one approach is the only option. One case I can think of is to add new arguments for existing ...

Is it possible for my Mercurial hook to call code from another file?

I have a hook function named precommit_bad_branch which imports hook_utils. When invoking precommit_bad_branch via a commit I get the following error message: error: precommit.branch_check hook raised an exception: No module named hook_utils abort: No module named hook_utils! It looks like I'm not allowed to call hook_utils from preco...