Keywords: launchpad bazaar first time, bzr, host project

Bazaar and launchpad

Install bazaar

aptitude install python-pyrex
aptitude install bzr

easy_install bzr
easy_install pyrex

cd
virtualenv --no-site-packages bzrENV
cd bzrENV
source bin/activate

easy_install bzr
or
easy_install "bzr==1.9"

Launchpad

cd
ssh-keygen -t rsa

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

bzr launchpad-login myusername

bzr whoami

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

Create a project

cd
mkdir myproject
cd myproject
mkdir trunk
cd trunk
touch README.txt License.txt

bzr init

bzr add

bzr commit -m "Initial Import"

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

Upload the project

bzr push lp:~myusername/myproject/trunk --use-existing-dir

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.

* 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

bzr log

bzr diff

bzr diff
or
bzr diff > this_is_my_patch.diff

Deleting, removing, renaming files

bzr mv oldfilename.txt newfilename.txt

bzr remove

bzr revert

Undoing changes

Tagging

bzr commit --tag TAG_NAME
or
bzr commit --tag myproject-release-0.1

bzr tag -r 77 myproject-release-0.7

bzr diff -r tag:myproject-0.1
bzr log -r tag:myproject-0.1

bzr tags

Checkout

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

bzr checkout --lightweight /srv/foo-repo/foo.feature foo.feature

bzr update

bzr commit -m"Updating xyz"

Checkout with launchpad

bzr checkout http://bazaar.launchpad.net/~szybalski/datahub/trunk

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

http checkout to sftp checkout

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

Convert to Bazaar

csv to bzr

  1. csv to bazaar instructions

From Subversion to Bazaar repository

  1. svn with bzr

  2. 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. 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. bugzilla,trac,launchpad, build in link to a bug tracker

References

  1. Bazaar Main Docs

  2. svn style(central repository) work flow with distributed vcs bazaar

  3. Bazaar in 5 min

  4. Code Management

  5. Bazaar man Page. All options

  6. bzr as central repository, notes

  7. Tagging in bzr

Troubleshooting

Could not acquire lock "(remote lock)"

Problem:

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)"

Solution:

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

checkout then commit

bzr: ERROR: Cannot lock LockDir(http://bazaar.launchpad.net/%7Emyusername/myproject/path/.bzr/branch/lock): Transport operation not possible: http does not support mkdir() 

bzr launchpad-login myusernam

bzr bind lp:~myusername/myproject/path
#in my case it was
bzr bind lp:~szybalski/datahub/trunk

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