Search code examples
gitmercurial

Forbidding pushes on Git/Mercurial


Is there any plugin for distributed SCMs that forbids pushing code that doesn't fulfil a certain criteria (e.g. min test coverage)?


Solution

  • Both current answers address Mercurial; with git, there are also hooks, and you will want either the pre-receive or update hook. See the githooks man page for information.

    Be careful using them to check for things like test coverage, though - you don't want the user to have to wait for time-consuming tests to run while attempting to push.