Introduction
This plugin allows bzr direct access to Subversion repositories. This allows bzr branch, bzr push, bzr pull, and bzr co to work directly against Subversion repositories.
The plugin can at the moment be used to commit to, pull from, merge from, push to and view logs of Subversion branches from Bazaar.
Screenshots
- http://samba.org/~jelmer/bzrk-svn.png
- http://samba.org/~jelmer/bzr/bzrsvn-merge.png
- http://samba.org/~jelmer/bzr/bzrsvn-renames.png
- http://samba.org/~jelmer/bzr/bzrsvn-commit.png
- http://samba.org/~jelmer/bzr/bzr-push-to-svn.png
- http://samba.org/~jelmer/bzr/bzr-push-samba.png
- http://samba.org/~jelmer/bzr/bzrsvn-samba3.png
- http://samba.org/~jelmer/bzr/bzrsvn-samba3a.png
Features
The following features are currently present:
- Connecting to remote Subversion repositories over all protocols supported by Subversion itself (at present: svn://, svn+ssh://, http:// (webdav), file://) as well as dump files. Checkouts, lightweight checkouts and branching works.
- Track Bazaar merges in Subversion. Merged revisions show up as ghosts.
- Subversion working copies. Can be modified, queried (bzr status on a svn- native working copy created with svn co works) and committed from.
- Committing to Subversion from Bazaar.
- Push Bazaar revisions to Subversion.
- Follow branch copies. Revision history is not truncated when a branch was copied in Subversion.
- Efficiently uses network bandwidth.
- Recognizes file metadata (executable bits, symbolic links).
- 'svn-import' command with functionality similar to svn2bzr.
- Ability to track merges done with SVK (http://svk.elixus.org/ or http://svk.bestpractical.com) and write merges from SVK/Subversion branches in a format understandable by SVK.
- Generates consistent file ids and revision ids. Two branches made using this plugin of the same Subversion branch will result in exactly the same Bazaar branch.
- Handles complex operations in Subversion: committing to two branches at once, upgrading directories to branches, copies from early revisions, ...
- Tested on Linux, Windows and Mac OS X.
Future Enhancements
In the future, I also hope to support:
Features
- Turning delete + copy in Subversion into renames in bzr. Note that bzr revisions with renames can be pushed and pull just fine without losing information about renames because extra metadata is stored in the svn repository for that purpose.
- 'svn:externals'. Externals should be mapped to Bazaar 'by-reference' nested branches and the other way around. Work on progress in http://people.samba.org/bzr/jelmer/bzr-svn/nestedtrees. #82863
- tags
Performance
Network-wise (both bandwidth and roundtrips), the plugin is in good shape. However, it is currently quite CPU-intensive for no good reason and I hope to make a couple of improvements in that area.
- More efficient use of CPU
- Override implementation of get_revision_delta(). Will speed up 'bzr log -v'
- use svn_ra_replay() on systems that have Subversion 1.4. Saves a couple of roundtrips when fetching history. Initial work in branch at http://people.samba.org/bzr/jelmer/bzr-svn/replay
- The function that obtains logs in Subversion leaks memory. This is a known issue.
Documentation
bzr-svn can be used through the regular Bazaar user interface, see the Bazaar Documentation Overview for documentation on that.
Some bzr-svn specific issues are answered by the FAQ.
The way Bazaar metadata is stored in Subversion and the other way around is specified in the mapping specification.
Properties
Some Subversion properties can currently not be represented in Bazaar and are therefore ignored for the time being:
- 'svn:ignore' is not imported. There should be a Repository.get_ignores(revid) call in Bazaar rather than a magic '.bzrignore' file. Spec at https://launchpad.net/products/bzr/+spec/new-ignore-rules
- 'svn:mime-type'
- 'svn:eol-style'. Requires eol support in Bazaar.
- 'svn:keywords'. Requires keywords support in Bazaar. Spec at https://launchpad.net/products/bzr/+spec/bzr-keyword-expansion. #81463
Other features currently held back by Bazaars feature set:
- Horizon revision history. Most of the existing Subversion repositories are quite large and it would therefore be nice to be able to limit the amount of history that needs to be retrieved during checkouts. Subversion supports horizon history fine. . Spec at https://launchpad.net/products/bzr/+spec/shallow-checkouts
- Tracking copies. . Spec at https://launchpad.net/products/bzr/+spec/filecopies
- Showing SVN merges as merges in Bazaar. . Requires support for cherry-picking. Spec at https://launchpad.net/products/bzr/+spec/bzr-cpick-data
Releases
- 0.4.6 (works with Bazaar 1.0 and 1.1)
- 0.4.5 (works with Bazaar 1.0 and higher)
- 0.4.4 (works with Bazaar 0.92 and higher)
- 0.4.3 (works with Bazaar 0.90 and higher)
- 0.4.2 (works with Bazaar 0.90 and higher)
- 0.4.1 (works with Bazaar 0.90 and higher)
- 0.4.0 (works with Bazaar 0.19 and higher)
- 0.3.5 (works with Bazaar 0.18 and higher)
- 0.3.4 (works with Bazaar 0.17 and higher)
- 0.3.3 (works with Bazaar 0.16 and higher)
- 0.3.2 (works with Bazaar 0.15 and higher)
- 0.3.1 (works with Bazaar 0.14 and higher)
- 0.3 (works with Bazaar 0.14 and higher)
- 0.2 (works with Bazaar 0.13 and higher)
- 0.1 (works with Bazaar 0.8 and higher)
Debian/Ubuntu packages are available from Jelmer's Debian repository.
This repository is signed with Jelmers' GPG key (1EEF5276).
Ubuntu hardy and Debian sid already contain the latest release.
Requirements
The plugin requires a couple of fixes to the Python bindings for Subversion that are only available in Subversion 1.5 (trunk).
A patch against Subversion 1.4.3 is also available at http://samba.org/~metze/subversion-1.4.0-metze-python-bindings.patch. To build a fixed version of Subversion's Python bindings using this patch, run:
$ wget http://subversion.tigris.org/downloads/subversion-1.4.3.tar.bz2 $ tar xvfj subversion-1.4.3.tar.bz2 $ cd subversion-1.4.3 $ patch -p1 < subversion-1.4.0-metze-python-bindings.patch $ ./autogen.sh --release $ ./configure $ make $ make check-swig-py $ sudo make install install-swig-py
If you are using Python 2.4, you will need to have the pysqlite module installed. Python 2.5 and higher have sqlite support built in.
After ensuring these dependencies are met, you should be able to check out branches from Subversion using regular bzr commands.
An older patch for Subversion 1.3.2 is available
Python-SVN bindings for Win32 can be found at http://www.scio.com.mx/gui/svn_python-1.4.3.win32.exe. These bindings appear to be dependent on msvcr80.dll (included in .Net 2.0). Windows is supported as of 0.4.0. You will also need to use the Python-based installer of Bazaar rather than the standalone one.
To install on OS X Leopard do something like the following:
# Install the latest stable Bazaar (if you didn't already) sudo easy_install -U paramiko pycrypto bzr # Compile Subversion 1.5 (for better python support) cd /tmp rm -rf svn svn export http://svn.collab.net/repos/svn/trunk svn cd svn curl http://www.webdav.org/neon/neon-0.27.2.tar.gz | tar xz ln -sf neon-0.27.2 neon ./autogen.sh --release ./configure --without-apxs --without-apache --with-ssl make sudo make install make swig-py sudo make install-swig-py cd .. # Setup bzr to recognize the new subversion bindings echo >> $HOME/.profile << \EOF export PYTHONPATH=/usr/local/lib/svn-python export PATH=/usr/local/bin:$PATH EOF . ~/.profile # Install the bzr_svn plugin mkdir ~/.bazaar ~/.bazaar/plugins cd ~/.bazaar/plugins rm -rf svn bzr checkout --lightweight \ http://people.samba.org/bzr/jelmer/bzr-svn/stable svn # Try it out cd /tmp bzr checkout --lightweight \ http://macromates.com/svn/Bundles/trunk textmate-bundles
Packages
Debian/Ubuntu packages with the required fixes backported are available in Ubuntu since Edgy and Debian since Etch. You need the python-subversion and libsvn0 packages. bzr-svn itself is also packaged.
OpenSuse packages created by Michael Wolf are available from http://download.opensuse.org/repositories/home:/maw:/bzr/
Installation instructions for Fedora/RedHat are on https://planning.acm.org/hq/documentation/version-control/installing-bzr-svn
An unofficial Gentoo overlay containing the patches for Subversion versions 1.3 and 1.4, plus a bzr-svn ebuild are hosted on launchpad at https://launchpad.net/bzr-gentoo-overlay/.
Bugs
Please file bug reports in launchpad. The product URL for bzr-svn is https://launchpad.net/bzr-svn/.
Development
Branches
- http://people.samba.org/bzr/jelmer/bzr-svn/0.4 (stable release series)
- http://people.samba.org/bzr/jelmer/bzr-svn/0.3 (old stable release series)
- http://people.samba.org/bzr/jelmer/bzr-svn/trunk (bleeding edge, may break existing imports every now and then)
Unit testing
Simply run 'bzr selftest svn'
Credits
bzr-svn was written by JelmerVernooij with the help from various other people. See the AUTHORS file in the source distribution for a list.