Prevent commit to wrong named branch

Sune Foldager cryo at cyanite.org
Mon May 9 09:12:13 UTC 2011


On 2011-05-09 11:00, jf wrote:
>Hello,
>
>I'm planning to use mercurial with named banches, but I think it's too
>easy to commit something in the wrong branch.

Personally, I think it's worse that you can easily push stuff on something
that isn't the current branch. But a hook can help.

>It would be great if I could add an option to "hg commit" which will
>option to "hg commit" which will blame me if I'm not where I think I am, for example: hg commit -b 
>branch_1_0 -m "msg"
>> commit aborted: silly dev: you're in default branch not in branch_1_0 !
>
>Is there a hook or an extension for doing this ?

You can probably easily write a pre-commit hook to do something like that.

Sune



More information about the Mercurial mailing list