Rev 1304: Remove the old test commit editor. in http://people.samba.org/bzr/jelmer/bzr-svn/0.4

Jelmer Vernooij jelmer at samba.org
Mon Jun 23 03:40:48 BST 2008


At http://people.samba.org/bzr/jelmer/bzr-svn/0.4

------------------------------------------------------------
revno: 1304
revision-id: jelmer at samba.org-20080623024047-ck4qf3oakncf378f
parent: jelmer at samba.org-20080623022310-xtr5gk2z4yxd3dyq
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Mon 2008-06-23 04:40:47 +0200
message:
  Remove the old test commit editor.
modified:
  tests/__init__.py              __init__.py-20060508151940-e9f4d914801a2535
  tests/test_branch.py           test_branch.py-20060508162215-74ffeb5d608f8e20
  tests/test_branchprops.py      test_branchprops.py-20061223210444-04xf5224zcg69m3w-1
  tests/test_checkout.py         test_checkout.py-20070101154110-eevkc29qj0q7udz5-1
  tests/test_commit.py           test_commit.py-20060624213521-l5kcufywkh9mnilk-1
  tests/test_fetch.py            test_fetch.py-20070624210302-luvgwjmlfysk5qeq-1
=== modified file 'tests/__init__.py'
--- a/tests/__init__.py	2008-06-23 01:11:06 +0000
+++ b/tests/__init__.py	2008-06-23 02:40:47 +0000
@@ -315,13 +315,6 @@
         self.make_checkout(repos_url, clientpath)
         return repos_url
 
