The following is a basic introduction to equivalences between Bazaar and Subversion. For further information, refer to the Bazaar documentation online or use Bazaar’s built-in help facilities by doing bzr help COMMAND. For further details, get started with bzr help topics.
To get the source of a project located at URL:
svn co URL working_directory
====>
bzr co --lightweight URL working_directory
Note that Bazaar cannot check out subdirectories of a working tree, so where svn co URL and svn co URL/a/sub/directory both work, it is only possible to do bzr co URL.
To put file1 and file2 under version control:
svn add file1 file2
====>
bzr add file1 file2
Note that bzr add will automatically add all unversioned, non-ignored files under the current directory.
To check the status of the current directory:
svn st
====>
bzr st -S .
Note that Bazaar gives pathnames relative to the top of the working tree while Subversion gives pathnames relative to the current directory.
To commit the current state of the working tree:
svn ci -m 'this is a commit message'
====>
bzr ci -m 'this is a commit message'
You can specify certain files to commit in the same way as in Subversion: bzr ci -m 'dont save all things' file1 file2.
To see the history of the current project:
svn log
====>
bzr log --short
or to give verbose information including all of the files changed by each revision use the -v flag. To see the log for a limited range of revisions:
svn log -r 10:25
====>
bzr log -r 10..25
When other people have made a change to the project, your working copy may be out of date. To update your working copy:
svn up
====>
bzr up
This update may result in conflicts which need to be manually resolved.
Note that the update (up) command in Bazaar is not used to put the working copy in the state of a previous revision as it is in Subversion.
To change the working tree to the state that it had in a previous revision:
svn up -r 25
====>
bzr revert -r 25
Note that both of these commands try not to lose uncommitted information in the working tree, but they may do so in different ways. In both cases, use of the status command after the change is recommended.
Subversion accesses network resources using URLs, as does Bazaar. Both programs have a native server program that runs remotely. These are svn:// and bzr:// URLs respectively. Both of these native protocols can be tunneled over SSH to avoid the need to run a persistent program on the remote system on a separate port. This gives svn+ssh:// and bzr+ssh:// URLs.
Both Subversion and Bazaar can be accessed over HTTP, but there is a difference in how they work with the limitations of that protocol. Subversion runs as a module under Apache and serves repositories using the WebDAV extensions to HTTP, thus allowing read/write access over HTTP. Bazaar accesses the repository using the ordinary HTTP protocol. The relevant difference is that Bazaar access over HTTP is read-only.
Bazaar repositories are also read-write accessible using both SFTP and plain FTP, which are not used by Subversion. See bzr help urlspec for more information.
Both Subversion and Bazaar refer to revisions mainly by way of the -r option to commands. The most common way to refer to revisions is as numbers starting from 1 and counting up with subsequent commits. Both Subversion and Bazaar provide ways to refer to revisions in other terms as well. The table below should serve as a preliminary guide to the equivalences.
Revision desired | Subversion | Bazaar |
---|---|---|
Revision Range | ARG1:ARG2 | ARG1..ARG2 |
Specific Date | {2009-06-04} | date:2009-06-04 |
Latest Revision | HEAD | -1 |
Next-to-last Revision | HEAD-1 | -2 |
Due to the distributed nature of Bazaar, sequential revision numbers are not authoritative in Bazaar as they are in Subversion. Due to merging with other branches, Bazaar’s revision numbers can change. The most consistent way to refer to a revision in Bazaar is a revision id such as
bzr revert -r revid:nmb@wartburg.edu-20091007045325-5jorn2ca1a4dgqp9
These ids can be seen using bzr log --show-ids. There are even more ways to refer to related revisions in Bazaar. See bzr help revspec for further possibilities.