Rev 1303: Fix tests. in http://people.samba.org/bzr/jelmer/bzr-svn/0.4
Jelmer Vernooij
jelmer at samba.org
Mon Jun 23 03:23:13 BST 2008
At http://people.samba.org/bzr/jelmer/bzr-svn/0.4
------------------------------------------------------------
revno: 1303
revision-id: jelmer at samba.org-20080623022310-xtr5gk2z4yxd3dyq
parent: jelmer at samba.org-20080623011106-jtxh589vdl16zdzz
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Mon 2008-06-23 04:23:10 +0200
message:
Fix tests.
modified:
tests/test_convert.py test_convert.py-20060705203611-b1l0bapeku6foco0-1
tests/test_fetch.py test_fetch.py-20070624210302-luvgwjmlfysk5qeq-1
tests/test_radir.py test_radir.py-20061231173434-31utf9o4byu7wktm-1
tests/test_repository.py test_repos.py-20060508151940-ddc49a59257ca712
tests/test_revspec.py test_revspec.py-20071111183646-0wohlrzaevdsr9ia-1
tests/test_tree.py test_tree.py-20070103204350-pr8nupes7e5sd2wr-1
tests/test_upgrade.py test_upgrade.py-20070106170128-64zt3eqggg4tng1c-1
=== modified file 'tests/test_convert.py'
--- a/tests/test_convert.py 2008-06-22 07:44:40 +0000
+++ b/tests/test_convert.py 2008-06-23 02:23:10 +0000
@@ -67,20 +67,21 @@
super(TestConversion, self).setUp()
self.repos_url = self.make_repository('d')
- dc = self.commit_editor()
- dc.add_dir("trunk")
- dc.add_file("trunk/file", "data")
- dc.add_dir("branches")
- dc.add_dir("branches/abranch")
- dc.add_file("branches/abranch/anotherfile", "data2")
- dc.done()
-
- dc = self.commit_editor()
- dc.change_file("trunk/file", "otherdata")
- dc.done()
-
- def commit_editor(self):
- return super(TestConversion,self).commit_editor(self.repos_url)
+ dc = self.get_commit_editor()
+ t = dc.add_dir("trunk")
+ t.add_file("trunk/file").modify("data")
+ bs = dc.add_dir("branches")
+ ab = bs.add_dir("branches/abranch")
+ ab.add_file("branches/abranch/anotherfile").modify("data2")
+ dc.close()
+
+ dc = self.get_commit_editor()
+ t = dc.open_dir("trunk")
+ t.open_file("trunk/file").modify("otherdata")
+ dc.close()
+
+ def get_commit_editor(self):
+ return super(TestConversion,self).get_commit_editor(self.repos_url)
def test_sets_parent_urls(self):
convert_repository(Repository.open(self.repos_url), "e",
@@ -92,14 +93,16 @@
Branch.open("e/branches/abranch").get_parent())
def test_fetch_alive(self):
- dc = self.commit_editor()
- dc.add_dir("branches/somebranch")
- dc.add_file("branches/somebranch/somefile", 'data')
- dc.done()
+ dc = self.get_commit_editor()
+ bs = dc.open_dir("branches")
+ sb = bs.add_dir("branches/somebranch")
+ sb.add_file("branches/somebranch/somefile").modify('data')
+ dc.close()
- dc = self.commit_editor()
- dc.delete("branches/somebranch")
- dc.done()
+ dc = self.get_commit_editor()
+ bs = dc.open_dir("branches")
+ bs.delete("branches/somebranch")
+ dc.close()
oldrepos = Repository.open(self.repos_url)
convert_repository(oldrepos, "e",
@@ -110,9 +113,10 @@
self.assertFalse(newrepos.has_revision(oldrepos.generate_revision_id(2, "branches/somebranch", oldrepos.get_mapping())))
def test_fetch_filebranch(self):
- dc = self.commit_editor()
- dc.add_file("branches/somebranch", 'data')
- dc.done()
+ dc = self.get_commit_editor()
+ bs = dc.open_dir("branches")
+ bs.add_file("branches/somebranch").modify('data')
+ dc.close()
oldrepos = Repository.open(self.repos_url)
convert_repository(oldrepos, "e", TrunkBranchingScheme())
@@ -121,14 +125,16 @@
self.assertFalse(newrepos.has_revision(oldrepos.generate_revision_id(2, "branches/somebranch", oldrepos.get_mapping())))
def test_fetch_dead(self):
- dc = self.commit_editor()
- dc.add_dir("branches/somebranch")
- dc.add_file("branches/somebranch/somefile", 'data')
- dc.done()
+ dc = self.get_commit_editor()
+ bs = dc.open_dir("branches")
+ sb = bs.add_dir("branches/somebranch")
+ sb.add_file("branches/somebranch/somefile").modify('data')
+ dc.close()
- dc = self.commit_editor()
- dc.delete("branches/somebranch")
- dc.done()
+ dc = self.get_commit_editor()
+ bs = dc.open_dir("branches")
+ bs.delete("branches/somebranch")
+ dc.close()
oldrepos = Repository.open(self.repos_url)
convert_repository(oldrepos, "e", TrunkBranchingScheme(),
@@ -138,15 +144,17 @@
oldrepos.generate_revision_id(3, "branches/somebranch", oldrepos.get_mapping())))
def test_fetch_filter(self):
- dc = self.commit_editor()
+ dc = self.get_commit_editor()
+ branches = dc.open_dir("branches")
dc.add_dir("branches/somebranch")
- dc.add_file("branches/somebranch/somefile", 'data')
- dc.done()
+ dc.add_file("branches/somebranch/somefile").modify('data')
+ dc.close()
- dc = self.commit_editor()
- dc.add_dir("branches/anotherbranch")
- dc.add_file("branches/anotherbranch/somefile", 'data')
- dc.done()
+ dc = self.get_commit_editor()
+ branches = dc.open_dir("branches")
+ ab = branches.add_dir("branches/anotherbranch")
+ ab.add_file("branches/anotherbranch/somefile").modify('data')
+ dc.close()
oldrepos = Repository.open(self.repos_url)
convert_repository(oldrepos, "e", TrunkBranchingScheme(),
@@ -169,14 +177,14 @@
convert_repository(Repository.open(self.repos_url), "e",
TrunkBranchingScheme(), create_shared_repo=True)
- dc = self.commit_editor()
+ dc = self.get_commit_editor()
dc.delete("trunk")
- dc.done()
+ dc.close()
- dc = self.commit_editor()
- dc.add_dir("trunk")
- dc.add_file("trunk/file")
- dc.done()
+ dc = self.get_commit_editor()
+ trunk = dc.add_dir("trunk")
+ trunk.add_file("trunk/file").modify()
+ dc.close()
convert_repository(Repository.open(self.repos_url), "e",
TrunkBranchingScheme(), create_shared_repo=True)
@@ -232,9 +240,10 @@
mapping = oldrepos.get_mapping()
- dc = self.commit_editor()
- dc.change_file("trunk/file")
- dc.done()
+ dc = self.get_commit_editor()
+ trunk = dc.open_dir("trunk")
+ trunk.open_file("trunk/file").modify()
+ dc.close()
self.assertEqual(
Repository.open(self.repos_url).generate_revision_id(2, "trunk", mapping),
=== modified file 'tests/test_fetch.py'
--- a/tests/test_fetch.py 2008-06-22 04:51:45 +0000
+++ b/tests/test_fetch.py 2008-06-23 02:23:10 +0000
@@ -40,11 +40,11 @@
def test_fetch_fileid_renames(self):
repos_url = self.make_repository('d')
- dc = self.commit_editor(repos_url)
- dc.add_file("test", "data")
- dc.change_dir_prop("", "bzr:file-ids", "test\tbla\n")
- dc.change_dir_prop("", "bzr:revision-info", "")
- dc.done()
+ dc = self.get_commit_editor(repos_url)
+ dc.add_file("test").modify("data")
+ dc.change_prop("bzr:file-ids", "test\tbla\n")
+ dc.change_prop("bzr:revision-info", "")
+ dc.close()
oldrepos = Repository.open(repos_url)
dir = BzrDir.create("f", format.get_rich_root_format())
@@ -57,11 +57,11 @@
def test_fetch_trunk1(self):
repos_url = self.make_repository('d')
- dc = self.commit_editor(repos_url)
- dc.add_dir("proj1")
- dc.add_dir("proj1/trunk")
- dc.add_file("proj1/trunk/file", "data")
- dc.done()
+ dc = self.get_commit_editor(repos_url)
+ proj1 = dc.add_dir("proj1")
+ trunk = proj1.add_dir("proj1/trunk")
+ trunk.add_file("proj1/trunk/file").modify("data")
+ dc.close()
oldrepos = Repository.open(repos_url)
set_branching_scheme(oldrepos, TrunkBranchingScheme(1))
@@ -72,33 +72,44 @@
def test_replace_from_branch(self):
repos_url = self.make_repository('d')
- dc = self.commit_editor(repos_url)
- dc.add_dir("trunk")
- dc.add_dir("trunk/check")
- dc.add_dir("trunk/check/debian")
- dc.add_file("trunk/check/stamp-h.in", "foo")
+ dc = self.get_commit_editor(repos_url)
+ t = dc.add_dir("trunk")
+ ch = t.add_dir("trunk/check")
+ ch.add_dir("trunk/check/debian")
+ ch.add_file("trunk/check/stamp-h.in").modify("foo")
dc.add_dir("tags")
- dc.done()
-
- dc = self.commit_editor(repos_url)
- dc.add_file("trunk/check/debian/pl", "bar")
- dc.done()
-
- dc = self.commit_editor(repos_url)
- dc.add_file("trunk/check/debian/voo", "bar")
- dc.done()
-
- dc = self.commit_editor(repos_url)
- dc.add_file("trunk/check/debian/blie", "oeh")
- dc.done()
-
- dc = self.commit_editor(repos_url)
- dc.add_file("trunk/check/debian/bar", "oeh")
- dc.add_file("trunk/check/bar", "bla")
- dc.done()
+ dc.close()
+
+ dc = self.get_commit_editor(repos_url)
+ t = dc.open_dir("trunk")
+ ch = t.open_dir("trunk/check")
+ deb = ch.open_dir("trunk/check/debian")
+ deb.add_file("trunk/check/debian/pl").modify("bar")
+ dc.close()
+
+ dc = self.get_commit_editor(repos_url)
+ t = dc.open_dir("trunk")
+ ch = t.open_dir("trunk/check")
+ deb = ch.open_dir("trunk/check/debian")
+ deb.add_file("trunk/check/debian/voo").modify("bar")
+ dc.close()
+
+ dc = self.get_commit_editor(repos_url)
+ t = dc.open_dir("trunk")
+ ch = t.open_dir("trunk/check")
+ deb = ch.open_dir("trunk/check/debian")
+ deb.add_file("trunk/check/debian/blie").modify("oeh")
+ dc.close()
+
+ dc = self.get_commit_editor(repos_url)
+ t = dc.open_dir("trunk")
+ ch = t.open_dir("trunk/check")
+ deb = ch.open_dir("trunk/check/debian")
+ deb.add_file("trunk/check/debian/bar").modify("oeh")
+ ch.add_file("trunk/check/bar").modify("bla")
+ dc.close()
self.make_checkout(repos_url, "dc")
-
self.client_copy("dc/trunk", "dc/tags/R_0_9_2", revnum=2)
self.client_delete("dc/tags/R_0_9_2/check/debian")
shutil.rmtree("dc/tags/R_0_9_2/check/debian")
@@ -143,19 +154,20 @@
def test_fetch_complex_ids_dirs(self):
repos_url = self.make_repository('d')
- dc = self.commit_editor(repos_url)
- dc.add_dir("dir")
- dc.add_dir("dir/adir")
- dc.change_dir_prop("", "bzr:revision-info", "")
- dc.change_dir_prop("", "bzr:file-ids", "dir\tbloe\ndir/adir\tbla\n")
- dc.done()
+ dc = self.get_commit_editor(repos_url)
+ dir = dc.add_dir("dir")
+ dir.add_dir("dir/adir")
+ dc.change_prop("bzr:revision-info", "")
+ dc.change_prop("bzr:file-ids", "dir\tbloe\ndir/adir\tbla\n")
+ dc.close()
- dc = self.commit_editor(repos_url)
+ dc = self.get_commit_editor(repos_url)
dc.add_dir("bdir", "dir/adir")
- dc.delete("dir/adir")
- dc.change_dir_prop("", "bzr:revision-info", "properties: \n")
- dc.change_dir_prop("", "bzr:file-ids", "bdir\tbla\n")
- dc.done()
+ dir = dc.open_dir("dir")
+ dir.delete("dir/adir")
+ dc.change_prop("bzr:revision-info", "properties: \n")
+ dc.change_prop("bzr:file-ids", "bdir\tbla\n")
+ dc.close()
oldrepos = Repository.open(repos_url)
dir = BzrDir.create("f", format.get_rich_root_format())
@@ -218,10 +230,10 @@
def test_fetch_special_char(self):
repos_url = self.make_repository('d')
- dc = self.commit_editor(repos_url)
- dc.add_dir("trunk")
- dc.add_file(u"trunk/f\x2cle".encode("utf-8"), "data")
- dc.done()
+ dc = self.get_commit_editor(repos_url)
+ trunk = dc.add_dir("trunk")
+ trunk.add_file(u"trunk/f\x2cle".encode("utf-8")).modify("data")
+ dc.close()
oldrepos = Repository.open(repos_url)
set_branching_scheme(oldrepos, TrunkBranchingScheme(0))
@@ -1687,22 +1699,25 @@
def test_fetch_property_change_only_trunk(self):
repos_url = self.make_repository('d')
- dc = self.commit_editor(repos_url)
- dc.add_dir("trunk")
- dc.add_file("trunk/bla", "data")
- dc.done()
-
- dc = self.commit_editor(repos_url)
- dc.change_dir_prop("trunk", "some:property", "some data\n")
- dc.done()
-
- dc = self.commit_editor(repos_url)
- dc.change_dir_prop("trunk", "some2:property", "some data\n")
- dc.done()
-
- dc = self.commit_editor(repos_url)
- dc.change_dir_prop("trunk", "some:property", "some data3\n")
- dc.done()
+ dc = self.get_commit_editor(repos_url)
+ trunk = dc.add_dir("trunk")
+ trunk.add_file("trunk/bla").modify("data")
+ dc.close()
+
+ dc = self.get_commit_editor(repos_url)
+ trunk = dc.open_dir("trunk")
+ trunk.change_prop("some:property", "some data\n")
+ dc.close()
+
+ dc = self.get_commit_editor(repos_url)
+ trunk = dc.open_dir("trunk")
+ trunk.change_prop("some2:property", "some data\n")
+ dc.close()
+
+ dc = self.get_commit_editor(repos_url)
+ trunk = dc.open_dir("trunk")
+ trunk.change_prop("some:property", "some data3\n")
+ dc.close()
oldrepos = Repository.open("svn+"+repos_url)
set_branching_scheme(oldrepos, TrunkBranchingScheme())
=== modified file 'tests/test_radir.py'
--- a/tests/test_radir.py 2008-06-15 02:48:51 +0000
+++ b/tests/test_radir.py 2008-06-23 02:23:10 +0000
@@ -31,9 +31,9 @@
def test_clone(self):
repos_url = self.make_client("d", "dc")
- dc = self.commit_editor(repos_url)
+ dc = self.get_commit_editor(repos_url)
dc.add_dir("foo")
- dc.done()
+ dc.close()
x = self.open_checkout_bzrdir("dc")
self.assertRaises(NotImplementedError, x.clone, "dir")
@@ -62,9 +62,9 @@
def test_create_branch_top_already_branch(self):
repos_url = self.make_repository("d")
- dc = self.commit_editor(repos_url)
- dc.add_file("bla", "contents")
- dc.done()
+ dc = self.get_commit_editor(repos_url)
+ dc.add_file("bla").modify("contents")
+ dc.close()
x = BzrDir.open(repos_url)
self.assertRaises(AlreadyBranchError, x.create_branch)
@@ -80,9 +80,9 @@
def test_bad_dir(self):
repos_url = self.make_repository("d")
- dc = self.commit_editor(repos_url)
+ dc = self.get_commit_editor(repos_url)
dc.add_file("foo")
- dc.done()
+ dc.close()
BzrDir.open(repos_url+"/foo")
@@ -112,9 +112,9 @@
def test_find_repos_nonroot(self):
repos_url = self.make_repository("d")
- dc = self.commit_editor(repos_url)
+ dc = self.get_commit_editor(repos_url)
dc.add_dir("trunk")
- dc.done()
+ dc.close()
x = BzrDir.open(repos_url+"/trunk")
repos = x.find_repository()
@@ -129,9 +129,9 @@
def test_open_repos_nonroot(self):
repos_url = self.make_repository("d")
- dc = self.commit_editor(repos_url)
+ dc = self.get_commit_editor(repos_url)
dc.add_dir("trunk")
- dc.done()
+ dc.close()
x = BzrDir.open(repos_url+"/trunk")
self.assertRaises(NoRepositoryPresent, x.open_repository)
=== modified file 'tests/test_repository.py'
--- a/tests/test_repository.py 2008-06-22 08:17:15 +0000
+++ b/tests/test_repository.py 2008-06-23 02:23:10 +0000
@@ -55,9 +55,9 @@
def test_get_branch_log(self):
repos_url = self.make_repository("a")
- cb = self.commit_editor(repos_url)
- cb.add_file("foo")
- cb.done()
+ cb = self.get_commit_editor(repos_url)
+ cb.add_file("foo").modify()
+ cb.close()
repos = Repository.open(repos_url)
=== modified file 'tests/test_revspec.py'
--- a/tests/test_revspec.py 2008-06-05 03:39:17 +0000
+++ b/tests/test_revspec.py 2008-06-23 02:23:10 +0000
@@ -42,13 +42,13 @@
revspec = RevisionSpec.from_string("svn:2")
repos_url = self.make_repository("a")
- dc = self.commit_editor(repos_url)
- dc.add_file("foo")
- dc.done()
+ dc = self.get_commit_editor(repos_url)
+ dc.add_file("foo").modify()
+ dc.close()
- dc = self.commit_editor(repos_url)
- dc.add_file("bar")
- dc.done()
+ dc = self.get_commit_editor(repos_url)
+ dc.add_file("bar").modify()
+ dc.close()
branch = Branch.open(repos_url)
revinfo = revspec._match_on(branch, None)
@@ -59,9 +59,9 @@
revspec = RevisionSpec.from_string("svn:foo")
repos_url = self.make_repository("a")
- dc = self.commit_editor(repos_url)
- dc.add_file("bar")
- dc.done()
+ dc = self.get_commit_editor(repos_url)
+ dc.add_file("bar").modify()
+ dc.close()
branch = Branch.open(repos_url)
@@ -72,9 +72,9 @@
revspec = RevisionSpec.from_string("svn:24")
repos_url = self.make_repository("a")
- dc = self.commit_editor(repos_url)
- dc.add_file("bar")
- dc.done()
+ dc = self.get_commit_editor(repos_url)
+ dc.add_file("bar").modify()
+ dc.close()
branch = Branch.open(repos_url)
=== modified file 'tests/test_tree.py'
--- a/tests/test_tree.py 2008-06-15 02:48:51 +0000
+++ b/tests/test_tree.py 2008-06-23 02:23:10 +0000
@@ -34,10 +34,11 @@
def test_executable(self):
repos_url = self.make_client("d", "dc")
- dc = self.commit_editor(repos_url)
- dc.add_file("file", "x")
- dc.change_file_prop("file", "svn:executable", "*")
- dc.done()
+ dc = self.get_commit_editor(repos_url)
+ f = dc.add_file("file").modify("x")
+ f.modify()
+ f.change_prop("svn:executable", "*")
+ dc.close()
self.client_update("dc")
=== modified file 'tests/test_upgrade.py'
--- a/tests/test_upgrade.py 2008-06-05 16:44:48 +0000
+++ b/tests/test_upgrade.py 2008-06-23 02:23:10 +0000
@@ -63,9 +63,9 @@
def test_no_custom(self):
repos_url = self.make_repository("a")
- dc = self.commit_editor(repos_url)
- dc.add_file("a", "b")
- dc.done()
+ dc = self.get_commit_editor(repos_url)
+ dc.add_file("a").modify("b")
+ dc.close()
oldrepos = Repository.open(repos_url)
dir = BzrDir.create("f", format=get_rich_root_format())
@@ -88,9 +88,9 @@
def test_single_custom(self):
repos_url = self.make_repository("a")
- dc = self.commit_editor(repos_url)
- dc.add_file("a", "b")
- dc.done()
+ dc = self.get_commit_editor(repos_url)
+ dc.add_file("a").modify("b")
+ dc.close()
oldrepos = Repository.open(repos_url)
dir = BzrDir.create("f", format=get_rich_root_format())
@@ -118,9 +118,9 @@
def test_single_keep_parent_fileid(self):
repos_url = self.make_repository("a")
- dc = self.commit_editor(repos_url)
- dc.add_file("a", "b")
- dc.done()
+ dc = self.get_commit_editor(repos_url)
+ dc.add_file("a").modify("b")
+ dc.close()
oldrepos = Repository.open(repos_url)
dir = BzrDir.create("f", format=get_rich_root_format())
@@ -147,10 +147,10 @@
def test_single_custom_continue(self):
repos_url = self.make_repository("a")
- dc = self.commit_editor(repos_url)
- dc.add_file("a", "b")
- dc.add_file("b", "c")
- dc.done()
+ dc = self.get_commit_editor(repos_url)
+ dc.add_file("a").modify("b")
+ dc.add_file("b").modify("c")
+ dc.close()
oldrepos = Repository.open(repos_url)
dir = BzrDir.create("f", format=get_rich_root_format())
@@ -194,9 +194,9 @@
def test_more_custom(self):
repos_url = self.make_repository("a")
- dc = self.commit_editor(repos_url)
- dc.add_file("a", "b")
- dc.done()
+ dc = self.get_commit_editor(repos_url)
+ dc.add_file("a").modify("b")
+ dc.close()
oldrepos = Repository.open(repos_url)
dir = BzrDir.create("f", format=get_rich_root_format())
@@ -233,9 +233,9 @@
def test_more_custom_branch(self):
repos_url = self.make_repository("a")
- dc = self.commit_editor(repos_url)
- dc.add_file("a", "b")
- dc.done()
+ dc = self.get_commit_editor(repos_url)
+ dc.add_file("a").modify("b")
+ dc.close()
oldrepos = Repository.open(repos_url)
dir = BzrDir.create("f", format=get_rich_root_format())
@@ -262,9 +262,9 @@
def test_workingtree(self):
repos_url = self.make_repository("a")
- dc = self.commit_editor(repos_url)
- dc.add_file("a", "b")
- dc.done()
+ dc = self.get_commit_editor(repos_url)
+ dc.add_file("a").modify("b")
+ dc.close()
oldrepos = Repository.open(repos_url)
dir = BzrDir.create("f", format=get_rich_root_format())
@@ -292,9 +292,9 @@
def test_branch_none(self):
repos_url = self.make_repository("a")
- dc = self.commit_editor(repos_url)
- dc.add_file("a", "b")
- dc.done()
+ dc = self.get_commit_editor(repos_url)
+ dc.add_file("a").modify("b")
+ dc.close()
oldrepos = Repository.open(repos_url)
dir = BzrDir.create("f", format=get_rich_root_format())
@@ -317,9 +317,9 @@
def test_raise_incompat(self):
repos_url = self.make_repository("a")
- dc = self.commit_editor(repos_url)
- dc.add_file("d", "e")
- dc.done()
+ dc = self.get_commit_editor(repos_url)
+ dc.add_file("d").modify("e")
+ dc.close()
oldrepos = Repository.open(repos_url)
dir = BzrDir.create("f", format=get_rich_root_format())
More information about the bazaar-commits
mailing list