Rev 394: Fix some of the file id tests in http://people.samba.org/bzr/jelmer/bzr-svn/ver3
Jelmer Vernooij
jelmer at samba.org
Sun Jan 14 01:56:42 GMT 2007
------------------------------------------------------------
revno: 394
revision-id: 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
modified:
fileids.py fileids.py-20060714013623-u5iiyqqnko11grcf-1
mapping.txt mapping.txt-20060625151311-9ghaqrm71ajq593n-1
tests/test_fileids.py test_fileids.py-20060622131341-19gyrlgqy8yl2od5-1
tests/test_repos.py test_repos.py-20060508151940-ddc49a59257ca712
tests/test_tree.py test_tree.py-20070103204350-pr8nupes7e5sd2wr-1
=== 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-09 03:00:33 +0000
+++ b/mapping.txt 2007-01-14 01:56:13 +0000
@@ -33,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 ==
@@ -73,10 +73,9 @@
File ids use the following syntax:
-<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:
-<REVNO>@<UUID>-<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.
=== modified file 'tests/test_fileids.py'
--- a/tests/test_fileids.py 2007-01-10 03:59:17 +0000
+++ b/tests/test_fileids.py 2007-01-14 01:56:13 +0000
@@ -25,7 +25,7 @@
import format
from fileids import SimpleFileIdMap, generate_file_id, generate_svn_file_id
-from repository import MAPPING_VERSION, generate_svn_revision_id
+from repository import generate_svn_revision_id
from scheme import TrunkBranchingScheme
from tests import TestCaseWithSubversionRepository, RENAMES
@@ -153,24 +153,24 @@
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"))
+ self.assertEqual("2 at uuid:bp;" + sha1(dir+"filename"),
+ generate_file_id(generate_svn_revision_id("uuid", 2, "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(u"2 at uuid:bp:mypath%2C%8A",
+ generate_file_id(generate_svn_revision_id("uuid", 2, "bp"), u"mypath\x2c\x8a"))
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={}):
@@ -188,14 +188,14 @@
def test_simple(self):
map = self.apply_mappings({generate_svn_revision_id("uuid", 1, ""): {"foo": ('A', None, None)}})
- self.assertEqual({ 'foo': ("svn-v%d:1 at uuid--foo" % MAPPING_VERSION,
+ self.assertEqual({ 'foo': ("1 at uuid::foo",
generate_svn_revision_id("uuid", 1, ""))
}, map)
def test_simple_add(self):
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': ("svn-v%d:1 at uuid--foo" % MAPPING_VERSION,
+ 'foo': ("1 at uuid::foo",
generate_svn_revision_id("uuid", 1, ""))
}, map)
@@ -247,7 +247,7 @@
"foo/bla": ('M', None, None)}
},
renames={generate_svn_revision_id("uuid", 2, ""): {"foo": "myid"}})
- self.assertEqual("svn-v%d:1 at uuid--foo" % MAPPING_VERSION, map["foo"][0])
+ self.assertEqual("1 at uuid::foo", map["foo"][0])
self.assertEqual(generate_svn_revision_id("uuid", 1, ""), map["foo"][1])
class GetMapTests(TestCaseWithSubversionRepository):
=== modified file 'tests/test_repos.py'
--- a/tests/test_repos.py 2007-01-10 03:59:17 +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')
@@ -1934,7 +1934,7 @@
def test_revid_svk_map(self):
self.assertEqual("auuid:/:6",
- revision_id_to_svk_feature("svn-v%d-undefined:auuid:;6" % MAPPING_VERSION))
+ revision_id_to_svk_feature("svn-v%d-undefined:auuid::6" % MAPPING_VERSION))
class EscapeTest(TestCase):
=== modified file 'tests/test_tree.py'
--- a/tests/test_tree.py 2007-01-08 04:45:56 +0000
+++ b/tests/test_tree.py 2007-01-14 01:56:13 +0000
@@ -66,6 +66,8 @@
self.client_commit("dc", "symlink")
self.build_tree({"dc/bla": "p"})
self.client_commit("dc", "change")
+ self.assertFalse(True)
+ return
self.client_update("dc")
tree = SvnBasisTree(WorkingTree.open("dc"))
self.assertEqual('symlink',
More information about the bazaar-commits
mailing list