Beispiel #1
0
    def test_executable_changed(self):
        tree = self.make_svn_branch_and_tree("d", "dc")

        dc = self.get_commit_editor(tree.branch.base)
        dc.add_file("file").modify(b"x")
        dc.close()

        self.client_update("dc")
        self.client_set_prop("dc/file", "svn:executable", "*")
        tree = SvnBasisTree(tree)
        self.assertFalse(tree.is_executable("file"))
Beispiel #2
0
    def test_symlink(self):
        tree = self.make_svn_branch_and_tree("d", "dc")

        dc = self.get_commit_editor(tree.branch.base)
        file = dc.add_file("file")
        file.modify(b"link target")
        file.change_prop("svn:special", "*")
        dc.close()

        self.client_update("dc")
        tree = SvnBasisTree(tree)
        self.assertEqual('symlink', tree.kind("file"))
        self.assertEqual("target", tree.get_symlink_target("file"))
Beispiel #3
0
    def test_symlink_with_newlines_in_target(self):
        repos_url = self.make_client("d", "dc")

        dc = self.get_commit_editor(repos_url)
        file = dc.add_file("file")
        file.modify(b"link target\nbar\nbla")
        file.change_prop("svn:special", "*")
        dc.close()

        self.client_update("dc")
        tree = SvnBasisTree(WorkingTree.open("dc"))
        self.assertEqual('symlink', tree.kind("file"))
        self.assertEqual("target\nbar\nbla", tree.get_symlink_target("file"))
Beispiel #4
0
    def test_file_verifiers(self):
        tree = self.make_svn_branch_and_tree("d", "dc")

        dc = self.get_commit_editor(tree.branch.base)
        f = dc.add_file("file")
        f.modify(b"new contents")
        dc.close()

        self.client_update("dc")

        tree = SvnBasisTree(tree)
        self.assertEquals(tree.get_file_verifier("file"),
                          ("MD5", osutils.md5("new contents").hexdigest()))
Beispiel #5
0
    def test_annotate_iter(self):
        repos_url = self.make_client("d", "dc")

        dc = self.get_commit_editor(repos_url)
        dc.add_file("file").modify(b"x\n")
        dc.close()

        dc = self.get_commit_editor(repos_url)
        dc.open_file("file").modify(b"x\ny\n")
        dc.close()

        self.client_update('dc')
        wt = WorkingTree.open("dc")
        tree = SvnBasisTree(wt)
        repo = wt.branch.repository
        self.assertEquals(
            [(repo.generate_revision_id(1, u"", repo.get_mapping()), "x\n"),
             (repo.generate_revision_id(2, u"", repo.get_mapping()), "y\n")],
            tree.annotate_iter("file"))
Beispiel #6
0
    def test_symlink_not_special(self):
        tree = self.make_svn_branch_and_tree("d", "dc")

        dc = self.get_commit_editor(tree.branch.base)
        file1 = dc.add_file("file")
        file1.modify(b"fsdfdslhfdsk h")
        file1.change_prop("svn:special", "*")
        file2 = dc.add_file("file2")
        file2.modify(b"a")
        file2.change_prop("svn:special", "*")
        dc.close()

        try:
            self.client_update("dc")
        except subvertpy.SubversionException as e:
            if e.args[1] == subvertpy.ERR_WC_BAD_ADM_LOG:
                raise TestSkipped("Unable to run test with svn 1.4")
            raise
        tree = SvnBasisTree(tree)
        self.assertEqual('file', tree.kind("file"))
Beispiel #7
0
    def test_executable_link(self):
        self.requireFeature(SymlinkFeature)
        repos_url = self.make_client("d", "dc")

        dc = self.get_commit_editor(repos_url)
        file = dc.add_file("file")
        file.modify(b"link target")
        file.change_prop("svn:special", "*")
        file.change_prop("svn:executable", "*")
        dc.close()

        try:
            self.client_update("dc")
        except subvertpy.SubversionException as e:
            if e.args[1] == subvertpy.ERR_WC_BAD_ADM_LOG:
                raise TestSkipped("Unable to run test with svn 1.4")
            raise

        wt = WorkingTree.open("dc")
        tree = SvnBasisTree(wt)
        self.assertFalse(tree.is_executable("file"))
        self.assertFalse(wt.is_executable("file"))
Beispiel #8
0
 def test_root_id(self):
     tree = self.make_svn_branch_and_tree("d", "dc")
     tree = SvnBasisTree(tree)
     self.assertIs(None, tree.path2id(''))
