Rev 2282: Switch the test to being a branch_implementation test. in http://bzr.arbash-meinel.com/branches/bzr/0.15-dev/push_readonly

John Arbash Meinel john at arbash-meinel.com
Mon Feb 12 22:58:53 GMT 2007


At http://bzr.arbash-meinel.com/branches/bzr/0.15-dev/push_readonly

------------------------------------------------------------
revno: 2282
revision-id: john at arbash-meinel.com-20070212225848-lxl29d1xugdid79d
parent: john at arbash-meinel.com-20070212224239-8tbgpw9qhooqitk1
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: push_readonly
timestamp: Mon 2007-02-12 16:58:48 -0600
message:
  Switch the test to being a branch_implementation test.
modified:
  bzrlib/tests/blackbox/test_push.py test_push.py-20060329002750-929af230d5d22663
  bzrlib/tests/branch_implementations/test_push.py test_push.py-20070130153159-fhfap8uoifevg30j-1
-------------- next part --------------
=== modified file 'bzrlib/tests/blackbox/test_push.py'
--- a/bzrlib/tests/blackbox/test_push.py	2007-02-12 22:42:39 +0000
+++ b/bzrlib/tests/blackbox/test_push.py	2007-02-12 22:58:48 +0000
@@ -23,8 +23,9 @@
 from bzrlib import (
     errors,
     )
+import bzrlib
 from bzrlib.branch import Branch
-from bzrlib.bzrdir import BzrDir, BzrDirMetaFormat1
+from bzrlib.bzrdir import BzrDirMetaFormat1
 from bzrlib.osutils import abspath
 from bzrlib.repository import RepositoryFormatKnit1
 from bzrlib.tests.blackbox import ExternalBase
@@ -99,7 +100,7 @@
         out, err = self.run_bzr('push', 'pushed-location')
         self.assertEqual('', out)
         self.assertEqual('0 revision(s) pushed.\n', err)
-        b2 = Branch.open('pushed-location')
+        b2 = bzrlib.branch.Branch.open('pushed-location')
         self.assertEndsWith(b2.base, 'pushed-location/')
 
     def test_push_new_branch_revision_count(self):
@@ -232,18 +233,3 @@
         self.run_bzr_error(['At ../dir you have a valid .bzr control'],
                 'push', '../dir',
                 working_dir='tree')
-
-    def test_push_inside_repository(self):
-        """Push from one branch to another inside the same repository."""
-        repo = self.make_repository('repo', shared=True)
-        # This is a little bit trickier because make_branch_and_tree will not
-        # re-use a shared repository.
-        a_branch = BzrDir.create_branch_convenience('repo/tree')
-        tree = a_branch.bzrdir.open_workingtree()
-        self.build_tree(['repo/tree/a'])
-        tree.add(['a'])
-        tree.commit('a')
-
-        to_branch = BzrDir.create_branch_convenience('repo/branch')
-        self.run_bzr('push', '../branch',
-                     working_dir='repo/tree')

=== modified file 'bzrlib/tests/branch_implementations/test_push.py'
--- a/bzrlib/tests/branch_implementations/test_push.py	2007-02-12 22:36:18 +0000
+++ b/bzrlib/tests/branch_implementations/test_push.py	2007-02-12 22:58:48 +0000
@@ -109,6 +109,33 @@
         finally:
             source.branch.unlock()
 
+    def test_push_within_repository(self):
+        """Push from one branch to another inside the same repository."""
+        try:
+            repo = self.make_repository('repo', shared=True)
+        except (errors.IncompatibleFormat, errors.UninitializableFormat):
+            # This Branch format cannot create shared repositories
+            return
+        # This is a little bit trickier because make_branch_and_tree will not
+        # re-use a shared repository.
+        a_bzrdir = self.make_bzrdir('repo/tree')
+        try:
+            a_branch = self.branch_format.initialize(a_bzrdir)
+        except (errors.UninitializableFormat):
+            # Cannot create these branches
+            return
+        tree = a_branch.bzrdir.create_workingtree()
+        self.build_tree(['repo/tree/a'])
+        tree.add(['a'])
+        tree.commit('a')
+
+        to_bzrdir = self.make_bzrdir('repo/branch')
+        to_branch = self.branch_format.initialize(to_bzrdir)
+        tree.branch.push(to_branch)
+
+        self.assertEqual(tree.branch.last_revision(),
+                         to_branch.last_revision())
+
 
 class TestPushHook(TestCaseWithBranch):
 



More information about the bazaar-commits mailing list