Bazaar with Master Branch
Problem statement
I have a bit svnish view of writing software: there should be one master branch for project just not to confuse users of your code where to get the most recent code from.
I’m writing a little app (I’ve posted about it earlier) with my girlfriend and we wanted to share and control code with possibly the best DVCS in the world. Bazaar promises an easy way for svn people to support central/master branch workflow. Or so I thought.
Early attempt
I was to confident with bazaar easiness. So I made bzr push over sftp to some directory on hauru.eu and told my girlfriend it’s ready. But it wasn’t: all files had my user permissions (uid/gid) and she couldn’t check anything in. So… It’s not so easy. I could change initial group for both of us, but this is not general solution (it wouldn’t work on WebFaction shared hosting where you can’t change initial group).
Heaving previous experience with setting svn central repository I tried to bzr serve the code. But this is simplistic mechanism with no read-write authentication support.
SGID to the rescue
With an advice from Paweł I tried setting SGID on repository directory. It sounded as a good idea, but it didn’t work. I was desperate, but I took another shot and browsed the web for solutions with SGID.
It seems there is bug in OpenSSH or python-paramiko or in bazaar sftp support and it doesn’t honor SGID properly. But with smart-server, that is bzr+ssh it does. Moreover it works much faster than sftp. So it’s double win.
Complete solution
In four steps:
- on server create empty repo folder
- change group to some common (users or bzr or your-project)
- set SGID on the folder
- now you can push your branch with
bzr push bzr+ssh://server/repo-path
Every one in group can check code in and out.
Of course this should not stop you from having as many side branches as you want, but it's good to have a single code branch you can always refer to.
Comments(0)