Questions tagged [mercurial-hook]

Mercurial hook is a mechanism to customize and extend functionalities of the Mercurial DVCS.

What it is?

Mercurial hook is a mechanism to customize and extend functionalities of the Mercurial DVCS.

Related tags

  • For more specific questions, this tag can be used in conjunction with and which are independent of the software configuration management system that is used.

See also

185 questions
22
votes
4 answers

Useful Mercurial Hooks

What are some useful Mercurial hooks that you have come across? A few example hooks are located in the Mercurial book: acl bugzilla notify check for whitespace I personally don't find these very useful. I would like to see: Reject Multiple…
Nathan Lee
  • 2,231
  • 2
  • 23
  • 26
19
votes
3 answers

Mercurial pre commit hook - stop commit based on file contents?

How can I setup a pre-commit hook , that will search for a string in the committed files and If found stop the commit ?
johnlemon
  • 20,761
  • 42
  • 119
  • 178
16
votes
2 answers

Easy, painless way to test new mercurial hooks (that are works in progress)

I'm in the process of writing a mercurial changegroup hook. I don't have everything figured out yet, but the process of trial and error is made more painful by the fact that I have to keep committing and pushing just to test my work in progress. Is…
Nick Jennings
  • 3,853
  • 6
  • 30
  • 45
10
votes
1 answer

Mercurial pretxncommit hook - act only on commit, ignore rebase and patch

We are using pretxncommit hook for HG to run a quick static analysis check on code commited. However the hook is triggered on applying any changes to commit tree - which includes rebasing and using MQ to edit and squash commits. Is it possible to…
Artalus
  • 1,114
  • 12
  • 25
10
votes
2 answers

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…
hekevintran
  • 22,822
  • 32
  • 111
  • 180
9
votes
3 answers

How can I share a commit-hook in mercurial with all fellow developers?

we are working with mercurial and now we would like to introduce precommit hooks to keep the code clean. We would like everyone to somehow get the hooks, but we would also like to be able to update this in some centralized way. Mercurial does not…
Nemmi
  • 91
  • 1
8
votes
9 answers

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…
Marc W
  • 19,083
  • 4
  • 59
  • 71
8
votes
2 answers

Mercurial Hook - change a commit message pre commit

Edit Made this basic hook to prevent branch name & commit message bugID mismatches. https://gist.github.com/2583189 So basically the idea is that the hook should append " BugID:xyz" to the end of the commit messages if the branch name is like…
Benbob
  • 13,876
  • 18
  • 79
  • 114
8
votes
2 answers

tortoisehg one step commit push - how to and where is the log file

Iam using win xp with Tortoisehg 2.3. I use bit bucket to backup my personal source code. (rarely for true version control, more as a source backup store). Right now I have to right click on my repo, select commit, then enter a commit message ( i…
7
votes
3 answers

Pylint failing to load plugin on a mercurial precommit hook

I am trying to create a mercurial pre-commit hook that runs pylint on the pre-commit. My project uses a virtual environment. I have the hook set up to call pylint on the changed files but I get the error: Traceback (most recent call last): File…
OultimoCoder
  • 244
  • 2
  • 7
  • 24
7
votes
1 answer

Mercurial Changegroup hook varies based on branches

Is there an existing hook in Mercurial which, like changegroup, allows actions to take place on a push, but allows me to do multiple actions (or vary them) based on which branches are affected by the changesets therein? For example, I need to notify…
ziklagx
  • 173
  • 5
7
votes
3 answers

Mercurial: enforce "hg pull -u" before "hg commit"

I have in some cases a need to enforce that Mercurial-users have run hg pull -u before any hg commit can be allowed, i.e., hg pull will mean that the incoming queue is empty — and furthermore I also want that the person is using the head version of…
Peter Toft
  • 565
  • 7
  • 19
6
votes
1 answer

Can I configure mercurial hooks like some extensions are configured in the hgrc file?

I know how to specify which hooks are run when. What I want to know is if it is possible to pass config into the hook via the hgrc file. Extensions can do this, e.g. [extensions] someextension = something [someextension] some.config =…
Spycho
  • 7,698
  • 3
  • 34
  • 55
6
votes
2 answers

What are the hook parameters passed to external hook program/script?

The title says it: I am looking for the variable names (HG_*) so I can make use of them in my hook script..
Bonefisher
  • 509
  • 1
  • 5
  • 15
6
votes
3 answers

Adding hooks to TortoiseHg

I am using TortoiseHg and would like to apply a hook to my repo. My repo's .hg/hgrc file is as follows: [hooks] pretxncommit = python:hg_checksize.newbinsize The thing is that I don't know where TortoiseHg's PYTHONPATH variable is set. How do I…
hekevintran
  • 22,822
  • 32
  • 111
  • 180
1
2 3
12 13