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
4
votes
2 answers

Stop users pushing to stable branch in mercurial

I'm just starting to use Mercurial as a source control system. I was thinking of using the workflow similar to the one outlined here: http://stevelosh.com/blog/2010/05/mercurial-workflows-stable-default/. Basically, have two branches, one 'Stable'…
user1578653
  • 4,888
  • 16
  • 46
  • 74
4
votes
1 answer

Rejecting a push based on commiter name

I've recently set up a mercurial repsoitory. All pusing is done via ssh. Currently only users with an LDAP account can push changes to the repository. However, given that when commiting to a local repository any commiter name can be used using the…
Matthew Gretton
  • 333
  • 2
  • 11
4
votes
1 answer

ignore certain mercurial commands in mercurial hook

I have a mercurial hook like so: [hooks] pretxncommit.myhook = python:path/to/file:myhook with the code looking like this: def myhook(ui, repo, **kwargs): #do some stuff but this hook runs on commands that use the commit logic to do something…
birthofearth
  • 386
  • 4
  • 10
4
votes
1 answer

How to create pre-push hook in Mercurial

Is there a way in mercurial to run a hook before doing a push. For example I'd like to run JSHint over the codebase when I type hg push and abort the push when any errors are found. I first tried using a pre-commit hook. That worked, but it's a…
Rene Saarsoo
  • 13,580
  • 8
  • 57
  • 85
4
votes
0 answers

Mercurial pre-commit hook: How to tell apart changed and committed files

I have following piece of code for fetching a list of all files in current changeset: def changesets(repo, node): if node == None: yield repo[None] else: for rev in xrange(repo[node].rev(), len(repo)): yield…
shabunc
  • 23,119
  • 19
  • 77
  • 102
4
votes
2 answers

How can I restrict commits to a specific branch in Mercurial?

I'm essentially seeking for a way to manage write permissions to specific branches. This can be either before committing (local), or after committing but before pushing (remote). I need to protect certain branches from being written to in order to…
dukeofgaming
  • 3,108
  • 4
  • 28
  • 35
4
votes
0 answers

Determining destination repository in outgoing hook

I'm attempting to write a Mercurial hook that blocks pushes under certain conditions, but to determine whether to block the push it needs to know the repository the push would be going out to. I know that ideally, this would be done in a…
Shoaib
  • 561
  • 3
  • 11
4
votes
1 answer

Reading command line arguments from Mercurial prechangegroup hook

I'm attempting to disallow pushes to a Mercurial repository if a certain condition holds true. However, it is essential that if the user uses push --force, the push goes through regardless. I know that it's easy enough to do this on the machine…
Shoaib
  • 561
  • 3
  • 11
3
votes
1 answer

How to update & restart a Node app with Mercurial following a push? (Equivalent of git post-receive in hg)

I've worked with Git to accomplish this before, but require Mercurial for another project. My Git recipe included a post-receive hook that looked like the following: #!/bin/sh GIT_WORK_TREE=/home/ec2-user/www export GIT_WORK_TREE git checkout…
Wes Johnson
  • 3,063
  • 23
  • 32
3
votes
1 answer

Mercurial pre-push hook scanning the working copy

I need to setup a hook on a repository where people can push, that would run some validation (the goal is to reject the push if validation fails). I already have some hooks setup to auto-update after a successful push, and prevent multiple heads. I…
Gnurfos
  • 980
  • 2
  • 10
  • 29
3
votes
1 answer

How to add hooks for Mercurial MQ commands?

I would like to setup hg hooks for some actions done by mq extension. For example when I do hg qnew I would like to use post-review to create a new review request in our reviewboard server. I would also like to make a hook that updates the diff if…
Nikola Borisov
  • 348
  • 1
  • 10
3
votes
1 answer

How to get TortoiseHG to perform a pre-diff action

I have a pre-diff hook in my hg setup but it is not being executed when I try to commit my changes. What I'm trying to do is generate the database schema file before commit so that it will appear in the list of changes. I also have an update hook…
sebastiaan
  • 5,870
  • 5
  • 38
  • 68
3
votes
3 answers

How to disable pretxncommit hooks with mercurial queues or histedit?

I have some pretxncommit hooks in my local mercurial repository, those hooks are used to check that the commit message includes a reference to a ticket and some other sanity checks. My problem is that when I try to use mercurial queues, commands…
Jaime Soriano
  • 7,309
  • 2
  • 33
  • 45
3
votes
4 answers

How do I set up a hook in HG / Mercurial that gets dictated by the repository?

I have a need for a hook to run after update (this will build the solution they have updated) and I don't want to have to add that hook manually for each person that clones my central repository. When someone first clones my central repository, is…
sebastiaan
  • 5,870
  • 5
  • 38
  • 68
3
votes
3 answers

How can I refuse mercurial check-ins that break the build?

I have a Java project that's managed using Mercurial, and built with Jenkins. Is there a way to prevent developers from checking in code that breaks the build? I know I can do it with Ant and Mercurial hooks, but is there a way to do it with…
Thomas Johnson
  • 10,776
  • 18
  • 60
  • 98
1 2
3
12 13