How do I prevent a branch from being pushed to another branch in BZR?

We use a dev-test-prod branching scheme with bzr 2. I'd like to setup a bzr hook on the prod branch that will reject a push from the test branch. Looking at the bzr docs, this looks doable, but I'm kinda surprised that my searches don't turn up any one having done it, at least not via any of the keywords I've thought to search by. I'm hoping someone has already gotten this working and can share their path to success.

My current thought is to use the pre_change_branch_tip hook to check for the presence of a file on the test branch. If it's present, fail the commit.

You may ask, why test for a file, why not just test the branch name? Because I actually need to handle the case where our developers have branched their devel branch, pulled in the shared test branch and are now (erroneously) pushing that test branch to production instead of pushing their feature branch to production. And it seems a billion times easier to look for a file in the new branch than to try to interrogate the sending branch's lineage.

So has someone done this? seen it done? or do I get to venture out into the uncharted wasteland that is hook development with bzr? :)


your approach should work and the plugin will be quite simple: just raise an exception if the file is present. (For some sample code you can look at a plugin I wrote that can prevent commits on some conditions

Need Your Help

Socket.IO - how to handle Node.js offline

node.js sockets callback

Everything works great with different browsers connected to the same port chatting away, but when I close my Node server with ctrl+C, I get the following error in my browser:

Storing a image in mongodb

node.js mongodb stream buffer

I'm trying to store images in mongo after downloading it with request

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.