Bazaar and Windows part II

As promised, a little update on how bazaar is working for me under Windows. As it turns out, the plans I had for implementing SVN at work are now obsolete, I liked bazaar so much, we are now using it at work as well.

In the last post we saw how to create a local repository and see some changes between that and your working copy. All nice, but what if you’re not solo’ing a project? Most of the time, you’ll have a development server, maybe even a testing server available. In my case, I have a central server set up from which I run my local websites. I have a local DNS and that simplifies webdevelopment a lot. I have URL’s to all my projects I can use internally.

Anyway, what you probably want, is for your server to contain the main project, work locally on that project and when you’re done editing your branch, publish it back to the server. What I did to accomplish that is to go to my server and into the WWW root. My server is setup much the same way as my workstation (see last post). In my wwwroot are all the websites I’m currenty working on, so the thing to do here is cd into one of them and use the exact same procedure as described in the last post, to create a new project.

Okay then, we have a working repository on a shared server. The next step is to go to your local workstation and go into the wwwroot there. According to Bazaar’s documentation it should be possible to create a new branch from a remote location using different protocols (FTP, SFTP, HTTP, BZR and FILE). To be honest with you, the only one that worked for me right away was FILE. I have FreeSSHD set up on my server and I tried SFTP using that, but the branch command, after asking for my password, just gave me a cryptic:

Authentication (password) successful!
Secsh channel 1 opened.
[chan 1] Opened sftp connection (server version 3)
bzr: ERROR: Operation unsupported

After that, I though I’d try branching via HTTP, this is read-only, bazaar does not (yet) support writing back revisions to a webserver, but alas, another cryptic error:

“bzr: ERROR: Not a branch: “http://%5BURL to my project]/”.

I can imagine this being a showstopper for people, but I had another option to try, the FILE protocol. (I admit I haven’t sought out any help on this in the bazaar community, so if someone finds out how to use SFTP with freeSSHD under windows, leave me a message.) UPDATE: This seems to be  a problem with freeSSHd, using CopSSH on Windows works!

I have a share on my workstations to the wwwroot on my server, mapped to my local W: disk, so I used

bzr branch w:\pure.precompiled.local\

This created a branch of the project on the server on my local machine. Yay!. So now we can develop locally, commit locally, and when we like what we’ve done, push it to the server. For a quick test, open up your editor, edit a file and save. Now use

bzr status

You’ll see that you have (a) modified file(s). Suppose you are happy with your changes, you can commit them (locally) into a revision.

bzr commit -m “edited the title”

Nice, we now have a local revision 2. Now I’d like to see that revision pushed to the server:

bzr push w:\pure.precompiled.local –remember

The –remember option makes sure bazaar remembers where to push changes. If all went well, bazaar should say:

All changes applied successfully.
Pushed up to revision 2.

Quickly pointing my browser to http://pure.precompiled.local; and presto! My server shows me the version with the pagetitle changed.

Now this is all very nice, working locally, commiting locally and then pushing to the server. But if you work with a central server there is an easier way.

Type: “bzr bind w:\pure.precompiled.local” to bind your local repository to the server’s repository. What this does is make sure that any commit is done locally as well as on the central server, at the same time. So there’s no need to use “bzr push” anymore.

To work like this there are only a few key commands to use:

1. bzr update – updates your local repository with any new changes on the server
2. bzr commit – commit your local changes locally and to the server

This is the way I work now at home (solo) and at work (in a team). There is one caveat: the commit to the server doesn’t UPDATE the files on the server. So your changes are stored on the server, but the files on the server stay the way they are until you run “bzr update” locally on the server. There are a few plugins that claim to be a way around this, but for me it’s just a minor problem. I scheduled a bzr update to run every day at work so our server can be looked at by our test-team. If we need an immediate update, I run it manually, no biggie.

In the meantime I made a bazaar toolbar for homesite that lets me do these things and more in a GUI directly from homesite. It’s not really polished, but when I come around to that I’m thinking of posting it on launchpad. If anyone is interested right now, leave me a message.

Happy versioning!

Advertisements

Tags: , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s


%d bloggers like this: