A private Bazaar

Ever wanted to have an external, private source code repository just like those on SourceForge, Google Code or Launchpad? With Bazaar DVCS it is possible with just a bit of hard drive space somewhere and FTP access to it. In other words all that is needed to be able to backup your code, have past revisions at hand or make the code easily available for someone else is a standard shared hosting account (not hard to find a free one). No specialised server or real setup is necessary.

You will need to use FTP for writing to your repository (that is tell Bazaar to use FTP as a "transport", still that means providing your login and password); however you can make the code available for checkout by HTTP.

Setting up

First of all you'll want to get a new version of Bazaar as older versions have problems with renaming files through vsftpd, a FTP server often used by hosting providers. Version 1.4 (rather old even at the time of writing) should be sufficient. (However, if you intend to commit your code over FTP, while making it publicly accessible over HTTP, get at least version 1.7 as older versions may force umask of 0000 over FTP.)

Let's assume you have a project in a directory named MyProject; following is what I consider the easiest way of doing things.

Set up a local branch (without a repository):

cd MyProject
bzr init
bzr add
bzr commit -m "Initial commit."

Set up an external repository for the project (good practice: one project = one repository):

bzr init-repo --no-trees ftp://user:pass@ftp.my.host.com/MyProject

Push the local branch to your repository:

bzr push ftp://user:pass@www.my.host.com/MyProject/trunk

Testing

To test your repository go to another directory (or another machine) and try:

bzr branch ftp://user:pass@www.my.host.com/MyProject/trunk

This should create a trunk directory with all files from your project.

To be able to do that using http, without a password (that means publicly accessible code), you may need to change permissions of .bzr directories and everything in them or place the repository under a www or public_html directory, so they are accessible by the web server and visible to the world.

You can try that last one here:

bzr branch http://www.wrwrwr.org/bazaar/Test/trunk

Notes

Following the above you don't create a local shared repository, which is a bad idea if you will ever have more than one branch for a project locally. If you want one, start with (assuming contents of your project are in MyProject/trunk):

bzr init-repo MyProject
cd MyProject/trunk
bzr init
bzr add
...

Bazaar is very elastic about the workflow. The default behaviour is one of a distributed VCS – all commits go to the local repository and you need to "push" to publish to a server. However, by issuing bzr bind [external location, like ftp://...] you can get the lighter cvs or svn way of doing things:

bzr checkout or bzr update
(work, work, work)
bzr commit, if needed preceded by updating and merging

There are many more things you could do, like setting up a bzr smart server, configuring access through WebDAV, installing a web interface or complementing your setup by a bug tracking system. Although not everything is possible on every shared account some of these well may be.

References:

Comments

Thank you very much...

Thank you very much...

Hi

Just want to thank you for very informative post, regards Ed

Post new comment

  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options