Beispiel #9
0
class TestBasisTree(SubversionTestCase):

    def test_file_verifiers(self):
        tree = self.make_svn_branch_and_tree("d", "dc")

        dc = self.get_commit_editor(tree.branch.base)
        f = dc.add_file("file")
        f.modify("new contents")
        dc.close()

        self.client_update("dc")

        tree = SvnBasisTree(tree)
        self.assertEquals(tree.get_file_verifier("file"),
            ("MD5", osutils.md5("new contents").hexdigest()))

    def test_root_id(self):
        tree = self.make_svn_branch_and_tree("d", "dc")
        tree = SvnBasisTree(tree)
        self.assertIs(None, tree.get_root_id())

    def test_executable(self):
        tree = self.make_svn_branch_and_tree("d", "dc")

        dc = self.get_commit_editor(tree.branch.base)
        f = dc.add_file("file")
        f.modify("x")
        f.change_prop("svn:executable", "*")
        dc.close()

        self.client_update("dc")

        tree = SvnBasisTree(tree)
        self.assertTrue(tree.is_executable("file"))

    def test_executable_changed(self):
        tree = self.make_svn_branch_and_tree("d", "dc")

        dc = self.get_commit_editor(tree.branch.base)
        dc.add_file("file").modify("x")
        dc.close()

        self.client_update("dc")
        self.client_set_prop("dc/file", "svn:executable", "*")
        tree = SvnBasisTree(tree)
        self.assertFalse(tree.is_executable("file"))

    def test_symlink(self):
        tree = self.make_svn_branch_and_tree("d", "dc")

        dc = self.get_commit_editor(tree.branch.base)
        file = dc.add_file("file")
        file.modify("link target")
        file.change_prop("svn:special", "*")
        dc.close()

        self.client_update("dc")
        tree = SvnBasisTree(tree)
        self.assertEqual('symlink',
                         tree.kind("file"))
        self.assertEqual("target",
                         tree.get_symlink_target("file"))

    def test_symlink_with_newlines_in_target(self):
        repos_url = self.make_client("d", "dc")

        dc = self.get_commit_editor(repos_url)
        file = dc.add_file("file")
        file.modify("link target\nbar\nbla")
        file.change_prop("svn:special", "*")
        dc.close()

        self.client_update("dc")
        tree = SvnBasisTree(WorkingTree.open("dc"))
        self.assertEqual('symlink',
                         tree.kind("file"))
        self.assertEqual("target\nbar\nbla",
                         tree.get_symlink_target("file"))

    def test_symlink_not_special(self):
        tree = self.make_svn_branch_and_tree("d", "dc")

        dc = self.get_commit_editor(tree.branch.base)
        file1 = dc.add_file("file")
        file1.modify("fsdfdslhfdsk h")
        file1.change_prop("svn:special", "*")
        file2 = dc.add_file("file2")
        file2.modify("a")
        file2.change_prop("svn:special", "*")
        dc.close()

        try:
            self.client_update("dc")
        except subvertpy.SubversionException, (msg, num):
            if num == subvertpy.ERR_WC_BAD_ADM_LOG:
                raise TestSkipped("Unable to run test with svn 1.4")
            raise
        tree = SvnBasisTree(tree)
        self.assertEqual('file', tree.kind("file"))
Beispiel #10
0
        dc = self.get_commit_editor(repos_url)
        file = dc.add_file("file")
        file.modify("link target")
        file.change_prop("svn:special", "*")
        file.change_prop("svn:executable", "*")
        dc.close()

        try:
            self.client_update("dc")
        except subvertpy.SubversionException, (msg, num):
            if num == subvertpy.ERR_WC_BAD_ADM_LOG:
                raise TestSkipped("Unable to run test with svn 1.4")
            raise

        wt = WorkingTree.open("dc")
        tree = SvnBasisTree(wt)
        self.assertFalse(tree.is_executable("file"))
        self.assertFalse(wt.is_executable("file"))


class TestInventoryExternals(SubversionTestCase):

    def test_add_nested_norev(self):
        """Add a nested tree with no specific revision referenced."""
        branch = self.make_svn_branch('d', lossy=True)
        repos = branch.repository
        mapping = repos.get_mapping()
        inv = Inventory(root_id='blabloe')
        inventory_add_external(inv, 'blabloe', 'blie/bla',
                mapping.revision_id_foreign_to_bzr((repos.uuid, branch.get_branch_path(), 1)),
                None, branch.base)