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
3
votes
1 answer

Mercurial Repository - Automatic daily hg add/hg commit command on server

I have a web server which is using mercurial as the repository. Every day, we have files being written by applications to our server and I want these to be reflected in the repository. Is there a way to add an automated 'hg add' and 'hg commit'…
Jason
  • 363
  • 3
  • 14
3
votes
2 answers

Mercurial hook to test that username is valid when pushing to repository

I have a "central" repository that I want to ensure that no one pushes changes in to with a wrong user name. But I can not figure out how to make a hook that tests the user name against a positive list. I have found in the Mercurial API a ctx.user()…
place
  • 73
  • 6
3
votes
1 answer

Detect new lines in mercurial

We are studying to add precommit hooks to detect coding standards compliance with our company policy. We don't want to detect the legacy code, just the new lines added. In git it's possible to detect the line numbers that are added before…
pacorrop
  • 547
  • 1
  • 4
  • 10
3
votes
1 answer

how to read configuration settings from custom hooks?

We are moving from HG to Rhodecode and we are using custom buildbot hook for building on push event. As mentioned here it is straight forward to add custom mercurial hook in Rhodecode. The issue is we are reading the configuration, e.g. credentials,…
Javed
  • 5,904
  • 4
  • 46
  • 71
3
votes
1 answer

Where do you put python code for hooks

I have created a python script I want a mercurial hook to call but what I cant figure out is where the working directory (or where to start the path to the script) should be from. I know this probably isnt right but I need a way to set a hook…
Tyler Smith
  • 1,269
  • 1
  • 12
  • 24
3
votes
5 answers

How can I create a mercurial hook that prevents new heads?

I have several repositories that have been converted from SVN and moving forward we want make sure when people push to the repository they can't create additional heads. there are several hooks in the TipsAndTricks wiki page that prevent pushing if…
Asa Ayers
  • 4,854
  • 6
  • 40
  • 57
3
votes
1 answer

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:…
MdaG
  • 2,680
  • 2
  • 34
  • 46
3
votes
1 answer

Mercurial avoid pre-commit hook on shelving

I'm coding a simple hook in order to check syntax of project's files. I want check syntax only before a commit. My problem is : When I do a shelve, Mercurial run pre-commit hook. The syntax checking take 4-5 minutes. How can I avoid to run my hook…
Samuel Dauzon
  • 10,744
  • 13
  • 61
  • 94
3
votes
3 answers

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…
Knio
  • 6,638
  • 3
  • 29
  • 29
3
votes
1 answer

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,…
Tom Bell
  • 1,120
  • 2
  • 16
  • 33
3
votes
1 answer

Mercurial: How to post-hook push to Bitbucket?

We have a 'master' Mercurial server on our network that we use for a local staging box. Our team does all of our pushes and pulls to/from this one box. I'm having trouble with the implementation I'm using, but I'm also second guessing whether what I…
DOOManiac
  • 6,066
  • 8
  • 44
  • 67
3
votes
1 answer

tortoisehg and pre-status hook

I've added "pre-status" hook to hgrc file, and it works pretty well, if I type "hg status" in console. But this hook doesn't work in Tortoise HG. I spent several hours trying to solve this riddle, but looks like Tortoise HG uses something different…
LOMS
  • 51
  • 6
3
votes
1 answer

Mercurial: how to add a hook on pull

I've searched awhile for this and haven't seen anything. Which could mean, it's not supposed to be done or it just can't be done. I looked at a list of hooks for mercurial and I could not seem to find (or get one working) that executed a script…
Muradin007
  • 158
  • 14
3
votes
1 answer

How can I commit a file before the tag is committed?

I want to automatically bump the version of my project when I use hg tag XXX. I have set up a pretag hook in my hgrc (note: I have removed the stuff that ensures it is outputting to VERSION in hg root, for clarity): [hooks] pretag.bump_version =…
Matthew Schinckel
  • 35,041
  • 6
  • 86
  • 121
2
votes
2 answers

Mercurial changegroup hook: repository URL

How can I, on a Mercurial repository server, figure out the current repository URL or at least name (subpath) in a changegroup — or somewhat equivalent — hook? I'm running HgWeb on IIS. $HG_URL returns the pushers URL, not the receiving…
J F
  • 631
  • 7
  • 15