def test_conflict(self):
    """Test conflict api."""

    rev = core.svn_opt_revision_t()
    rev.kind = core.svn_opt_revision_number
    rev.value.number = 0

    path = self.temper.alloc_empty_dir('-conflict')

    client.checkout2(self.repos_uri, path, rev, rev, True, True,
            self.client_ctx)

    trunk_path = core.svn_dirent_join(path, b'trunk')

    # Create a conflicting path
    os.mkdir(core.svn_dirent_local_style(trunk_path))

    rev.value.number = 2

    client.update4((path,), rev, core.svn_depth_unknown, True, False, False,
                   False, False, self.client_ctx)

    pool = core.Pool()
    conflict = client.conflict_get(trunk_path, self.client_ctx, pool)

    self.assertTrue(isinstance(conflict, client.svn_client_conflict_t))

    conflict_opts = client.conflict_tree_get_resolution_options(conflict, self.client_ctx)

    self.assertTrue(isinstance(conflict_opts, list))
    self.assert_all_instances_of(conflict_opts, client.svn_client_conflict_option_t)

    pool.clear()
Exemple #2
0
    def test_update4(self):
        """Test update and the notify function callbacks"""

        rev = core.svn_opt_revision_t()
        rev.kind = core.svn_opt_revision_number
        rev.value.number = 0

        path = self.temper.alloc_empty_dir('-update')

        self.assertRaises(ValueError, client.checkout2, self.repos_uri, path,
                          None, None, True, True, self.client_ctx)

        client.checkout2(self.repos_uri, path, rev, rev, True, True,
                         self.client_ctx)

        def notify_func(path, action, kind, mime_type, content_state,
                        prop_state, rev):
            self.notified_paths.append(path)

        self.client_ctx.notify_func = client.svn_swig_py_notify_func
        self.client_ctx.notify_baton = notify_func
        rev.value.number = 1
        self.notified_paths = []
        client.update4((path, ), rev, core.svn_depth_unknown, True, False,
                       False, False, False, self.client_ctx)
        expected_paths = [
            path,
            os.path.join(path, 'branches'),
            os.path.join(path, 'tags'),
            os.path.join(path, 'trunk'), path, path
        ]
        # All normal subversion apis process paths in Subversion's canonical format,
        # which isn't the platform specific format
        expected_paths = [x.replace(os.path.sep, '/') for x in expected_paths]
        self.notified_paths.sort()
        expected_paths.sort()

        self.assertEquals(self.notified_paths, expected_paths)

        def notify_func2(notify, pool):
            self.notified_paths.append(notify.path)

        self.client_ctx.notify_func2 = client.svn_swig_py_notify_func2
        self.client_ctx.notify_baton2 = notify_func2
        rev.value.number = 2
        self.notified_paths = []
        expected_paths = [
            path,
            os.path.join(path, 'trunk', 'README.txt'),
            os.path.join(path, 'trunk'), path, path
        ]
        expected_paths = [x.replace(os.path.sep, '/') for x in expected_paths]
        client.update4((path, ), rev, core.svn_depth_unknown, True, False,
                       False, False, False, self.client_ctx)
        self.notified_paths.sort()
        expected_paths.sort()
        self.assertEquals(self.notified_paths, expected_paths)
Exemple #3
0
    def test_update4(self):
        """Test update and the notify function callbacks"""

        rev = core.svn_opt_revision_t()
        rev.kind = core.svn_opt_revision_number
        rev.value.number = 0

        path = self.temper.alloc_empty_dir("-update")

        self.assertRaises(ValueError, client.checkout2, self.repos_uri, path, None, None, True, True, self.client_ctx)

        client.checkout2(self.repos_uri, path, rev, rev, True, True, self.client_ctx)

        def notify_func(path, action, kind, mime_type, content_state, prop_state, rev):
            self.notified_paths.append(path)

        self.client_ctx.notify_func = client.svn_swig_py_notify_func
        self.client_ctx.notify_baton = notify_func
        rev.value.number = 1
        self.notified_paths = []
        client.update4((path,), rev, core.svn_depth_unknown, True, False, False, False, False, self.client_ctx)
        expected_paths = [
            path,
            os.path.join(path, "branches"),
            os.path.join(path, "tags"),
            os.path.join(path, "trunk"),
            path,
            path,
        ]
        # All normal subversion apis process paths in Subversion's canonical format,
        # which isn't the platform specific format
        expected_paths = [x.replace(os.path.sep, "/") for x in expected_paths]
        self.notified_paths.sort()
        expected_paths.sort()

        self.assertEquals(self.notified_paths, expected_paths)

        def notify_func2(notify, pool):
            self.notified_paths.append(notify.path)

        self.client_ctx.notify_func2 = client.svn_swig_py_notify_func2
        self.client_ctx.notify_baton2 = notify_func2
        rev.value.number = 2
        self.notified_paths = []
        expected_paths = [path, os.path.join(path, "trunk", "README.txt"), os.path.join(path, "trunk"), path, path]
        expected_paths = [x.replace(os.path.sep, "/") for x in expected_paths]
        client.update4((path,), rev, core.svn_depth_unknown, True, False, False, False, False, self.client_ctx)
        self.notified_paths.sort()
        expected_paths.sort()
        self.assertEquals(self.notified_paths, expected_paths)