Rev 2244: Add test for bug 295416. in http://people.samba.org/bzr/jelmer/bzr-svn/0.5

Jelmer Vernooij jelmer at samba.org
Mon Dec 8 17:34:39 GMT 2008


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

------------------------------------------------------------
revno: 2244
revision-id: jelmer at samba.org-20081208173437-j97fo9ntubiiwjnh
parent: jelmer at samba.org-20081208170635-t9v37nm57ivn9yd6
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.5
timestamp: Mon 2008-12-08 18:34:37 +0100
message:
  Add test for bug 295416.
modified:
  tests/test_push.py             test_push.py-20070201165715-g2ievcdfqi33wqsy-1
=== modified file 'tests/test_push.py'
--- a/tests/test_push.py	2008-11-18 15:02:20 +0000
+++ b/tests/test_push.py	2008-12-08 17:34:37 +0000
@@ -16,11 +16,12 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
+from bzrlib import osutils
 from bzrlib.branch import Branch
 from bzrlib.bzrdir import BzrDir
 from bzrlib.errors import AlreadyBranchError, BzrError, DivergedBranches
+from bzrlib.inventory import InventoryDirectory
 from bzrlib.merge import Merger, Merge3Merger
-from bzrlib.osutils import has_symlinks
 from bzrlib.progress import DummyProgress
 from bzrlib.repository import Repository
 from bzrlib.trace import mutter
@@ -28,13 +29,14 @@
 import os
 
 from bzrlib.plugins.svn import format
-from subvertpy import ra
 from bzrlib.plugins.svn.errors import MissingPrefix
 from bzrlib.plugins.svn.commit import push, dpush
 from bzrlib.plugins.svn.layout.standard import RootLayout
 from bzrlib.plugins.svn.mapping import SVN_PROP_BZR_REVISION_ID
 from bzrlib.plugins.svn.tests import SubversionTestCase
 
+from subvertpy import ra
+
 class TestDPush(SubversionTestCase):
     def setUp(self):
         super(TestDPush, self).setUp()
@@ -237,7 +239,7 @@
                         self.svndir.open_branch().last_revision())
 
     def test_symlink(self):
-        if not has_symlinks():
+        if not osutils.has_symlinks():
             return
         os.symlink("bla", "dc/south")
         assert os.path.islink("dc/south")
@@ -957,6 +959,32 @@
         os.mkdir("n")
         BzrDir.open(repos_url+"/trunk").sprout("n")
 
+    def test_subdir_becomes_branch_root(self):
+        repos_url = self.make_repository("a")
+
+        dc = self.get_commit_editor(repos_url)
+        trunk = dc.add_dir("trunk")
+        subdir = trunk.add_dir("trunk/mysubdir")
+        subdir.add_file("trunk/mysubdir/myfile").modify("blabla")
+        dc.close()
+
+        os.mkdir("dc")
+        svndir = BzrDir.open(repos_url+"/trunk")
+        bzrdir = svndir.sprout("dc")
+        wt = bzrdir.open_workingtree()
+        wt.lock_write()
+        wt.apply_inventory_delta([
+            ("", None, wt.inventory.root.file_id, None),
+            ("mysubdir", "", wt.inventory.path2id("mysubdir"), 
+                InventoryDirectory(wt.inventory.path2id("mysubdir"), "", None))])
+        os.rename("dc/mysubdir/myfile", "dc/myfile")
+        osutils.rmtree("dc/mysubdir")
+        wt.unlock()
+        wt.commit("Change branch root")
+        svnbranch = svndir.open_branch()
+        svnbranch.pull(wt.branch)
+        self.assertEquals(svnbranch.last_revision(), wt.branch.last_revision())
+        self.assertEquals(["myfile"], svndir.root_transport.list_dir("."))
 
 
 class TestPushTwice(SubversionTestCase):




More information about the bazaar-commits mailing list