Differences between revisions 47 and 48
Revision 47 as of 2009-04-07 18:33:08
Size: 8831
Revision 48 as of 2009-04-14 18:33:09
Size: 9034
Deletions are marked like this. Additions are marked like this.
Line 215: Line 215:
=== http checkout to sftp checkout ===
 *If you have checked out an http code you can convert it to sftp and do commits by doing:
bzr bind sftp://yourusername@launchpad.net/URL_OF_THE_PROJECT

TableOfContents(2) Keywords: launchpad bazaar first time, bzr, host project

Bazaar and launchpad

Install bazaar

aptitude install python-pyrex
aptitude install bzr
  • Alternative is to use python easy_install script to install bazaar if you cannot find the right version in your debian repository.

easy_install bzr
easy_install pyrex
  • If you want to experiment first your could install it in a virtual environment:

virtualenv --no-site-packages bzrENV
cd bzrENV
source bin/activate
  • You should see: (bzrENV) in front of your command line

  • Install bzr into your virtualenv

easy_install bzr
easy_install "bzr==1.9"


  • Create and then register your ssh key

ssh-keygen -t rsa
  • Yous should see:

Generating public/private rsa key pair.
Enter file in which to save the key (/home/lucas/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/lucas/.ssh/id_rsa.
Your public key has been saved in /home/lucas/.ssh/id_rsa.pub.
The key fingerprint is:
b4:...............2d username@yourmachine

cat .ssh/id_rsa.pub
  • And copy and paste the resulting key
  • See if you can loginto launchpad using bazaar

bzr launchpad-login myusername
  • If everything went ok you should see no message.
  • Tell bazaar who you are.

bzr whoami
  • Update the information

bzr whoami "Lucas mylastname <myemail@example.com>"

Create a project

  • Lets create a project

mkdir myproject
cd myproject
mkdir trunk
cd trunk
touch README.txt License.txt
  • Add some files to the trunk. When done initialize the folder

bzr init
  • Add recursively files and folders

bzr add
  • Save the updates locally

bzr commit -m "Initial Import"
  • You should see something like:

 Checking in."
Committing to: /home/lucas/myproject/trunk/
added README.txt
added License.txt
Committed revision 1.

Upload the project

  • Log into launchpad and [https://launchpad.net/projects/+new-guided register your branch}.

  • When done go into the folder where we did first commit and push it to the repository.
  • In there you should have a link like this which you have to paste into a command line while in trunk

bzr push lp:~myusername/myproject/trunk --use-existing-dir
  • You should see something like:

The authenticity of host 'bazaar.launchpad.net (xx.xx.xx.xx)' can't be established.
RSA key fingerprint is 9d:.......89.
Are you sure you want to continue connecting (yes/no)? yes 
Warning: Permanently added 'bazaar.launchpad.net,xx.xx.xx.xx' (RSA) to the list of known hosts.
Created new branch.
  • You have now pushed in a new change into your brand new branch using bazaar on launchpad.net

* Next time when you change something, commit it and you want to push it to the repository you just have to do:

bzr push

Using Bazaar

bzr info/log

  • To find out the what revision you are on type:

bzr log

bzr diff

  • To find out the diff between what was changed and current revision type:

bzr diff
bzr diff > this_is_my_patch.diff

Deleting, removing, renaming files

  • Files and directories can be moved and renamed and bzr keeps track of it:

bzr mv oldfilename.txt newfilename.txt
  • To take a file out of version control (does NOT delete it):

bzr remove
  • To delete a file do rm as usual. bzr revert can restore the file.

bzr revert

Undoing changes

  • Before commit: bzr revert, bzr shelve (bzr unshelve)
  • After commit: bzr uncommit
  • Getting a file from a previous revison: bzr cat


  • "Tag names are non-whitespace Unicode strings starting with a letter. It's recommended that the tag name start with a project identifier: for example, bzr-release-0.9 or hp-ijs-1.2.12."
  • To add a tag the following:

bzr commit --tag TAG_NAME
bzr commit --tag myproject-release-0.1
  • You can also tag a release:

bzr tag -r 77 myproject-release-0.7
  • To see what's changed since a tagged revision:

bzr diff -r tag:myproject-0.1
bzr log -r tag:myproject-0.1
  • When done, commit or push your changes and your tag will be recorded.
  • To list tags do:

bzr tags


  • Bazaar checkout.

bzr checkout branchdir/  newcheckoutdir/ 
bzr checkout sftp://username@remoteserver.com/usr/local/src/projects/myproject/ myproject_dev

  • Or if you don't need full history of changes just can checkout as little as possible:

bzr checkout --lightweight /srv/foo-repo/foo.feature foo.feature
  • To update run:

bzr update
  • To commit/checkin do:

bzr commit -m"Updating xyz"

Checkout with launchpad

  • Anonymous access, via http:

bzr checkout http://bazaar.launchpad.net/~szybalski/datahub/trunk
  • If you want to login you need to create a ssh key if you don't already have it and upload it to your user profile just like we did in a first step.

bzr checkout lp:projectname datahub_trunk
bzr checkout sftp://yourusername@launchpad.net/~szybalski/datahub/trunk datahub_trunk
bzr checkout sftp://yourusername@launchpad.net/URL_OF_THE_PROJECT

http checkout to sftp checkout

  • If you have checked out an http code you can convert it to sftp and do commits by doing:

bzr bind sftp://yourusername@launchpad.net/URL_OF_THE_PROJECT

Convert to Bazaar

csv to bzr

  1. [https://wiki.mozilla.org/Importing_Mozilla_CVS_to_Bazaar csv to bazaar instructions]

From Subversion to Bazaar repository

  1. [http://bazaar-vcs.org/BzrForeignBranches/Subversion svn with bzr]

  2. [http://bazaar-vcs.org/svn2bzr svn to bzr]

Convert Subversion Database to Bazaar

Convert svnadmin dump https to bzr

mkdir tmp
cd tmp
svnadmin create myprojectname
echo '#!/bin/sh' > myprojectname/hooks/pre-revprop-change
chmod +x myprojectname/hooks/pre-revprop-change
#Need full path for thve first part (destination part)
svnsync init file:///home/lucas/tmp/myprojectname https://myprojectname.svn.sourceforge.net/svnroot/myprojectname/
svnsync sync file:///home/lucas/tmp/myprojectname
svnadmin dump myprojectname >myprojectname.dump
python svn2bzr.py myprojectname.dump bzr-myprojectname/

Upload to launchpad if you want to. First register a project https://launchpad.net/projects/+new

cd bzr-uicrawler
bzr push sftp://username@bazaar.launchpad.net/~username/myprojectname/trunk

Using bazaar with svn

  1. [http://www.serverzen.net/2008/08/09/starting-with-bazaar-bzr-svn bzr-svn]

bzr vs mercurial vs git

  1. The ability to version and rename directories is something neither Git nor Mercurial have.
  2. Bazaar plugin for svn can at the moment be used to commit to, pull from, merge from, push to and view logs of Subversion branches from Bazaar.

bzr and git

Work with bazaar

  1. [http://doc.bazaar-vcs.org/bzr.dev/en/user-reference/bzr_man.html#bug-tracker-settings bugzilla,trac,launchpad, build in link to a bug tracker]


  1. [http://doc.bazaar-vcs.org/bzr.dev/en/user-guide/index.html Bazaar Main Docs]

  2. [http://blogs.gnome.org/jamesh/2006/08/17/shared-branches-using-bazaar-and-launchpad/ svn style(central repository) work flow with distributed vcs bazaar]

  3. [http://doc.bazaar-vcs.org/latest/en/mini-tutorial/index.html Bazaar in 5 min]

  4. [http://jpipes.com/index.php?/archives/250-A-Contributors-Guide-to-Launchpad.net-Part-2-Code-Management.html Code Management]

  5. [http://doc.bazaar-vcs.org/bzr-0.10/bzr_man.htm Bazaar man Page. All options]

  6. [http://ligarto.org/rdiaz/BzrCentralLocalRepoNotes.html bzr as central repository, notes]

  7. [http://bazaar-vcs.org/Tag Tagging in bzr]


Could not acquire lock "(remote lock)"


Using saved location: bzr+ssh://usernamei@bazaar.launchpad.net/~username/myproject/trunk/
Unable to obtain lock lp-46075600:///~username/myproject/trunk/.bzr/branch/lock
held by username@bazaar.launchpad.net on host [process #9668]
locked 9 minutes, 23 seconds ago
Will continue to try until 02:10:45, unless you press Ctrl-C
If you're sure that it's not being modified, use bzr break-lock lp-46075600:///~username/myproject/trunk/.bzr/branch/lock
bzr: ERROR: Could not acquire lock "(remote lock)"


bzr break-lock lp:~username/myproject/trunk

MyWiki: Bazaar (last edited 2009-11-25 14:57:47 by LukaszSzybalski)