- Bazaar and launchpad
- Using Bazaar
- Convert to Bazaar
- Work with bazaar
Bazaar and launchpad
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:
cd 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 or easy_install "bzr==1.9"
- Create and then register your ssh key
cd 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
Upload your ssh key to launchpad. Under your username click change details, paste the key and say import key.
- 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.
- Update the information
bzr whoami "Lucas mylastname <firstname.lastname@example.org>"
Create a project
- Lets create a project
cd mkdir myproject cd myproject mkdir trunk cd trunk touch README.txt License.txt
- Add some files to the trunk. When done initialize the folder
- Add recursively files and folders
- 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:
- To find out the what revision you are on type:
- To find out the diff between what was changed and current revision type:
bzr diff or 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):
- To delete a file do rm as usual. bzr revert can restore the file.
- 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 or 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:
- Bazaar checkout.
bzr checkout branchdir/ newcheckoutdir/ or bzr checkout sftp://email@example.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:
- 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 or bzr checkout sftp://firstname.lastname@example.org/~szybalski/datahub/trunk datahub_trunk or bzr checkout sftp://email@example.com/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://firstname.lastname@example.org/URL_OF_THE_PROJECT
Convert to Bazaar
csv to bzr
From Subversion to Bazaar repository
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://email@example.com/~username/myprojectname/trunk
Using bazaar with svn
bzr vs mercurial vs git
- The ability to version and rename directories is something neither Git nor Mercurial have.
- 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
Could not acquire lock "(remote lock)"
Using saved location: bzr+ssh://firstname.lastname@example.org/~username/myproject/trunk/ Unable to obtain lock lp-46075600:///~username/myproject/trunk/.bzr/branch/lock held by email@example.com 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
checkout then commit
- If you have checked out a code, as an not-logged in user and then try to commit you might get an error like:
bzr: ERROR: Cannot lock LockDir(http://bazaar.launchpad.net/%7Emyusername/myproject/path/.bzr/branch/lock): Transport operation not possible: http does not support mkdir()
- In order to fix that you need to first tell bzr what your login name is:
bzr launchpad-login myusernam
- Assuming you already have the ssh key in launchpad for this machine you need to do:
bzr bind lp:~myusername/myproject/path #in my case it was bzr bind lp:~szybalski/datahub/trunk
- Now you can commit.