This document specifies mapping between Subversion and Bazaar semantics. Revision: 3 Jelmer Vernooij , June 2006. Updated October 2006. Updated December 2006. == Branch paths == It is hard to know, given a SVN URL, to figure out what branch a particular file is in. Other then the convention that branches are named 'trunk' and 'branches/*', there is no way to automatically find out what a branch is. Finding out what a branch is and what is not is done by a BranchingScheme implementation. At the moment, the following branching schemes are available: * NoBranchingScheme: The top-level directory in the repository is a branch. (consequence of this is that there is only one branch total) * TrunkBranchingScheme: There is a directory structure with 'trunk', 'branches', and 'tags' directories as common in Subversion-based projects. These directories can be nested (e.g. subproject1/trunk) inside the repository. The level of nesting is stored. * ListBranchingScheme: There is a list of branches. This branching scheme is present in the code, but is never used automatically (yet). The branching scheme can be explicitly specified or automatically guessed. The guessing algorithm currently works as follows and is based on paths relative to the repository root: * Look for 'trunk', 'branches' or 'tags' inside the path - if found, create a TrunkBranchingScheme with the found level of nesting. * Assume NoBranchingScheme NEXT VERSION: Allow specifying the branching scheme in ~/.bazaar/locations.conf. == Revision ids == An easy way to generate globally unique and reproducible revision ids is to simply combine the repositories UUID and commit revision number. However, this can lead to overlap in revision ids when a commit touches more then one branch (something that is possible in SVN). This can be fixed by including the branch path (trunk, branches/SAMBA_4_0, etc) in the revision-id. Example revision id: {{{ svn-v2:14323@0c0555d6-39d7-0310-84fc-f1cc0bd64818-trunk }}} The version number is used to distinguish between versions of the mapping between Bazaar and Subversion. The mapping will change when previously unsupported features are added to Bazaar (see below), or when a bug in bzr-svn is fixed that may affect the mappings. Once branching schemes can be manually specified, also needs to contain branching scheme as it might influence the parents of the current revision (if a parent path is a branch according but not according to another). Since '/' and whitespaces are forbidden in revision ids, the '/', '-', '%' and whitespace characters are all urlencoded. Example revision id for branches/foobranch: {{{ svn-v2:14323@0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2ffoobranch }}} == File ids == Subversion does not use file ids. It is not possible to know whether a file in revision X and a file in revision Y are the same without traversing over all the revisions between X and Y. File ids use the following syntax: svn-v:@-- Since / is forbidden in file ids, the '/', '-', '%' and all whitespace characters are urlencoded. The same rules apply to the roots of branches. This means there is no predefined file id for tree roots. NEXT VERSION: Special rules are applied to make sure that renames are tracked. == Properties == SVN allows setting properties on versioned files and also interprets several of these properties. "svn:executable" is mapped to bzr's executable bit. "svn:ignore" is currently ignored. "svn:mime-type" is currently ignored. "svn:special" for symlinks is interpreted and mapped to symlinks in bzr. "svk:merge" is understood and set where possible. == Ancestry Information == Ancestry in Subversion is linear. Most revisions have just one parent. Files can be copied, moved or merged from other branches, which can result in partial merges that bzr doesn't support at the moment. Whenever a Bazaar commit to Subversion has more than one parent (merges two revisions), it will add a line to the 'bzr:merge' property set on the branch path. The format of these lines is: ([\tPARENT-REV-ID]+)\n This property should be considered add-only. This way, it is possible to know the parents of a revision when running checkout or diff, because the Subversion API will mark the property as modified. The parents can be obtained by simply looking at the last line. Other operations (outside of checkouts) can obtain the revision parents by simply running diff on the property between the current and the previous revision of the branch path. Bazaar will also set 'svk:merge' if one of the merges is originally from a Subversion branch and not on the mainline. If 'svk:merge' is changed and 'bzr:merge' didn't, the diff in 'svk:merge' is also used to obtain the parents of a commit. This means svk and bzr _should be_ interoperable. However, there are no tests for this yet. == Revision properties == Bazaar revision properties are stored in the file properties of the branch path in Subversion. Their names are prefixed with "bzr:revprop:" == Signatures == NEXT VERSION: GPG Signatures for commits will be stored in the SVN revision property 'bzr:gpg-signature'. = Revisions = Revision 1 was the original version of this document. Revision 2 uses real file ids for the tree root rather than the hardcoded "TREE_ROOT" and enforces UTF-8-valid characters for everything except file contents.