Beispiel #1
0
  def test_do_diff2(self):

    class ChangeReceiver(delta.Editor):
        def __init__(self):
            self.textdeltas = []

        def apply_textdelta(self, file_baton, base_checksum):
            def textdelta_handler(textdelta):
                if textdelta is not None:
                    self.textdeltas.append(textdelta)
            return textdelta_handler

    editor = ChangeReceiver()

    e_ptr, e_baton = delta.make_editor(editor)

    fs_revnum = fs.youngest_rev(self.fs)

    sess_url = ra.get_session_url(self.ra_ctx)
    try:
        ra.reparent(self.ra_ctx, REPOS_URL+"/trunk")
        reporter, reporter_baton = ra.do_diff2(self.ra_ctx, fs_revnum,
                                               "README.txt", 0, 0, 1,
                                               REPOS_URL+"/trunk/README.txt",
                                               e_ptr, e_baton)
        reporter.set_path(reporter_baton, "", 0, True, None)
        reporter.finish_report(reporter_baton)
    finally:
        ra.reparent(self.ra_ctx, sess_url)
      
    self.assertEqual("A test.\n", editor.textdeltas[0].new_data)
    self.assertEqual(1, len(editor.textdeltas))
Beispiel #2
0
    def test_do_diff2(self):
        class ChangeReceiver(delta.Editor):
            def __init__(self):
                self.textdeltas = []

            def apply_textdelta(self, file_baton, base_checksum, pool=None):
                def textdelta_handler(textdelta):
                    if textdelta is not None:
                        self.textdeltas.append(textdelta)

                return textdelta_handler

        editor = ChangeReceiver()

        e_ptr, e_baton = delta.make_editor(editor)

        fs_revnum = fs.youngest_rev(self.fs)

        sess_url = ra.get_session_url(self.ra_ctx)
        try:
            ra.reparent(self.ra_ctx, self.repos_uri + "/trunk")
            reporter, reporter_baton = ra.do_diff2(
                self.ra_ctx, fs_revnum, "README.txt", 0, 0, 1,
                self.repos_uri + "/trunk/README.txt", e_ptr, e_baton)
            reporter.set_path(reporter_baton, "", 0, True, None)
            reporter.finish_report(reporter_baton)
        finally:
            ra.reparent(self.ra_ctx, sess_url)

        self.assertEqual("A test.\n", editor.textdeltas[0].new_data)
        self.assertEqual(1, len(editor.textdeltas))
Beispiel #3
0
    def __init__(self,
                 url='',
                 username='',
                 password='',
                 head=None,
                 password_stores=None):
        parsed = common.parse_url(url, username, password)
        # --username and --password override URL credentials
        self.username = parsed[0]
        self.password = parsed[1]
        self.svn_url = core.svn_path_canonicalize(parsed[2])
        self.auth_baton_pool = core.Pool()
        self.auth_baton = _create_auth_baton(self.auth_baton_pool,
                                             password_stores)
        # self.init_ra_and_client() assumes that a pool already exists
        self.pool = core.Pool()

        self.init_ra_and_client()
        self.uuid = ra.get_uuid(self.ra, self.pool)
        self.svn_url = ra.get_session_url(self.ra, self.pool)
        self.root = ra.get_repos_root(self.ra, self.pool)
        assert self.svn_url.startswith(self.root)
        # *will* have a leading '/', would not if we used get_repos_root2
        self.subdir = self.svn_url[len(self.root):]
        if not self.subdir or self.subdir[-1] != '/':
            self.subdir += '/'
        # the RA interface always yields quoted paths, but the editor interface
        # expects unquoted paths
        self.subdir = urllib.unquote(self.subdir)
        self.hasdiff3 = True
        self.autoprops_config = common.AutoPropsConfig()
    def __init__(self, url='', username='', password='', head=None,
                 password_stores=None, meta=None):
        parsed = common.parse_url(url, username, password)
        # --username and --password override URL credentials
        self.username = parsed[0]
        self.password = parsed[1]
        self.svn_url = core.svn_path_canonicalize(parsed[2])
        self.auth_baton_pool = core.Pool()
        self.auth_baton = _create_auth_baton(self.auth_baton_pool, password_stores)
        # self.init_ra_and_client() assumes that a pool already exists
        self.pool = core.Pool()

        self.init_ra_and_client()
        self.uuid = ra.get_uuid(self.ra, self.pool)
        self.svn_url = ra.get_session_url(self.ra, self.pool)
        self.root = ra.get_repos_root(self.ra, self.pool)
        assert self.svn_url.startswith(self.root)
        # *will* have a leading '/', would not if we used get_repos_root2
        self.subdir = self.svn_url[len(self.root):]
        if not self.subdir or self.subdir[-1] != '/':
            self.subdir += '/'
        # the RA interface always yields quoted paths, but the editor interface
        # expects unquoted paths
        self.subdir = urllib.unquote(self.subdir)
        self.hasdiff3 = True
        self.autoprops_config = common.AutoPropsConfig()

        # store the svn meta object for use with branch skipping
        self.meta = meta