Rev 403: Import version 3 changes. in http://people.samba.org/bzr/jelmer/bzr-svn/bzr.dev
Jelmer Vernooij
jelmer at samba.org
Tue Jan 16 10:15:20 GMT 2007
------------------------------------------------------------
revno: 403
revision-id: jelmer at samba.org-20070116101442-8ipstsewthjbimhp
parent: jelmer at samba.org-20070116013721-adqxlwj1dl5jo7as
parent: jelmer at samba.org-20070115172815-93j1sk2ylwzh8tt9
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: main
timestamp: Tue 2007-01-16 11:14:42 +0100
message:
Import version 3 changes.
modified:
commit.py commit.py-20060607190346-qvq128wgfubhhgm2-1
fileids.py fileids.py-20060714013623-u5iiyqqnko11grcf-1
mapping.txt mapping.txt-20060625151311-9ghaqrm71ajq593n-1
repository.py repository.py-20060306123302-1f8c5069b3fe0265
tests/test_branch.py test_branch.py-20060508162215-74ffeb5d608f8e20
tests/test_fileids.py test_fileids.py-20060622131341-19gyrlgqy8yl2od5-1
tests/test_repos.py test_repos.py-20060508151940-ddc49a59257ca712
tests/test_upgrade.py test_upgrade.py-20070106170128-64zt3eqggg4tng1c-1
tests/test_workingtree.py test_workingtree.py-20060622191524-0di7bc3q1ckdbybb-1
upgrade.py upgrade.py-20070106192108-0rakplee2lzah4gs-1
------------------------------------------------------------
revno: 389.1.8
merged: jelmer at samba.org-20070115172815-93j1sk2ylwzh8tt9
parent: jelmer at samba.org-20070114055700-9ybu0e0sf0t2bsp9
parent: jelmer at samba.org-20070115133448-o4pcdn4dvzqu5u25
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: ver3
timestamp: Mon 2007-01-15 18:28:15 +0100
message:
Merge from upstream.
------------------------------------------------------------
revno: 389.1.7
merged: jelmer at samba.org-20070114055700-9ybu0e0sf0t2bsp9
parent: jelmer at samba.org-20070114030508-miy4yc1daskumby1
parent: jelmer at samba.org-20070114052234-aj73nfyj8sslv3n9
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: ver3
timestamp: Sun 2007-01-14 06:57:00 +0100
message:
Fix remaining tests.
------------------------------------------------------------
revno: 389.1.6
merged: jelmer at samba.org-20070114030508-miy4yc1daskumby1
parent: jelmer at samba.org-20070114015613-yfjhkjcvl3fbt8b4
parent: jelmer at samba.org-20070110052456-z9werxhohglupk05
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: ver3
timestamp: Sun 2007-01-14 04:05:08 +0100
message:
merge from upstream
------------------------------------------------------------
revno: 389.1.5
merged: jelmer at samba.org-20070114015613-yfjhkjcvl3fbt8b4
parent: jelmer at samba.org-20070110035917-9w6ag249rblmg0oc
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: ver3
timestamp: Sun 2007-01-14 02:56:13 +0100
message:
Fix some of the file id tests
------------------------------------------------------------
revno: 389.1.4
merged: jelmer at samba.org-20070110035917-9w6ag249rblmg0oc
parent: jelmer at samba.org-20070110015644-854iy6manxjo9zu0
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: ver3
timestamp: Wed 2007-01-10 04:59:17 +0100
message:
Fix tests for new revision ids
------------------------------------------------------------
revno: 389.1.3
merged: jelmer at samba.org-20070110015644-854iy6manxjo9zu0
parent: jelmer at samba.org-20070110015533-0gsoakvowzntfbrl
parent: jelmer at samba.org-20070110015047-2it8mj9d7bclg2ju
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: ver3
timestamp: Wed 2007-01-10 02:56:44 +0100
message:
Merge upstream
------------------------------------------------------------
revno: 389.1.2
merged: jelmer at samba.org-20070110015533-0gsoakvowzntfbrl
parent: jelmer at samba.org-20070109030033-nv7e48u1jnuo7afi
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: ver3
timestamp: Wed 2007-01-10 02:55:33 +0100
message:
Follow new revision id format
------------------------------------------------------------
revno: 389.1.1
merged: jelmer at samba.org-20070109030033-nv7e48u1jnuo7afi
parent: jelmer at samba.org-20070109021631-r3tjo36qj4hu2f95
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: ver3
timestamp: Tue 2007-01-09 04:00:33 +0100
message:
Add specification for version 3
=== modified file 'commit.py'
--- a/commit.py 2007-01-14 23:38:09 +0000
+++ b/commit.py 2007-01-15 17:28:15 +0000
@@ -358,7 +358,7 @@
if not self._svnprops.has_key(SVN_PROP_BZR_FILEIDS):
self._svnprops[SVN_PROP_BZR_FILEIDS] = ""
mutter('adding fileid mapping %s -> %s' % (path, ie.file_id))
- self._svnprops[SVN_PROP_BZR_FILEIDS] += "%s\t%s\n" % (escape_svn_path(path, "%\t\n"), ie.file_id)
+ self._svnprops[SVN_PROP_BZR_FILEIDS] += "%s\t%s\n" % (escape_svn_path(path), ie.file_id)
previous_entries = ie.find_previous_heads(
parent_invs,
=== modified file 'fileids.py'
--- a/fileids.py 2007-01-03 11:19:26 +0000
+++ b/fileids.py 2007-01-14 01:56:13 +0000
@@ -40,14 +40,11 @@
"""
if path == "":
return ROOT_ID
- introduced_revision_id = generate_svn_revision_id(uuid, revnum, branch)
- ret = "%s-%s" % (introduced_revision_id, escape_svn_path(path))
+ ret = "%d@%s:%s:%s" % (revnum, uuid, escape_svn_path(branch), escape_svn_path(path))
if len(ret) > 150:
- basename = os.path.basename(path)
- parent = path[:-len(basename)]
- ret = "%s-%s-%s" % (introduced_revision_id,
- sha.new(parent).hexdigest(),
- escape_svn_path(basename))
+ ret = "%d@%s:%s;%s" % (revnum, uuid,
+ escape_svn_path(branch),
+ sha.new(path).hexdigest())
return ret
=== modified file 'mapping.txt'
--- a/mapping.txt 2007-01-01 21:49:06 +0000
+++ b/mapping.txt 2007-01-14 01:56:13 +0000
@@ -1,8 +1,9 @@
This document specifies mapping between Subversion and Bazaar semantics.
-Revision: 2
+Revision: 3
Jelmer Vernooij <jelmer at samba.org>, June 2006.
Updated October 2006.
+Updated January 2007.
== Branch paths ==
@@ -32,7 +33,7 @@
* Assume NoBranchingScheme
-NEXT VERSION: Allow specifying the branching scheme in ~/.bazaar/locations.conf.
+Branching scheme names can not contain colons.
== Revision ids ==
@@ -45,7 +46,7 @@
revision-id. Example revision id:
{{{
-svn-v2:14323 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-trunk
+svn-v3-trunk:0c0555d6-39d7-0310-84fc-f1cc0bd64818:trunk:14323
}}}
The version number is used to distinguish between versions of the mapping
@@ -57,12 +58,11 @@
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:
+Since '/' and whitespace are forbidden in revision ids, the branch paths
+are all urlencoded. Example revision id for branches/foobranch:
{{{
-svn-v2:14323 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2ffoobranch
+svn-v3-trunk-1:0c0555d6-39d7-0310-84fc-f1cc0bd64818:branches%2Ffoobranch:14323
}}}
== File ids ==
@@ -73,10 +73,9 @@
File ids use the following syntax:
-svn-v<MAPPING_VERSION>:<REVNO>@<UUID>-<BRANCHPATH>-<PATH>
+<REVNO>@<UUID>:<BRANCHPATH>:<PATH>
-Since / is forbidden in file ids, the '/', '-', '%' and all whitespace
-characters are urlencoded.
+Since / is forbidden in file ids, all characters are urlencoded.
Alternatively, these file ids can be mapped to more specific file ids. Such
a map should be stored in the `bzr:file-ids' property that is set on the
@@ -106,9 +105,9 @@
If the file id generated is longer than 150 bytes, the following format will
be used:
-<REVID>-<SHA1>-<FILENAME>
+<REVNO>@<UUID>:<BRANCH>;<SHA1>
-where <SHA1> is the sha1 of the path to the directory name.
+where <SHA1> is the sha1 of the file's path.
NEXT VERSION: Special rules are applied to make sure that renames are tracked.
@@ -171,3 +170,7 @@
Revision 2 enforces UTF-8-valid characters for everything except file
contents.
+
+Revision 3 changed the file id format, changed the urlencoding to be
+uppercased, changed the separator between uuids and branch paths in the
+revision id from "-" to ":" and added the branching scheme to the revision id.
=== modified file 'repository.py'
--- a/repository.py 2007-01-09 02:16:31 +0000
+++ b/repository.py 2007-01-10 03:59:17 +0000
@@ -47,24 +47,18 @@
import logwalker
from tree import SvnRevisionTree
-MAPPING_VERSION = 2
-REVISION_ID_PREFIX = "svn-v%d:" % MAPPING_VERSION
+MAPPING_VERSION = 3
+REVISION_ID_PREFIX = "svn-v%d-" % MAPPING_VERSION
SVN_PROP_BZR_MERGE = 'bzr:merge'
SVN_PROP_SVK_MERGE = 'svk:merge'
SVN_PROP_BZR_FILEIDS = 'bzr:file-ids'
SVN_PROP_BZR_REVPROP_PREFIX = 'bzr:revprop:'
SVN_REVPROP_BZR_SIGNATURE = 'bzr:gpg-signature'
-
-def escape_svn_path(id, unsafe="%/-\t \n"):
- assert "%" in unsafe
- r = [((c in unsafe) and (u'%%%02x' % ord(c)) or c)
- for c in id]
- return unicode(''.join(r))
-
-
import urllib
+def escape_svn_path(x):
+ return urllib.quote(x, "")
unescape_svn_path = urllib.unquote
@@ -82,16 +76,14 @@
if not revid.startswith(REVISION_ID_PREFIX):
raise InvalidRevisionId(revid, "")
+ try:
+ (version, uuid, branch_path, srevnum)= revid.split(":")
+ except ValueError:
+ raise InvalidRevisionId(revid, "")
+
revid = revid[len(REVISION_ID_PREFIX):]
- at = revid.index("@")
- fash = revid.rindex("-")
- uuid = revid[at+1:fash]
-
- branch_path = unescape_svn_path(revid[fash+1:])
- revnum = int(revid[0:at])
- assert revnum >= 0
- return (uuid, branch_path, revnum)
+ return (uuid, unescape_svn_path(branch_path), int(srevnum))
def generate_svn_revision_id(uuid, revnum, path):
@@ -108,7 +100,8 @@
assert revnum >= 0
if revnum == 0:
return NULL_REVISION
- return unicode("%s%d@%s-%s" % (REVISION_ID_PREFIX, revnum, uuid, escape_svn_path(path.strip("/"))))
+ return unicode("%sundefined:%s:%s:%d" % (REVISION_ID_PREFIX, uuid, \
+ escape_svn_path(path.strip("/")), revnum))
def svk_feature_to_revision_id(feature):
=== modified file 'tests/test_branch.py'
--- a/tests/test_branch.py 2007-01-09 04:25:01 +0000
+++ b/tests/test_branch.py 2007-01-10 03:59:17 +0000
@@ -482,7 +482,7 @@
def test_generate_revision_id(self):
repos_url = self.make_client('d', 'dc')
branch = Branch.open('d')
- self.assertEqual("svn-v%d:1@%s-" % (MAPPING_VERSION, branch.repository.uuid), branch.generate_revision_id(1))
+ self.assertEqual("svn-v%d-undefined:%s::1" % (MAPPING_VERSION, branch.repository.uuid), branch.generate_revision_id(1))
def test_create_checkout(self):
repos_url = self.make_client('d', 'dc')
=== modified file 'tests/test_fileids.py'
--- a/tests/test_fileids.py 2007-01-09 05:59:35 +0000
+++ b/tests/test_fileids.py 2007-01-14 05:57:00 +0000
@@ -25,7 +25,7 @@
import format
from fileids import SimpleFileIdMap, generate_file_id, generate_svn_file_id
-from repository import MAPPING_VERSION
+from repository import generate_svn_revision_id
from scheme import TrunkBranchingScheme
from tests import TestCaseWithSubversionRepository, RENAMES
@@ -153,24 +153,20 @@
class TestFileIdGenerator(TestCase):
def test_generate_file_id_root(self):
- self.assertEqual(ROOT_ID, generate_file_id("svn-v2:2 at uuid-bp", ""))
+ self.assertEqual(ROOT_ID, generate_file_id(generate_svn_revision_id("uuid", 2, "bp"), ""))
def test_generate_file_id_path(self):
- self.assertEqual("svn-v2:2 at uuid-bp-mypath",
- generate_file_id("svn-v2:2 at uuid-bp", "mypath"))
+ self.assertEqual("2 at uuid:bp:mypath",
+ generate_file_id(generate_svn_revision_id("uuid", 2, "bp"), "mypath"))
def test_generate_file_id_long(self):
dir = "this/is/a" + ("/very"*40) + "/long/path/"
- self.assertEqual("svn-v2:2 at uuid-bp-" + sha1(dir) + "-filename",
- generate_file_id("svn-v2:2 at uuid-bp", dir+"filename"))
-
- def test_generate_file_id_special_char(self):
- self.assertEqual(u"svn-v2:2 at uuid-bp-mypath\x2c\x8a",
- generate_file_id("svn-v2:2 at uuid-bp", u"mypath\x2c\x8a"))
+ self.assertEqual("2 at uuid:bp;" + sha1(dir+"filename"),
+ generate_file_id(generate_svn_revision_id("uuid", 2, "bp"), dir+"filename"))
def test_generate_revid_special_char_ascii(self):
- self.assertEqual("svn-v2:2 at uuid-bp-mypath\x2c\x8a",
- generate_file_id(u"svn-v2:2 at uuid-bp", "mypath\x2c\x8a"))
+ self.assertEqual("2 at uuid:bp:mypath%2C%8A",
+ generate_file_id(generate_svn_revision_id("uuid", 2, "bp"), "mypath\x2c\x8a"))
class TestFileMapping(TestCase):
def apply_mappings(self, mappings, find_children=None, renames={}):
@@ -187,16 +183,16 @@
return map
def test_simple(self):
- map = self.apply_mappings({"svn-v%d:1 at uuid-" % MAPPING_VERSION: {"foo": ('A', None, None)}})
- self.assertEqual({ 'foo': ("svn-v%d:1 at uuid--foo" % MAPPING_VERSION,
- "svn-v%d:1 at uuid-" % MAPPING_VERSION)
+ map = self.apply_mappings({generate_svn_revision_id("uuid", 1, ""): {"foo": ('A', None, None)}})
+ self.assertEqual({ 'foo': ("1 at uuid::foo",
+ generate_svn_revision_id("uuid", 1, ""))
}, map)
def test_simple_add(self):
- map = self.apply_mappings({"svn-v%d:1 at uuid-" % MAPPING_VERSION: {"": ('A', None, None), "foo": ('A', None, None)}})
- self.assertEqual({'': ('TREE_ROOT', "svn-v%d:1 at uuid-" % MAPPING_VERSION),
- 'foo': ("svn-v%d:1 at uuid--foo" % MAPPING_VERSION,
- "svn-v%d:1 at uuid-" % MAPPING_VERSION)
+ map = self.apply_mappings({generate_svn_revision_id("uuid", 1, ""): {"": ('A', None, None), "foo": ('A', None, None)}})
+ self.assertEqual({'': ('TREE_ROOT', generate_svn_revision_id("uuid", 1, "")),
+ 'foo': ("1 at uuid::foo",
+ generate_svn_revision_id("uuid", 1, ""))
}, map)
def test_copy(self):
@@ -205,11 +201,11 @@
yield "foo/blie"
yield "foo/bla"
map = self.apply_mappings(
- {"svn-v%d:1 at uuid-" % MAPPING_VERSION: {
+ {generate_svn_revision_id("uuid", 1, ""): {
"foo": ('A', None, None),
"foo/blie": ('A', None, None),
"foo/bla": ('A', None, None)},
- "svn-v%d:2 at uuid-" % MAPPING_VERSION: {
+ generate_svn_revision_id("uuid", 2, ""): {
"foob": ('A', 'foo', 1),
"foob/bla": ('M', None, None)}
}, find_children)
@@ -218,37 +214,37 @@
def test_touchparent(self):
map = self.apply_mappings(
- {("svn-v%d:1 at uuid-" % MAPPING_VERSION): {
+ {generate_svn_revision_id("uuid", 1, ""): {
"foo": ('A', None, None),
"foo/bla": ('A', None, None)},
- ("svn-v%d:2 at uuid-" % MAPPING_VERSION): {
+ generate_svn_revision_id("uuid", 2, ""): {
"foo/bla": ('M', None, None)}
})
- self.assertEqual("svn-v%d:1 at uuid-" % MAPPING_VERSION, map["foo"][1])
- self.assertEqual("svn-v%d:1 at uuid-" % MAPPING_VERSION, map["foo/bla"][1])
+ self.assertEqual(generate_svn_revision_id("uuid", 1, ""), map["foo"][1])
+ self.assertEqual(generate_svn_revision_id("uuid", 1, ""), map["foo/bla"][1])
def test_usemap(self):
map = self.apply_mappings(
- {("svn-v%d:1 at uuid-" % MAPPING_VERSION): {
+ {generate_svn_revision_id("uuid", 1, ""): {
"foo": ('A', None, None),
"foo/bla": ('A', None, None)},
- ("svn-v%d:2 at uuid-" % MAPPING_VERSION): {
+ generate_svn_revision_id("uuid", 2, ""): {
"foo/bla": ('M', None, None)}
},
- renames={("svn-v%d:1 at uuid-" % MAPPING_VERSION): {"foo": "myid"}})
+ renames={generate_svn_revision_id("uuid", 1, ""): {"foo": "myid"}})
self.assertEqual("myid", map["foo"][0])
def test_usemap_later(self):
map = self.apply_mappings(
- {("svn-v%d:1 at uuid-" % MAPPING_VERSION): {
+ {generate_svn_revision_id("uuid", 1, ""): {
"foo": ('A', None, None),
"foo/bla": ('A', None, None)},
- ("svn-v%d:2 at uuid-" % MAPPING_VERSION): {
+ generate_svn_revision_id("uuid", 2, ""): {
"foo/bla": ('M', None, None)}
},
- renames={("svn-v%d:2 at uuid-" % MAPPING_VERSION): {"foo": "myid"}})
- self.assertEqual("svn-v%d:1 at uuid--foo" % MAPPING_VERSION, map["foo"][0])
- self.assertEqual("svn-v%d:1 at uuid-" % MAPPING_VERSION, map["foo"][1])
+ renames={generate_svn_revision_id("uuid", 2, ""): {"foo": "myid"}})
+ self.assertEqual("1 at uuid::foo", map["foo"][0])
+ self.assertEqual(generate_svn_revision_id("uuid", 1, ""), map["foo"][1])
class GetMapTests(TestCaseWithSubversionRepository):
def setUp(self):
@@ -265,8 +261,7 @@
self.build_tree({"dc/trunk": None})
self.client_add("dc/trunk")
self.client_commit("dc", "Msg")
- self.assertEqual({"": (ROOT_ID, "svn-v%d:1@%s-trunk" % (MAPPING_VERSION,
- self.repos.uuid))}, self.repos.get_fileid_map(1, "trunk"))
+ self.assertEqual({"": (ROOT_ID, self.repos.generate_revision_id(1, "trunk"))}, self.repos.get_fileid_map(1, "trunk"))
def test_change_parent(self):
self.repos.set_branching_scheme(TrunkBranchingScheme())
@@ -276,7 +271,7 @@
self.build_tree({"dc/trunk/file": 'data'})
self.client_add("dc/trunk/file")
self.client_commit("dc", "Msg")
- self.assertEqual({"": (ROOT_ID, "svn-v%d:2@%s-trunk" % (MAPPING_VERSION, self.repos.uuid)), "file": (generate_svn_file_id(self.repos.uuid, 2, "trunk", "file"), "svn-v%d:2@%s-trunk" % (MAPPING_VERSION, self.repos.uuid))}, self.repos.get_fileid_map(2, "trunk"))
+ self.assertEqual({"": (ROOT_ID, self.repos.generate_revision_id(2, "trunk")), "file": (generate_svn_file_id(self.repos.uuid, 2, "trunk", "file"), self.repos.generate_revision_id(2, "trunk"))}, self.repos.get_fileid_map(2, "trunk"))
def test_change_updates(self):
self.repos.set_branching_scheme(TrunkBranchingScheme())
@@ -301,7 +296,7 @@
self.client_commit("dc", "Msg")
self.build_tree({"dc/trunk/file": 'otherdata'})
self.client_commit("dc", "Msg")
- self.assertEqual({"": (ROOT_ID, self.repos.generate_revision_id(3, "trunk")), "bar": (generate_svn_file_id(self.repos.uuid, 2, "trunk", "bar"), "svn-v%d:2@%s-trunk" % (MAPPING_VERSION, self.repos.uuid)), "file": (generate_svn_file_id(self.repos.uuid, 2, "trunk", "file"), self.repos.generate_revision_id(3, "trunk"))}, self.repos.get_fileid_map(3, "trunk"))
+ self.assertEqual({"": (ROOT_ID, self.repos.generate_revision_id(3, "trunk")), "bar": (generate_svn_file_id(self.repos.uuid, 2, "trunk", "bar"), self.repos.generate_revision_id(2, "trunk")), "file": (generate_svn_file_id(self.repos.uuid, 2, "trunk", "file"), self.repos.generate_revision_id(3, "trunk"))}, self.repos.get_fileid_map(3, "trunk"))
def test_copy(self):
self.repos.set_branching_scheme(TrunkBranchingScheme())
=== modified file 'tests/test_repos.py'
--- a/tests/test_repos.py 2007-01-09 05:59:35 +0000
+++ b/tests/test_repos.py 2007-01-14 01:56:13 +0000
@@ -339,7 +339,7 @@
repository = Repository.open("svn+%s" % repos_url)
tree = repository.revision_tree(Branch.open(repos_url).last_revision())
self.assertEqual("someid", tree.inventory.path2id("foo"))
- self.assertFalse("svn-v2:1@%s--foo" % repository.uuid in tree.inventory)
+ self.assertFalse("1@%s::foo" % repository.uuid in tree.inventory)
def test_revision_ghost_parents(self):
repos_url = self.make_client('d', 'dc')
@@ -512,7 +512,7 @@
repos_url = self.make_client('d', 'dc')
repository = Repository.open("svn+%s" % repos_url)
self.assertEqual(
- "svn-v%d:1@%s-bla%%2fbloe" % (MAPPING_VERSION, repository.uuid),
+ u"svn-v%d-undefined:%s:bla%%2Fbloe:1" % (MAPPING_VERSION, repository.uuid),
repository.generate_revision_id(1, "bla/bloe"))
def test_generate_revision_id_none(self):
@@ -1899,42 +1899,42 @@
class RevisionIdMappingTest(TestCase):
def test_generate_revid(self):
- self.assertEqual("svn-v%d:5 at myuuid-branch" % MAPPING_VERSION,
+ self.assertEqual("svn-v%d-undefined:myuuid:branch:5" % MAPPING_VERSION,
generate_svn_revision_id("myuuid", 5, "branch"))
def test_generate_revid_nested(self):
- self.assertEqual("svn-v%d:5 at myuuid-branch%%2fpath" % MAPPING_VERSION,
+ self.assertEqual("svn-v%d-undefined:myuuid:branch%%2Fpath:5" % MAPPING_VERSION,
generate_svn_revision_id("myuuid", 5, "branch/path"))
def test_generate_revid_special_char(self):
- self.assertEqual(u"svn-v%d:5 at myuuid-branch\x2c" % MAPPING_VERSION,
+ self.assertEqual(u"svn-v%d-undefined:myuuid:branch%%2C:5" % MAPPING_VERSION,
generate_svn_revision_id("myuuid", 5, u"branch\x2c"))
def test_generate_revid_special_char_ascii(self):
- self.assertEqual("svn-v%d:5 at myuuid-branch\x2c" % MAPPING_VERSION,
+ self.assertEqual("svn-v%d-undefined:myuuid:branch%%2C:5" % MAPPING_VERSION,
generate_svn_revision_id("myuuid", 5, "branch\x2c"))
def test_parse_revid_simple(self):
self.assertEqual(("uuid", "", 4),
parse_svn_revision_id(
- "svn-v%d:4 at uuid-" % MAPPING_VERSION))
+ "svn-v%d-undefined:uuid::4" % MAPPING_VERSION))
def test_parse_revid_nested(self):
self.assertEqual(("uuid", "bp/data", 4),
parse_svn_revision_id(
- "svn-v%d:4 at uuid-bp%%2fdata" % MAPPING_VERSION))
+ "svn-v%d-undefined:uuid:bp%%2Fdata:4" % MAPPING_VERSION))
def test_svk_revid_map_root(self):
- self.assertEqual("svn-v%d:6 at auuid-" % MAPPING_VERSION,
+ self.assertEqual("svn-v%d-undefined:auuid::6" % MAPPING_VERSION,
svk_feature_to_revision_id("auuid:/:6"))
def test_svk_revid_map_nested(self):
- self.assertEqual("svn-v%d:6 at auuid-bp" % MAPPING_VERSION,
+ self.assertEqual("svn-v%d-undefined:auuid:bp:6" % MAPPING_VERSION,
svk_feature_to_revision_id("auuid:/bp:6"))
def test_revid_svk_map(self):
self.assertEqual("auuid:/:6",
- revision_id_to_svk_feature("svn-v%d:6 at auuid-" % MAPPING_VERSION))
+ revision_id_to_svk_feature("svn-v%d-undefined:auuid::6" % MAPPING_VERSION))
class EscapeTest(TestCase):
@@ -1951,13 +1951,13 @@
self.assertEqual("foobar%20", escape_svn_path("foobar "))
def test_escape_svn_path_slash(self):
- self.assertEqual("foobar%2f", escape_svn_path("foobar/"))
+ self.assertEqual("foobar%2F", escape_svn_path("foobar/"))
def test_escape_svn_path_special_char(self):
- self.assertEqual(u"foobar%8a", escape_svn_path("foobar\x8a"))
+ self.assertEqual("foobar%8A", escape_svn_path("foobar\x8a"))
def test_unescape_svn_path_slash(self):
- self.assertEqual("foobar/", unescape_svn_path("foobar%2f"))
+ self.assertEqual("foobar/", unescape_svn_path("foobar%2F"))
def test_unescape_svn_path_none(self):
self.assertEqual("foobar", unescape_svn_path("foobar"))
=== modified file 'tests/test_upgrade.py'
--- a/tests/test_upgrade.py 2007-01-15 13:34:48 +0000
+++ b/tests/test_upgrade.py 2007-01-15 17:28:15 +0000
@@ -36,6 +36,10 @@
class ParserTests(TestCase):
def test_current(self):
+ self.assertEqual(("uuid", "trunk", 1, 3),
+ parse_legacy_revision_id("svn-v3-undefined:uuid:trunk:1"))
+
+ def test_legacy2(self):
self.assertEqual(("uuid", "trunk", 1, 2),
parse_legacy_revision_id("svn-v2:1 at uuid-trunk"))
@@ -102,7 +106,7 @@
upgrade_repository(newrepos, oldrepos, allow_change=True)
- self.assertTrue(newrepos.has_revision("svn-v%d:1@%s-" % (MAPPING_VERSION, oldrepos.uuid)))
+ self.assertTrue(newrepos.has_revision(oldrepos.generate_revision_id(1, "")))
def test_single_custom(self):
repos_url = self.make_client("a", "dc")
@@ -213,7 +217,7 @@
renames = upgrade_repository(newrepos, oldrepos, allow_change=True)
self.assertEqual({
- "svn-v1:1@%s-" % oldrepos.uuid:"svn-v%d:1@%s-" % (MAPPING_VERSION, oldrepos.uuid),
+ "svn-v1:1@%s-" % oldrepos.uuid: oldrepos.generate_revision_id(1, ""),
"customrev": "customrev-svn%d-upgrade" % MAPPING_VERSION,
"anotherrev": "anotherrev-svn%d-upgrade" % MAPPING_VERSION},
renames)
@@ -246,7 +250,7 @@
wt.commit(message='fix it again', rev_id="anotherrev")
upgrade_branch(b, oldrepos, allow_change=True)
- self.assertEqual(["svn-v2:1@%s-" % oldrepos.uuid,
+ self.assertEqual([oldrepos.generate_revision_id(1, ""),
"customrev-svn%d-upgrade" % MAPPING_VERSION,
"anotherrev-svn%d-upgrade" % MAPPING_VERSION
], b.revision_history())
=== modified file 'tests/test_workingtree.py'
--- a/tests/test_workingtree.py 2007-01-15 00:39:37 +0000
+++ b/tests/test_workingtree.py 2007-01-15 17:28:15 +0000
@@ -353,7 +353,7 @@
tree = WorkingTree.open("dc")
tree.set_pending_merges([
- "svn-v%d:1 at a-uuid-foo-branch%%2fpath" % MAPPING_VERSION, "c"])
+ "svn-v%d-undefined:a-uuid-foo:branch%%2fpath:1" % MAPPING_VERSION, "c"])
self.assertEqual("a-uuid-foo:/branch/path:1\n",
self.client_get_prop("dc", "svk:merge"))
=== modified file 'upgrade.py'
--- a/upgrade.py 2007-01-15 13:34:48 +0000
+++ b/upgrade.py 2007-01-15 17:28:15 +0000
@@ -131,8 +131,17 @@
assert revnum >= 0
return (uuid, branch_path, revnum, 1)
elif revid.startswith("svn-v2:"):
+ revid = revid[len("svn-v2:"):]
+ at = revid.index("@")
+ fash = revid.rindex("-")
+ uuid = revid[at+1:fash]
+ branch_path = unescape_svn_path(revid[fash+1:])
+ revnum = int(revid[0:at])
+ assert revnum >= 0
+ return (uuid, branch_path, revnum, 2)
+ elif revid.startswith("svn-v3-"):
(uuid, bp, rev) = parse_svn_revision_id(revid)
- return (uuid, bp, rev, 2)
+ return (uuid, bp, rev, 3)
raise InvalidRevisionId(revid, None)
@@ -144,6 +153,7 @@
else:
return revid + suffix
+
def upgrade_branch(branch, svn_repository, allow_change=False):
renames = upgrade_repository(branch.repository, svn_repository,
branch.last_revision(), allow_change)
More information about the bazaar-commits
mailing list