-    def dumpfile(self, repos):
-        """Create a dumpfile for the specified repository.
-
-        :return: File name of the dumpfile.
-        """
-        raise NotImplementedError(self.dumpfile)
-
     def open_fs(self, relpath):
         """Open a fs.
 
@@ -334,117 +327,6 @@
         revnum = ra.get_latest_revnum()
         return TestCommitEditor(ra.get_commit_editor({"svn:log": message}), ra.url, revnum)
 
-    def commit_editor(self, url, message="Test commit"):
-        ra = RemoteAccess(url.encode('utf8'))
-        class CommitEditor(object):
-            def __init__(self, ra, editor, base_revnum, base_url):
-                self._used = False
-                self.ra = ra
-                self.base_revnum = base_revnum
-                self.editor = editor
-                self.data = {}
-                self.create = set()
-                self.props = {}
-                self.copyfrom = {}
-                self.base_url = base_url
-
-            def _parts(self, path):
-                return path.strip("/").split("/")
-
-            def add_dir(self, path, copyfrom_path=None, copyfrom_rev=-1):
-                self.create.add(path)
-                if copyfrom_path is not None:
-                    if copyfrom_rev == -1:
-                        copyfrom_rev = self.base_revnum
-                    copyfrom_path = os.path.join(self.base_url, copyfrom_path)
-                self.copyfrom[path] = (copyfrom_path, copyfrom_rev)
-                self.open_dir(path)
-
-            def open_dir(self, path):
-                x = self.data
-                for p in self._parts(path):
-                    if not p in x:
-                        x[p] = {}
-                    x = x[p]
-                return x
-
-            def add_file(self, path, contents=None):
-                self.create.add(path)
-                self.change_file(path, contents)
-                
-            def change_file(self, path, contents=None):
-                parts = self._parts(path)
-                x = self.open_dir("/".join(parts[:-1]))
-                if contents is None:
-                    contents = osutils.rand_chars(100)
-                x[parts[-1]] = contents
-
-            def delete(self, path):
-                parts = self._parts(path)
-                x = self.open_dir("/".join(parts[:-1]))
-                x[parts[-1]] = None
-                
-            def change_dir_prop(self, path, propname, propval):
-                self.open_dir(path)
-                if not path in self.props:
-                    self.props[path] = {}
-                self.props[path][propname] = propval
-
-            def change_file_prop(self, path, propname, propval):
-                parts = self._parts(path)
-                x = self.open_dir("/".join(parts[:-1]))
-                x[parts[-1]] = ()
-                if not path in self.props:
-                    self.props[path] = {}
-                self.props[path][propname] = propval
-
-            def _process_dir(self, dir_baton, dir_dict, path):
-                for name, contents in dir_dict.items():
-                    subpath = urlutils.join(path, name).strip("/")
-                    if contents is None:
-                        dir_baton.delete_entry(subpath, -1)
-                    elif isinstance(contents, dict):
-                        if subpath in self.create:
-                            child_baton = dir_baton.add_directory(subpath, self.copyfrom[subpath][0], self.copyfrom[subpath][1])
-                        else:
-                            child_baton = dir_baton.open_directory(subpath, -1)
-                        if subpath in self.props:
-                            for k, v in self.props[subpath].items():
-                                child_baton.change_prop(k, v)
-
-                        self._process_dir(child_baton, dir_dict[name], subpath)
-
-                        child_baton.close()
-                    else:
-                        if subpath in self.create:
-                            child_baton = dir_baton.add_file(subpath, None, -1)
-                        else:
-                            child_baton = dir_baton.open_file(subpath)
-                        if isinstance(contents, str):
-                            txdelta = child_baton.apply_textdelta()
-                            txdelta_send_stream(StringIO(contents), txdelta)
-                        if subpath in self.props:
-                            for k, v in self.props[subpath].items():
-                                child_baton.change_prop(k, v)
-                        child_baton.close()
-
-            def done(self):
-                assert self._used == False
-                self._used = True
-                root_baton = self.editor.open_root(self.base_revnum)
-                self._process_dir(root_baton, self.data, "")
-                root_baton.close()
-                self.editor.close()
-
-                my_revnum = ra.get_latest_revnum()
-                assert my_revnum > self.base_revnum
-
-                return my_revnum
-
-        base_revnum = ra.get_latest_revnum()
-        editor = ra.get_commit_editor({"svn:log": message})
-        return CommitEditor(ra, editor, base_revnum, url)
-
 
 def test_suite():
     from unittest import TestSuite

=== modified file 'tests/test_branch.py'
--- a/tests/test_branch.py	2008-06-17 22:52:33 +0000
+++ b/tests/test_branch.py	2008-06-23 02:40:47 +0000
@@ -48,9 +48,9 @@
     def test_get_branch_path_subdir(self):
         repos_url = self.make_repository("a")
 
-        dc = self.commit_editor(repos_url)
+        dc = self.get_commit_editor(repos_url)
         dc.add_dir("trunk")
-        dc.done()
+        dc.close()
 
         branch = Branch.open(repos_url+"/trunk")
         self.assertEqual("trunk", branch.get_branch_path())
@@ -92,9 +92,9 @@
         self.assertEqual(branch.generate_revision_id(0),
                          branch.last_revision())
 
-        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()
         
         bzrdir = BzrDir.open("svn+"+repos_url)
         branch = bzrdir.open_branch()
@@ -105,9 +105,9 @@
         self.assertEqual(repos.generate_revision_id(1, "", mapping), 
                 branch.last_revision())
 
-        dc = self.commit_editor(repos_url)
-        dc.change_file("foo")
-        dc.done()
+        dc = self.get_commit_editor(repos_url)
+        dc.open_file("foo").modify()
+        dc.close()
 
         branch = Branch.open("svn+"+repos_url)
         repos = Repository.open("svn+"+repos_url)
@@ -162,11 +162,11 @@
         self.assertEqual([branch.generate_revision_id(0)], 
                 branch.revision_history())
 
-        dc = self.commit_editor(repos_url)
-        dc.add_file("foo")
-        dc.change_dir_prop("", SVN_PROP_BZR_REVISION_ID+"none", 
+        dc = self.get_commit_editor(repos_url)
+        dc.add_file("foo").modify()
+        dc.change_prop(SVN_PROP_BZR_REVISION_ID+"none", 
                 "42 mycommit\n")
-        dc.done()
+        dc.close()
         
         branch = Branch.open("svn+"+repos_url)
         repos = Repository.open("svn+"+repos_url)
@@ -177,9 +177,9 @@
                     repos.generate_revision_id(1, "", mapping)], 
                 branch.revision_history())
 
-        dc = self.commit_editor(repos_url)
-        dc.change_file("foo")
-        dc.done()
+        dc = self.get_commit_editor(repos_url)
+        dc.open_file("foo").modify()
+        dc.close()
 
         branch = Branch.open("svn+"+repos_url)
         repos = Repository.open("svn+"+repos_url)
@@ -208,11 +208,11 @@
     def test_revision_id_to_revno_simple(self):
         repos_url = self.make_repository('a')
 
-        dc = self.commit_editor(repos_url)
-        dc.add_file("foo")
-        dc.change_dir_prop("", "bzr:revision-id:v3-none", 
+        dc = self.get_commit_editor(repos_url)
+        dc.add_file("foo").modify()
+        dc.change_prop("bzr:revision-id:v3-none", 
                             "2 myrevid\n")
-        dc.done()
+        dc.close()
 
         branch = Branch.open(repos_url)
         self.assertEquals(2, branch.revision_id_to_revno("myrevid"))
@@ -220,17 +220,17 @@
     def test_revision_id_to_revno_older(self):
         repos_url = self.make_repository('a')
 
-        dc = self.commit_editor(repos_url)
-        dc.add_file("foo")
-        dc.change_dir_prop("", "bzr:revision-id:v3-none", 
+        dc = self.get_commit_editor(repos_url)
+        dc.add_file("foo").modify()
+        dc.change_prop("bzr:revision-id:v3-none", 
                             "2 myrevid\n")
-        dc.done()
+        dc.close()
 
-        dc = self.commit_editor(repos_url)
-        dc.change_file("foo")
-        dc.change_dir_prop("", "bzr:revision-id:v3-none", 
+        dc = self.get_commit_editor(repos_url)
+        dc.open_file("foo").modify()
+        dc.change_prop("bzr:revision-id:v3-none", 
                             "2 myrevid\n3 mysecondrevid\n")
-        dc.done()
+        dc.close()
 
         branch = Branch.open(repos_url)
         self.assertEquals(3, branch.revision_id_to_revno("mysecondrevid"))
@@ -239,9 +239,9 @@
     def test_get_nick_none(self):
         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()
 
         branch = Branch.open("svn+"+repos_url)
 
@@ -250,9 +250,9 @@
     def test_get_nick_path(self):
         repos_url = self.make_repository('a')
 
-        dc = self.commit_editor(repos_url)
+        dc = self.get_commit_editor(repos_url)
         dc.add_dir("trunk")
-        dc.done()
+        dc.close()
 
         branch = Branch.open("svn+"+repos_url+"/trunk")
 
@@ -261,11 +261,11 @@
     def test_get_revprops(self):
         repos_url = self.make_repository('a')
 
-        dc = self.commit_editor(repos_url)
-        dc.add_file("foo")
-        dc.change_dir_prop("", "bzr:revision-info", 
+        dc = self.get_commit_editor(repos_url)
+        dc.add_file("foo").modify()
+        dc.change_prop("bzr:revision-info", 
                 "properties: \n\tbranch-nick: mybranch\n")
-        dc.done()
+        dc.close()
 
         branch = Branch.open("svn+"+repos_url)
 
@@ -523,30 +523,34 @@
     def test_fetch_odd(self):
         repos_url = self.make_repository('d')
 
-        dc = self.commit_editor(repos_url)
-        dc.add_dir("trunk")
-        dc.add_file("trunk/hosts")
-        dc.done()
-
-        dc = self.commit_editor(repos_url)
-        dc.change_file("trunk/hosts")
-        dc.done()
-
-        dc = self.commit_editor(repos_url)
-        dc.change_file("trunk/hosts")
-        dc.done()
-
-        dc = self.commit_editor(repos_url)
+        dc = self.get_commit_editor(repos_url)
+        trunk = dc.add_dir("trunk")
+        trunk.add_file("trunk/hosts").modify()
+        dc.close()
+
+        dc = self.get_commit_editor(repos_url)
+        trunk = dc.open_dir("trunk")
+        trunk.open_file("trunk/hosts").modify()
+        dc.close()
+
+        dc = self.get_commit_editor(repos_url)
+        dc.open_file("trunk/hosts").modify()
+        dc.close()
+
+        dc = self.get_commit_editor(repos_url)
         dc.add_dir("branches")
-        dc.done()
-
-        dc = self.commit_editor(repos_url)
-        dc.add_dir("branches/foobranch", "trunk")
-        dc.done()
-
-        dc = self.commit_editor(repos_url)
-        dc.change_file("branches/foobranch/hosts")
-        dc.done()
+        dc.close()
+
+        dc = self.get_commit_editor(repos_url)
+        branches = dc.open_dir("branches")
+        branches.add_dir("branches/foobranch", "trunk")
+        dc.close()
+
+        dc = self.get_commit_editor(repos_url)
+        branches = dc.open_dir("branches")
+        foobranch = branches.open_dir("branches/foobranch")
+        foobranch.open_file("branches/foobranch/hosts").modify()
+        dc.close()
 
         os.mkdir("new")
 
@@ -584,10 +588,10 @@
     def test_generate_revision_id(self):
         repos_url = self.make_repository('d')
 
-        dc = self.commit_editor(repos_url)
-        dc.add_dir("bla")
-        dc.add_dir("bla/bloe")
-        dc.done()
+        dc = self.get_commit_editor(repos_url)
+        bla = dc.add_dir("bla")
+        bla.add_dir("bla/bloe")
+        dc.close()
 
         branch = Branch.open('d')
         self.assertEqual("svn-v3-none:%s::1" % (branch.repository.uuid),  branch.generate_revision_id(1))
@@ -595,10 +599,10 @@
     def test_create_checkout(self):
         repos_url = self.make_repository('d')
 
-        dc = self.commit_editor(repos_url)
-        dc.add_dir("trunk")
-        dc.add_file("trunk/hosts")
-        dc.done()
+        dc = self.get_commit_editor(repos_url)
+        trunk = dc.add_dir("trunk")
+        trunk.add_file("trunk/hosts").modify()
+        dc.close()
 
         url = "svn+"+repos_url+"/trunk"
         oldbranch = Branch.open(url)
@@ -613,10 +617,10 @@
     def test_create_checkout_lightweight(self):
         repos_url = self.make_repository('d')
 
-        dc = self.commit_editor(repos_url)
-        dc.add_dir("trunk")
-        dc.add_file("trunk/hosts")
-        dc.done()
+        dc = self.get_commit_editor(repos_url)
+        trunk = dc.add_dir("trunk")
+        trunk.add_file("trunk/hosts")
+        dc.close()
 
         url = "svn+"+repos_url+"/trunk"
         oldbranch = Branch.open(url)
@@ -629,14 +633,15 @@
     def test_create_checkout_lightweight_stop_rev(self):
         repos_url = self.make_repository('d')
 
-        dc = self.commit_editor(repos_url)
-        dc.add_dir("trunk")
-        dc.add_file("trunk/hosts")
-        dc.done()
+        dc = self.get_commit_editor(repos_url)
+        trunk = dc.add_dir("trunk")
+        trunk.add_file("trunk/hosts").modify()
+        dc.close()
 
-        dc = self.commit_editor(repos_url)
-        dc.change_file("trunk/hosts")
-        dc.done()
+        dc = self.get_commit_editor(repos_url)
+        trunk = dc.open_dir("trunk")
+        trunk.open_file("trunk/hosts").modify()
+        dc.close()
 
         url = "svn+"+repos_url+"/trunk"
         oldbranch = Branch.open(url)
@@ -651,10 +656,10 @@
     def test_fetch_branch(self):
         repos_url = self.make_client('d', 'sc')
 
-        sc = self.commit_editor(repos_url)
-        sc.add_dir("foo")
-        sc.add_file("foo/bla")
-        sc.done()
+        sc = self.get_commit_editor(repos_url)
+        foo = sc.add_dir("foo")
+        foo.add_file("foo/bla").modify()
+        sc.close()
 
         olddir = self.open_checkout_bzrdir("sc")
 
@@ -669,16 +674,17 @@
     def test_fetch_dir_upgrade(self):
         repos_url = self.make_client('d', 'sc')
 
-        sc = self.commit_editor(repos_url)
-        sc.add_dir("trunk")
-        sc.add_dir("trunk/mylib")
-        sc.add_file("trunk/mylib/bla")
+        sc = self.get_commit_editor(repos_url)
+        trunk = sc.add_dir("trunk")
+        mylib = trunk.add_dir("trunk/mylib")
+        mylib.add_file("trunk/mylib/bla").modify()
         sc.add_dir("branches")
-        sc.done()
+        sc.close()
 
-        sc = self.commit_editor(repos_url)
-        sc.add_dir("branches/abranch", "trunk/mylib")
-        sc.done()
+        sc = self.get_commit_editor(repos_url)
+        branches = sc.open_dir("branches")
+        branches.add_dir("branches/abranch", "trunk/mylib")
+        sc.close()
 
         self.client_update('sc')
         olddir = self.open_checkout_bzrdir("sc/branches/abranch")
@@ -694,16 +700,17 @@
     def test_fetch_branch_downgrade(self):
         repos_url = self.make_client('d', 'sc')
 
-        sc = self.commit_editor(repos_url)
+        sc = self.get_commit_editor(repos_url)
         sc.add_dir("trunk")
-        sc.add_dir("branches")
-        sc.add_dir("branches/abranch")
-        sc.add_file("branches/abranch/bla")
-        sc.done()
+        branches = sc.add_dir("branches")
+        abranch = branches.add_dir("branches/abranch")
+        abranch.add_file("branches/abranch/bla").modify()
+        sc.close()
 
-        sc = self.commit_editor(repos_url)
+        sc = self.get_commit_editor(repos_url)
+        trunk = sc.open_dir("trunk")
         sc.add_dir("trunk/mylib", "branches/abranch")
-        sc.done()
+        sc.close()
 
         self.client_update('sc')
         olddir = self.open_checkout_bzrdir("sc/trunk")
@@ -723,11 +730,11 @@
         # revision that has ghost parents
         repos_url = self.make_client('d', 'sc')
 
-        sc = self.commit_editor(repos_url)
-        sc.add_dir("foo")
-        sc.add_file("foo/bla")
-        sc.change_dir_prop("", "bzr:ancestry:v3-none", "some-ghost\n")
-        sc.done()
+        sc = self.get_commit_editor(repos_url)
+        foo = sc.add_dir("foo")
+        foo.add_file("foo/bla").modify()
+        sc.change_prop("bzr:ancestry:v3-none", "some-ghost\n")
+        sc.close()
 
         olddir = self.open_checkout_bzrdir("sc")
 

=== modified file 'tests/test_branchprops.py'
--- a/tests/test_branchprops.py	2008-06-05 02:17:58 +0000
+++ b/tests/test_branchprops.py	2008-06-23 02:40:47 +0000
@@ -33,13 +33,13 @@
     def test_get_old_properties(self):
         repos_url = self.make_repository('d')
 
-        dc = self.commit_editor(repos_url)
-        dc.change_dir_prop("", "myprop", "data")
-        dc.done()
+        dc = self.get_commit_editor(repos_url)
+        dc.change_prop("myprop", "data")
+        dc.close()
 
-        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()
 
         logwalk = self.get_log_walker(transport=SvnRaTransport(repos_url))
 
@@ -50,9 +50,9 @@
     def test_get_properties(self):
         repos_url = self.make_repository('d')
 
-        dc = self.commit_editor(repos_url)
-        dc.change_dir_prop("", "myprop", "data")
-        dc.done()
+        dc = self.get_commit_editor(repos_url)
+        dc.change_prop("myprop", "data")
+        dc.close()
 
         transport = SvnRaTransport(repos_url)
         logwalk = self.get_log_walker(transport=transport)
@@ -68,17 +68,17 @@
     def test_get_changed_properties(self):
         repos_url = self.make_repository('d')
 
-        dc = self.commit_editor(repos_url)
-        dc.change_dir_prop("", "myprop", "data\n")
-        dc.done()
-
-        dc = self.commit_editor(repos_url)
-        dc.change_dir_prop("", "myprop", "newdata\n")
-        dc.done()
-
-        dc = self.commit_editor(repos_url)
-        dc.change_dir_prop("", "myp2", "newdata\n")
-        dc.done()
+        dc = self.get_commit_editor(repos_url)
+        dc.change_prop("myprop", "data\n")
+        dc.close()
+
+        dc = self.get_commit_editor(repos_url)
+        dc.change_prop("myprop", "newdata\n")
+        dc.close()
+
+        dc = self.get_commit_editor(repos_url)
+        dc.change_prop("myp2", "newdata\n")
+        dc.close()
 
         logwalk = self.get_log_walker(transport=SvnRaTransport(repos_url))
 

=== modified file 'tests/test_checkout.py'
--- a/tests/test_checkout.py	2008-06-17 22:52:33 +0000
+++ b/tests/test_checkout.py	2008-06-23 02:40:47 +0000
@@ -95,9 +95,9 @@
     def test_checkout_branch(self):
         repos_url = self.make_client("d", "dc")
 
-        dc = self.commit_editor(repos_url)
+        dc = self.get_commit_editor(repos_url)
         dc.add_dir("trunk")
-        dc.done()
+        dc.close()
 
         self.client_update("dc")
         x = self.open_checkout_bzrdir("dc/trunk")

=== modified file 'tests/test_commit.py'
--- a/tests/test_commit.py	2008-06-22 16:37:13 +0000
+++ b/tests/test_commit.py	2008-06-23 02:40:47 +0000
@@ -579,9 +579,9 @@
     def test_change_revprops(self):
         repos_url = self.make_repository("d")
 
-        dc = self.commit_editor(repos_url, message="My commit")
-        dc.add_file("foo.txt")
-        dc.done()
+        dc = self.get_commit_editor(repos_url, message="My commit")
+        dc.add_file("foo.txt").modify()
+        dc.close()
 
         transport = SvnRaTransport(repos_url)
         set_svn_revprops(transport, 1, {"svn:author": "Somebody", 
@@ -593,9 +593,9 @@
     def test_change_revprops_disallowed(self):
         repos_url = self.make_repository("d", allow_revprop_changes=False)
 
-        dc = self.commit_editor(repos_url)
-        dc.add_file("foo.txt")
-        dc.done()
+        dc = self.get_commit_editor(repos_url)
+        dc.add_file("foo.txt").modify()
+        dc.close()
 
         transport = SvnRaTransport(repos_url)
         self.assertRaises(RevpropChangeFailed, 

=== modified file 'tests/test_fetch.py'
--- a/tests/test_fetch.py	2008-06-23 02:23:10 +0000
+++ b/tests/test_fetch.py	2008-06-23 02:40:47 +0000
@@ -132,10 +132,10 @@
             raise TestSkipped("Unable to create filenames with backslash on Windows")
         repos_url = self.make_repository('d')
 
-        dc = self.commit_editor(repos_url)
-        dc.add_dir("trunk")
-        dc.add_file("trunk/file\\part", "data")
-        dc.done()
+        dc = self.get_commit_editor(repos_url)
+        trunk = dc.add_dir("trunk")
+        trunk.add_file("trunk/file\\part").modify("data")
+        dc.close()
 
         oldrepos = Repository.open(repos_url)
         set_branching_scheme(oldrepos, TrunkBranchingScheme())
@@ -243,10 +243,10 @@
 
     def test_fetch_signature(self):
         repos_url = self.make_repository('d')
-        dc = self.commit_editor(repos_url)
-        dc.add_dir("trunk")
-        dc.add_file("trunk/bar", "data")
-        dc.done()
+        dc = self.get_commit_editor(repos_url)
+        trunk = dc.add_dir("trunk")
+        trunk.add_file("trunk/bar").modify("data")
+        dc.close()
 
         self.client_set_revprop(repos_url, 1, "bzr:gpg-signature", "SIGNATURE")
         oldrepos = Repository.open(repos_url)
@@ -259,14 +259,15 @@
     def test_fetch_special_char_edit(self):
         repos_url = self.make_repository('d')
         
-        dc = self.commit_editor(repos_url)
-        dc.add_dir("trunk")
-        dc.add_dir(u'trunk/IöC'.encode("utf-8"))
-        dc.done()
+        dc = self.get_commit_editor(repos_url)
+        trunk = dc.add_dir("trunk")
+        trunk.add_dir(u'trunk/IöC'.encode("utf-8"))
+        dc.close()
 
-        dc = self.commit_editor(repos_url)
-        dc.add_file(u'trunk/IöC/bar'.encode("utf-8"), "more data")
-        dc.done()
+        dc = self.get_commit_editor(repos_url)
+        trunk = dc.add_dir("trunk")
+        trunk.add_file(u'trunk/IöC/bar'.encode("utf-8")).modify("more data")
+        dc.close()
 
         oldrepos = Repository.open(repos_url)
         set_branching_scheme(oldrepos, TrunkBranchingScheme(0))
@@ -277,11 +278,11 @@
     def test_fetch_special_char_child(self):
         repos_url = self.make_repository('d')
         
-        dc = self.commit_editor(repos_url)
-        dc.add_dir("trunk")
-        dc.add_dir(u"trunk/é".encode("utf-8"))
-        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")
+        raardir = trunk.add_dir(u"trunk/é".encode("utf-8"))
+        raardir.add_file(u'trunk/é/f\x2cle'.encode("utf-8")).modify("data")
+        dc.close()
         oldrepos = Repository.open(repos_url)
         set_branching_scheme(oldrepos, TrunkBranchingScheme(0))
         dir = BzrDir.create("f", format.get_rich_root_format())
@@ -291,14 +292,15 @@
     def test_fetch_special_char_modify(self):
         repos_url = self.make_repository('d')
 
-        dc = self.commit_editor(repos_url)
-        dc.add_dir("trunk")
-        dc.add_file(u"trunk/€\x2c".encode("utf-8"), "data")
-        dc.done()
+        dc = self.get_commit_editor(repos_url)
+        trunk = dc.add_dir("trunk")
+        trunk.add_file(u"trunk/€\x2c".encode("utf-8")).modify("data")
+        dc.close()
 
-        dc = self.commit_editor(repos_url)
-        dc.change_file(u"trunk/€\x2c".encode("utf-8"), "bar")
-        revno = dc.done()
+        dc = self.get_commit_editor(repos_url)
+        trunk = dc.open_dir("trunk")
+        dc.open_file(u"trunk/€\x2c".encode("utf-8")).modify("bar")
+        revno = dc.close()
 
         oldrepos = Repository.open(repos_url)
         set_branching_scheme(oldrepos, TrunkBranchingScheme(0))
@@ -1277,16 +1279,16 @@
     def test_fetch_dir_upgrade(self):
         repos_url = self.make_repository('d')
 
-        dc = self.commit_editor(repos_url)
-        dc.add_dir("trunk")
-        dc.add_dir("trunk/lib")
-        dc.add_file("trunk/lib/file", 'data')
-        dc.done()
+        dc = self.get_commit_editor(repos_url)
+        trunk = dc.add_dir("trunk")
+        lib = trunk.add_dir("trunk/lib")
+        lib.add_file("trunk/lib/file").modify('data')
+        dc.close()
 
-        dc = self.commit_editor(repos_url)
-        dc.add_dir("branches")
-        dc.add_dir("branches/mybranch", "trunk/lib")
-        dc.done()
+        dc = self.get_commit_editor(repos_url)
+        branches = dc.add_dir("branches")
+        branches.add_dir("branches/mybranch", "trunk/lib")
+        dc.close()
 
         oldrepos = Repository.open(repos_url)
         set_branching_scheme(oldrepos, TrunkBranchingScheme())
@@ -1346,15 +1348,15 @@
     def test_fetch_from_non_branch(self):
         repos_url = self.make_repository('d')
 
-        dc = self.commit_editor(repos_url)
-        dc.add_dir("old-trunk")
-        dc.add_dir("old-trunk/lib")
-        dc.add_file("old-trunk/lib/file", "data")
-        dc.done()
+        dc = self.get_commit_editor(repos_url)
+        ot = dc.add_dir("old-trunk")
+        lib = ot.add_dir("old-trunk/lib")
+        lib.add_file("old-trunk/lib/file").modify("data")
+        dc.close()
 
-        dc = self.commit_editor(repos_url)
+        dc = self.get_commit_editor(repos_url)
         dc.add_dir("trunk", "old-trunk")
-        dc.done()
+        dc.close()
 
         oldrepos = Repository.open(repos_url)
         set_branching_scheme(oldrepos, TrunkBranchingScheme())
@@ -1389,24 +1391,26 @@
     def test_fetch_all(self):
         repos_url = self.make_repository('d')
 
-        dc = self.commit_editor(repos_url)
-        dc.add_dir("trunk")
-        dc.add_file("trunk/hosts", 'hej1')
-        dc.done()
-
-        dc = self.commit_editor(repos_url)
-        dc.change_file('trunk/hosts', 'hej2')
-        dc.done()
-
-        dc = self.commit_editor(repos_url)
-        dc.change_file('trunk/hosts', 'hej3')
-        dc.done()
-
-        dc = self.commit_editor(repos_url)
-        dc.add_dir("branches")
-        dc.add_dir("branches/foobranch")
-        dc.add_file("branches/foobranch/file", 'foohosts')
-        dc.done()
+        dc = self.get_commit_editor(repos_url)
+        trunk = dc.add_dir("trunk")
+        trunk.add_file("trunk/hosts").modify('hej1')
+        dc.close()
+
+        dc = self.get_commit_editor(repos_url)
+        trunk = dc.open_dir('trunk')
+        trunk.open_file('trunk/hosts').modify('hej2')
+        dc.close()
+
+        dc = self.get_commit_editor(repos_url)
+        trunk = dc.open_dir('trunk')
+        trunk.open_file('trunk/hosts').modify('hej3')
+        dc.close()
+
+        dc = self.get_commit_editor(repos_url)
+        branches = dc.add_dir("branches")
+        foobranch = branches.add_dir("branches/foobranch")
+        foobranch.add_file("branches/foobranch/file").modify('foohosts')
+        dc.close()
 
         oldrepos = Repository.open(repos_url)
         set_branching_scheme(oldrepos, TrunkBranchingScheme())
@@ -1494,10 +1498,11 @@
     def test_fetch_consistent(self):
         repos_url = self.make_repository('d')
 
-        dc = self.commit_editor(repos_url)
-        dc.add_file("bla", "data")
-        dc.change_file_prop("bla", "svn:executable", "*")
-        dc.done()
+        dc = self.get_commit_editor(repos_url)
+        f = dc.add_file("bla")
+        f.modify("data")
+        f.change_prop("svn:executable", "*")
+        dc.close()
 
         oldrepos = Repository.open("svn+"+repos_url)
         dir1 = BzrDir.create("f", format.get_rich_root_format())
@@ -1609,10 +1614,10 @@
     def test_fetch_ghosts(self):
         repos_url = self.make_repository('d')
 
-        dc = self.commit_editor(repos_url)
-        dc.add_file("bla", "data")
-        dc.change_dir_prop("", "bzr:ancestry:v3-none", "aghost\n")
-        dc.done()
+        dc = self.get_commit_editor(repos_url)
+        dc.add_file("bla").modify("data")
+        dc.change_prop("bzr:ancestry:v3-none", "aghost\n")
+        dc.close()
 
         oldrepos = Repository.open("svn+"+repos_url)
         dir = BzrDir.create("f", format.get_rich_root_format())
@@ -1667,22 +1672,22 @@
 
     def test_fetch_property_change_only(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("", "some:property", "some data\n")
-        dc.done()
-
-        dc = self.commit_editor(repos_url)
-        dc.change_dir_prop("", "some2:property", "some data\n")
-        dc.done()
-
-        dc = self.commit_editor(repos_url)
-        dc.change_dir_prop("", "some:property", "some data4\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)
+        dc.change_prop("some:property", "some data\n")
+        dc.close()
+
+        dc = self.get_commit_editor(repos_url)
+        dc.change_prop("some2:property", "some data\n")
+        dc.close()
+
+        dc = self.get_commit_editor(repos_url)
+        dc.change_prop("some:property", "some data4\n")
+        dc.close()
 
         oldrepos = Repository.open("svn+"+repos_url)
         dir = BzrDir.create("f", format.get_rich_root_format())




More information about the bazaar-commits mailing list