예제 #1
0
파일: client.py 프로젝트: sajeruk/svn_diff
    def test_merge_peg3(self):
        """Test svn_client_merge_peg3."""
        head = core.svn_opt_revision_t()
        head.kind = core.svn_opt_revision_head
        wc_path = self.temper.alloc_empty_dir("-merge_peg3")

        client.checkout3(self.repos_uri, wc_path, head, head, core.svn_depth_infinity, True, False, self.client_ctx)

        # Let's try to backport a change from the v1x branch
        trunk_path = core.svn_dirent_join(wc_path, "trunk")
        v1x_path = core.svn_dirent_join(wc_path, "branches/v1x")

        start = core.svn_opt_revision_t()
        start.kind = core.svn_opt_revision_number
        start.value.number = 8

        end = core.svn_opt_revision_t()
        end.kind = core.svn_opt_revision_number
        end.value.number = 9

        rrange = core.svn_opt_revision_range_t()
        rrange.start = start
        rrange.end = end

        client.merge_peg3(
            v1x_path,
            (rrange,),
            end,
            trunk_path,
            core.svn_depth_infinity,
            False,
            False,
            False,
            False,
            None,
            self.client_ctx,
        )

        # Did it take effect?
        readme_path_native = core.svn_dirent_local_style(core.svn_dirent_join(trunk_path, "README.txt"))

        readme = open(readme_path_native, "r")
        readme_text = readme.read()
        readme.close()

        self.assertEqual(readme_text, "This is a test.\n")
예제 #2
0
  def test_merge_peg3(self):
    """Test svn_client_merge_peg3."""
    head = core.svn_opt_revision_t()
    head.kind = core.svn_opt_revision_head
    wc_path = self.temper.alloc_empty_dir('-merge_peg3')

    client.checkout3(self.repos_uri, wc_path, head, head, core.svn_depth_infinity,
                     True, False, self.client_ctx)

    # Let's try to backport a change from the v1x branch
    trunk_path = core.svn_dirent_join(wc_path, b'trunk')
    v1x_path = core.svn_dirent_join(wc_path, b'branches/v1x')

    start = core.svn_opt_revision_t()
    start.kind = core.svn_opt_revision_number
    start.value.number = 8

    end = core.svn_opt_revision_t()
    end.kind = core.svn_opt_revision_number
    end.value.number = 9

    rrange = core.svn_opt_revision_range_t()
    rrange.start = start
    rrange.end = end

    client.merge_peg3(v1x_path, (rrange,), end, trunk_path,
                      core.svn_depth_infinity, False, False, False, False,
                      None, self.client_ctx)

    # Did it take effect?
    readme_path_native = core.svn_dirent_local_style(
      core.svn_dirent_join(trunk_path, b'README.txt')
    )

    readme = open(readme_path_native, 'rb')
    readme_text = readme.read()
    readme.close()

    self.assertEqual(readme_text,
                     b'This is a test.' + os.linesep.encode('UTF-8'))