svn-import from simple root svn repo gives bzr revnos = svn revnos + 1

Asked by Martin Spacek

I'd like to completely convert my svn repos (I have several, one per project) over to bzr. I don't need or want my new bzr repos to have any interactivity with the old svn repos.

My svn repos don't have any trunk or branch directories in them - each is its own project. Here's what I typically try:

bzr svn-import --standalone --layout=root -v --trees https://<email address hidden>/svn/project-repo project-repo

Say I have an svn repo with 100 revision. When I run svn-import, the resulting bzr repo with its single bzr branch has bzr revno 1 that doesn't correspond to any svn revno, and goes all the way up to bzr revno 101 that corresponds to svn revno 100. In other words, all my bzr revision numbers are off by 1.

I know this has something to do with the created bzr branch itself being labelled as revision 1, and maybe due to it needing the newer rich-root bzr repo type instead of the default, but this is terrible behaviour as far as I'm concerned. I've made references to lots of svn revnos in the past, and I don't want all these references to be off by 1 after I convert to bzr. I think I've tried all the svn-import options, none of them seems to get rid of this behaviour.

On the other hand, I've noticed that running svn2bzr on a dump of an svn repo works as I expect. Bzr revnos come out identical to the old svn revnos. Also, the bzr repo type is the default pack-0.92, and there's no reference to the original svn repo as the original branch. This is all great. My only problem with svn2bzr is that it screws up the timestamps (they're in UTC, which is fine, but it seems to over-correct for my timezone, so all timestamps are 7 or 8 hours later than they should be in UTC).

I'm using the latest bzr 1.13rc1-1 from the binary windows installer, looks like bzr-svn is 0.5.3 final according to its My svn server is using svn 1.4.6dfsg1-2ubuntu1 (on Ubuntu 8.04).

Is there any way to make svn-import behave like svn2bzr?

Question information

English Edit question
Bazaar Subversion Plugin Edit question
No assignee Edit question
Solved by:
Jelmer Vernooij
Last query:
Last reply:
Revision history for this message
Martin Spacek (mspacek) said :

By the way, .bzr.log reports that bzr-svn is using the subversion 1.5.4 client on my local machine.

Revision history for this message
Martin Spacek (mspacek) said :

Just an update, I've fixed the timezone/timestamp issue in svn2bzr (see branch lp:~mspacek/svn2bzr/tz)

Revision history for this message
Jelmer Vernooij (jelmer) said :

This is unrelated to rich roots. This is caused by the fact that Subversion has a hidden revision "0" that bzr-svn imports as well (since it contains some data), thus causing the revision numbers to be off by one. If you run "bzr log" it should still show you the original revision numbers. See the bzr-svn FAQ for details.

There's no way to skip this particular revision.

Revision history for this message
Martin Spacek (mspacek) said :

I had sort of noticed the svn revision 0, and didn't know what to think of it. It seems that svn2bzr skips it (see line 418 in the latest trunk at Or perhaps it sort of combines svn revisions 0 and 1, and calls it bzr revno 1. Could svn-import not do this as well, or is this considered dangerous?

I know that bzr-svn puts the original svn revnos in a special svnrevno field, but if I'm doing a one-off full conversion from svn to bzr, and I never want to go back, I feel there shouldn't be a need for two separate sets of revnos: one for svn and one for bzr.

Revision history for this message
Martin Spacek (mspacek) said :

Or, what about making a hidden bzr revno 0 that corresponds to the hidden svn revno 0?

Revision history for this message
Best Jelmer Vernooij (jelmer) said :

It could in theory do this, by squashing svn r0 and r1. Providing a different bzr r0 is not possible. However, this would mean breaking the ability to update all existing imports that are already using the current scheme. For this reason, I don't intend to support this.

Bazaar and Subversion revision numbers are fundamentally different anyway; if you use a different layout they will be off by more than just -1. Also, the original svn revision numbers will be shown by "bzr log" and can be referenced by using "svn:...".

Revision history for this message
Martin Spacek (mspacek) said :

OK, I guess with my simple svn repos, svn2bzr is better suited for my needs. Thanks for the replies Jelmer.

Revision history for this message
Martin Spacek (mspacek) said :

Thanks Jelmer Vernooij, that solved my question.

Revision history for this message
Jelmer Vernooij (jelmer) said :

Actually, thinking about this again, I think there's an easy way to work around this by replaying all but the first revision in a new branch using "bzr replay". That should also erase the "svn revno" entries in "bzr log".