lazarusL
lazarusL

Reputation: 236

Is there a way to configure a local mercurial repository to stop it from being able to push to a remote repository?

In git, there is a common practice of removing push access to the upstream repository for teams which use a specific workflow. This can be accomplished with a simple command to change the configuration. This keeps developers from accidentally pushing up changes without the proper review process. It still allows users to pull the latest changes from that repository.

Is there a way to configure a local mercurial repository to stop it from being able to push to a remote [read-only] repository?

Upvotes: 1

Views: 61

Answers (1)

Lazy Badger
Lazy Badger

Reputation: 97285

You have at least two ways: local and remote

Remote-repo type

On push-target add pretxnchangegroup hook, which reject pushes (all or some), easiest form

#!/bin/sh
echo 'No pushes here'
exit 1

Local type

Add alias, which redefine push into "something" without real push, but note the note in docs

It is possible to create aliases with the same names as existing commands, which will then override the original definitions. This is almost always a bad idea!

Upvotes: 1

Related Questions