コード例 #1
0
    def test_01_under_then_over(self):
        repo = self.create_repo()
        conf = repo.conf

        dot()
        conf.set_max_file_size_in_bytes(1024)

        svn = repo.svn
        #evnadmin = repo.evnadmin
        #evnadmin.enable_remote_debug(repo.path, hook='pre-commit')

        dot()
        tree = { '512-then-1025-bytes.txt': bulk_chargen(512) }
        repo.build(tree, prefix='trunk')

        with chdir(repo.wc):
            dot()
            svn.add('trunk/512-then-1025-bytes.txt')
            svn.ci('trunk', m='Permitted...')

        dot()
        tree = { '512-then-1025-bytes.txt': bulk_chargen(1025) }
        repo.build(tree, prefix='trunk')

        error = format_file_exceeds_max_size_error(1025, 1024)
        with chdir(repo.wc):
            dot()
            with ensure_blocked(self, error):
                svn.ci('trunk', m='At limit')
コード例 #2
0
    def test_03_rename(self):
        repo = self.create_repo()
        conf = repo.conf
        svn = repo.svn

        dot()
        tree = {
            'test.txt': bulk_chargen(100),
        }
        repo.build(tree, prefix='trunk')

        with chdir(repo.wc):
            dot()
            svn.add('trunk/test.txt')
            dot()
            svn.ci('trunk/test.txt', m='Adding test.txt...')

        dot()
        error = e.BlockedFileExtension
        with chdir(repo.wc):
            svn.mv('trunk/test.txt', 'trunk/test.dll')
            dot()
            with ensure_blocked(self, error):
                svn.ci('trunk', m='Renaming test.txt to test.dll...')
                dot()
コード例 #3
0
    def test_03_rename(self):
        repo = self.create_repo()
        conf = repo.conf
        svn = repo.svn

        dot()
        tree = {
            'test.txt': bulk_chargen(100),
        }
        repo.build(tree, prefix='trunk')

        with chdir(repo.wc):
            dot()
            svn.add('trunk/test.txt')
            dot()
            svn.ci('trunk/test.txt', m='Adding test.txt...')

        dot()
        error = e.BlockedFileExtension
        with chdir(repo.wc):
            svn.mv('trunk/test.txt', 'trunk/test.dll')
            dot()
            with ensure_blocked(self, error):
                svn.ci('trunk', m='Renaming test.txt to test.dll...')
                dot()
コード例 #4
0
    def test_04_existing_file_modified_over_limit(self):
        repo = self.create_repo()
        conf = repo.conf
        pattern = '\.txt$'

        dot()
        conf.set_max_file_size_exclusion_regex(pattern)
        conf.set_max_file_size_in_bytes(1024)

        svn = repo.svn
        #evnadmin = repo.evnadmin
        #evnadmin.enable_remote_debug(repo.path, hook='pre-commit')

        dot()
        tree = { '512-then-1025-bytes.txt': bulk_chargen(512) }
        repo.build(tree, prefix='trunk')

        with chdir(repo.wc):
            dot()
            svn.add('trunk/512-then-1025-bytes.txt')
            svn.ci('trunk', m='Permitted...')

        dot()
        tree = { '512-then-1025-bytes.txt': bulk_chargen(1025) }
        repo.build(tree, prefix='trunk')

        with chdir(repo.wc):
            dot()
            svn.ci('trunk', m='Permitted...')
コード例 #5
0
    def test_01_under_then_over(self):
        repo = self.create_repo()
        conf = repo.conf

        dot()
        conf.set_max_file_size_in_bytes(1024)

        svn = repo.svn
        #evnadmin = repo.evnadmin
        #evnadmin.enable_remote_debug(repo.path, hook='pre-commit')

        dot()
        tree = {'512-then-1025-bytes.txt': bulk_chargen(512)}
        repo.build(tree, prefix='trunk')

        with chdir(repo.wc):
            dot()
            svn.add('trunk/512-then-1025-bytes.txt')
            svn.ci('trunk', m='Permitted...')

        dot()
        tree = {'512-then-1025-bytes.txt': bulk_chargen(1025)}
        repo.build(tree, prefix='trunk')

        error = format_file_exceeds_max_size_error(1025, 1024)
        with chdir(repo.wc):
            dot()
            with ensure_blocked(self, error):
                svn.ci('trunk', m='At limit')
コード例 #6
0
    def test_04_existing_file_modified_over_limit(self):
        repo = self.create_repo()
        conf = repo.conf
        pattern = '\.txt$'

        dot()
        conf.set_max_file_size_exclusion_regex(pattern)
        conf.set_max_file_size_in_bytes(1024)

        svn = repo.svn
        #evnadmin = repo.evnadmin
        #evnadmin.enable_remote_debug(repo.path, hook='pre-commit')

        dot()
        tree = {'512-then-1025-bytes.txt': bulk_chargen(512)}
        repo.build(tree, prefix='trunk')

        with chdir(repo.wc):
            dot()
            svn.add('trunk/512-then-1025-bytes.txt')
            svn.ci('trunk', m='Permitted...')

        dot()
        tree = {'512-then-1025-bytes.txt': bulk_chargen(1025)}
        repo.build(tree, prefix='trunk')

        with chdir(repo.wc):
            dot()
            svn.ci('trunk', m='Permitted...')
コード例 #7
0
    def test_02_set_repo_readonly(self):
        repo = self.create_repo()
        svn = repo.svn
        evnadmin = repo.evnadmin

        is_repo_readonly = evnadmin.is_repo_readonly
        set_repo_readonly = evnadmin.set_repo_readonly
        unset_repo_readonly = evnadmin.unset_repo_readonly

        dot()
        expected = 'no'
        actual = is_repo_readonly(repo.path)
        self.assertEqual(expected, actual)

        tree = {'test1.txt': bulk_chargen(100)}
        repo.build(tree, prefix='trunk')

        dot()
        with chdir(repo.wc):
            dot()
            svn.add('trunk/test1.txt')
            dot()
            svn.ci('trunk', m='Adding test1.txt')

        dot()
        set_repo_readonly(repo.path)

        dot()
        expected = 'yes'
        actual = is_repo_readonly(repo.path)
        self.assertEqual(expected, actual)

        dot()
        tree = {
            'test2.txt': bulk_chargen(200),
        }
        repo.build(tree, prefix='trunk')

        error = 'This repository cannot be committed to at the present time'
        with ensure_blocked(self, error):
            with chdir(repo.wc):
                dot()
                svn.add('trunk/test2.txt')
                dot()
                svn.ci('trunk', m='Adding test2.txt')

        dot()
        unset_repo_readonly(repo.path)

        dot()
        expected = 'no'
        actual = is_repo_readonly(repo.path)
        self.assertEqual(expected, actual)

        dot()
        with chdir(repo.wc):
            dot()
            dot()
            svn.ci('trunk', m='Adding test2.txt')
コード例 #8
0
    def test_02_set_repo_readonly(self):
        repo = self.create_repo()
        svn = repo.svn
        evnadmin = repo.evnadmin

        is_repo_readonly = evnadmin.is_repo_readonly
        set_repo_readonly = evnadmin.set_repo_readonly
        unset_repo_readonly = evnadmin.unset_repo_readonly

        dot()
        expected = "no"
        actual = is_repo_readonly(repo.path)
        self.assertEqual(expected, actual)

        tree = {"test1.txt": bulk_chargen(100)}
        repo.build(tree, prefix="trunk")

        dot()
        with chdir(repo.wc):
            dot()
            svn.add("trunk/test1.txt")
            dot()
            svn.ci("trunk", m="Adding test1.txt")

        dot()
        set_repo_readonly(repo.path)

        dot()
        expected = "yes"
        actual = is_repo_readonly(repo.path)
        self.assertEqual(expected, actual)

        dot()
        tree = {"test2.txt": bulk_chargen(200)}
        repo.build(tree, prefix="trunk")

        error = "This repository cannot be committed to at the present time"
        with ensure_blocked(self, error):
            with chdir(repo.wc):
                dot()
                svn.add("trunk/test2.txt")
                dot()
                svn.ci("trunk", m="Adding test2.txt")

        dot()
        unset_repo_readonly(repo.path)

        dot()
        expected = "no"
        actual = is_repo_readonly(repo.path)
        self.assertEqual(expected, actual)

        dot()
        with chdir(repo.wc):
            dot()
            dot()
            svn.ci("trunk", m="Adding test2.txt")
コード例 #9
0
    def test_01_wc(self):
        repo = self.create_repo()
        conf = repo.conf
        svn = repo.svn

        dot()
        with chdir(repo.wc):
            svn.copy('trunk', 'tags/1.0')
            svn.ci('tags', m='Tag trunk')

        error = 'known root path copied to known root subtree path'
        with chdir(repo.wc):
            with ensure_blocked(self, error):
                svn.copy('trunk', 'tags/1.0')
                svn.ci('tags/1.0', m='Incorrect copy')
    def test_01_wc(self):
        repo = self.create_repo()
        conf = repo.conf
        svn = repo.svn

        dot()
        with chdir(repo.wc):
            svn.copy('trunk', 'tags/1.0')
            svn.ci('tags', m='Tag trunk')

        error = 'known root path copied to known root subtree path'
        with chdir(repo.wc):
            with ensure_blocked(self, error):
                svn.copy('trunk', 'tags/1.0')
                svn.ci('tags/1.0', m='Incorrect copy')
コード例 #11
0
    def test_04_rm_standard_layout(self):
        """
        Given:
            /trunk/
            /tags/
            /branches/
        Make sure we can't rmdir any of the paths.
        """
        repo = self.create_repo()
        svn = repo.svn

        expected = conf.standard_layout
        raw = svn.ls(repo.uri)
        actual = frozenset(format_dir(l) for l in raw.splitlines())
        self.assertEqual(expected, actual)
        dot()

        error = e.TopLevelRepoDirectoryRemoved
        paths = [p.replace('/', '') for p in conf.standard_layout]
        with chdir(repo.wc):
            for path in paths:
                dot()
                svn.rm(path)
                with ensure_blocked(self, error):
                    svn.ci(path)
コード例 #12
0
    def test_04_rm_standard_layout(self):
        """
        Given:
            /trunk/
            /tags/
            /branches/
        Make sure we can't rmdir any of the paths.
        """
        repo = self.create_repo()
        svn = repo.svn

        expected = conf.standard_layout
        raw = svn.ls(repo.uri)
        actual = frozenset(format_dir(l) for l in raw.splitlines())
        self.assertEqual(expected, actual)
        dot()

        error = e.TopLevelRepoDirectoryRemoved
        paths = [ p.replace('/', '') for p in conf.standard_layout ]
        with chdir(repo.wc):
            for path in paths:
                dot()
                svn.rm(path)
                with ensure_blocked(self, error):
                    svn.ci(path)
コード例 #13
0
ファイル: test_root_hints.py プロジェクト: tpn/enversion
    def test_01(self):
        repo = self.create_repo()
        svn = repo.svn
        evnadmin = repo.evnadmin

        # Disable so we can mkdir ^/other
        dot()
        evnadmin.disable(repo.path)
        svn.mkdir(repo.ra('/other/'), m='Creating other directory')
        evnadmin.add_root_exclusion(
            repo.name,
            root_exclusion='/[abcdo]{1,1}the.*',
        )

        dot()
        evnadmin.enable(repo.path)
        svn.cp(repo.ra('/trunk/'), repo.ra('/branches/1.x/'), m='Branching')
        svn.cp(repo.ra('/branches/1.x/'), repo.ra('/tags/1.0/'), m='Tagging')

        # Lazy (quick) test of roots.
        dot()
        expected_roots = set(('/trunk/', '/branches/1.x/', '/tags/1.0/'))
        actual_roots = set(repo.roots.keys())
        self.assertEqual(expected_roots, actual_roots)

        # Add ourselves as a repo admin so that we can force through the next
        # commit.
        dot()
        evnadmin.add_repo_admin(repo.name, username=svn.username)
        expected = 'yes'
        actual = evnadmin.is_repo_admin(repo.name, username=svn.username)
        self.assertEqual(expected, actual)

        dot()
        with chdir(repo.wc):
            svn.up()
            svn.mv('trunk', 'other/foobar')
            svn.mv('branches/1.x', 'other/1.x')
            svn.mv('tags/1.0', 'other/1.0')
            svn.ci(m='IGNORE ERRORS')

        evn_props_r5_expected = {
            'errors': {
                '/other/1.0/': [
                    'tag renamed',
                    'known root path renamed to unknown path',
                ],
                '/other/1.x/': [
                    'known root path renamed to unknown path',
                    'branch renamed to unknown',
                ],
                '/other/foobar/': [
                    'known root path renamed to unknown path',
                    'trunk renamed to unknown path',
                ],
            },
            'roots': {}
        }
        self.assertEqual(repo.revprops_at(5)['evn'], evn_props_r5_expected)
コード例 #14
0
    def test_01(self):
        repo = self.create_repo()
        svn = repo.svn
        evnadmin = repo.evnadmin

        # Disable so we can mkdir ^/other
        dot()
        evnadmin.disable(repo.path)
        svn.mkdir(repo.ra('/other/'), m='Creating other directory')
        evnadmin.add_root_exclusion(
            repo.name,
            root_exclusion='/[abcdo]{1,1}the.*',
        )

        dot()
        evnadmin.enable(repo.path)
        svn.cp(repo.ra('/trunk/'), repo.ra('/branches/1.x/'), m='Branching')
        svn.cp(repo.ra('/branches/1.x/'), repo.ra('/tags/1.0/'), m='Tagging')

        # Lazy (quick) test of roots.
        dot()
        expected_roots = set(('/trunk/', '/branches/1.x/', '/tags/1.0/'))
        actual_roots = set(repo.roots.keys())
        self.assertEqual(expected_roots, actual_roots)

        # Add ourselves as a repo admin so that we can force through the next
        # commit.
        dot()
        evnadmin.add_repo_admin(repo.name, username=svn.username)
        expected = 'yes'
        actual = evnadmin.is_repo_admin(repo.name, username=svn.username)
        self.assertEqual(expected, actual)

        dot()
        with chdir(repo.wc):
            svn.up()
            svn.mv('trunk', 'other/foobar')
            svn.mv('branches/1.x', 'other/1.x')
            svn.mv('tags/1.0', 'other/1.0')
            svn.ci(m='IGNORE ERRORS')

        evn_props_r5_expected = {
            'errors': {
                '/other/1.0/': [
                    'tag renamed',
                    'known root path renamed to unknown path',
                ],
                '/other/1.x/': [
                    'known root path renamed to unknown path',
                    'branch renamed to unknown',
                ],
                '/other/foobar/': [
                    'known root path renamed to unknown path',
                    'trunk renamed to unknown path',
                ],
            },
            'roots': { }
        }
        self.assertEqual(repo.revprops_at(5)['evn'], evn_props_r5_expected)
コード例 #15
0
    def test_01_basic(self):
        """
        Make sure trunk can't be re-copied within a branch.
        Reported by: @jamieechlin
        """
        repo = self.create_repo()
        svn = repo.svn
        evnadmin = repo.evnadmin

        dot()
        roots_r1 = {
            '/trunk/': {
                'copies': {},
                'created': 1,
                'creation_method': 'created',
            }
        }
        self.assertEqual(roots_r1, repo.roots)

        dot()
        with chdir(repo.wc):
            svn.cp('trunk', 'branches/1.x')
            svn.ci(m='Branching 1.x.')

        roots_r2 = {
            '/trunk/': { 'created': 1 },
            '/branches/1.x/': {
                'copied_from': ('/trunk/', 1),
                'copies': {},
                'created': 2,
                'creation_method': 'copied',
                'errors': []
            },
        }
        self.assertEqual(roots_r2, repo.roots)

        dot()
        error = 'known root path copied to known root subtree path'
        with chdir(repo.wc):
            svn.cp('trunk', 'branches/1.x')
            with ensure_blocked(self, error):
                svn.ci('branches/1.x', m='Copying trunk to branches/1.x.')
コード例 #16
0
ファイル: test_custom_hooks.py プロジェクト: tpn/enversion
    def test_01_tag_and_branch_creation_detection(self):
        repo = self.create_repo()
        conf = repo.conf
        conf.set_custom_hook_classname(self.classname)
        svn = repo.svn

        #evnadmin = repo.evnadmin
        #evnadmin.enable_remote_debug(repo.path, hook='pre-commit')

        error = 'is_branch_create: /branches/1.x/'
        with chdir(repo.wc):
            svn.cp('trunk', 'branches/1.x')
            with ensure_blocked(self, error):
                svn.ci('branches/1.x', m='Branching...')

        dot()
        error = 'is_tag_create: /tags/1.1/'
        with chdir(repo.wc):
            svn.cp('trunk', 'tags/1.1')
            with ensure_blocked(self, error):
                svn.ci('tags/1.1', m='Tagging...')
def make_std_layout(repo, components=None):
    conf = repo.conf
    svn = repo.svn
    if not components:
        components = ('foo', 'bar')
    paths = [ p.replace('/', '') for p in conf.standard_layout ]
    with chdir(repo.wc):
        for component in components:
            svn.mkdir(component)
            for path in paths:
                dot()
                target = '/'.join((component, path))
                svn.mkdir(target)
            svn.ci(component)
    def test_01_wc_when_enabled(self):
        # This appears to be blocked by svn.exe with an error message along
        # the lines of:
        #   Cannot copy path '/trunk' into its own child '/trunk/foo'
        repo = self.create_repo()
        conf = repo.conf
        svn = repo.svn

        error = 'Cannot copy path'
        dot()
        with chdir(repo.wc):
            with ensure_blocked(self, error):
                svn.copy('trunk', 'trunk/foo')
                svn.ci('trunk', m='Copy trunk')
コード例 #19
0
    def test_01_wc_when_enabled(self):
        # This appears to be blocked by svn.exe with an error message along
        # the lines of:
        #   Cannot copy path '/trunk' into its own child '/trunk/foo'
        repo = self.create_repo()
        conf = repo.conf
        svn = repo.svn

        error = 'Cannot copy path'
        dot()
        with chdir(repo.wc):
            with ensure_blocked(self, error):
                svn.copy('trunk', 'trunk/foo')
                svn.ci('trunk', m='Copy trunk')
コード例 #20
0
def make_std_layout(repo, components=None):
    conf = repo.conf
    svn = repo.svn
    if not components:
        components = ('foo', 'bar')
    paths = [p.replace('/', '') for p in conf.standard_layout]
    with chdir(repo.wc):
        for component in components:
            svn.mkdir(component)
            for path in paths:
                dot()
                target = '/'.join((component, path))
                svn.mkdir(target)
            svn.ci(component)
コード例 #21
0
    def test_01_block_unrelated_component_interaction(self):
        """
        If foo/trunk or foo/branches/* is being copied, make sure the dest is
        also rooted in either foo/branches or foo/tags.
        """
        repo = self.create_repo(multi=True)
        svn = repo.svn

        error = 'component root path copied to unrelated component'
        paths = [p.replace('/', '') for p in conf.standard_layout]
        with chdir(repo.wc):
            for component in ('foo', 'bar'):
                svn.mkdir(component)
                for path in paths:
                    dot()
                    target = '/'.join((component, path))
                    svn.mkdir(target)
                svn.ci(component)

            dot()
            svn.cp('foo/trunk', 'foo/branches/1.x')
            svn.ci()

            dot()
            svn.cp('foo/branches/1.x', 'foo/tags/1.0')
            svn.ci()

            dot()
            svn.up()

            dot()
            svn.cp('foo/trunk', 'bar/branches/1.x')
            with ensure_blocked(self, error):
                svn.ci('bar')

            dot()
            svn.cp('foo/branches/1.x', 'bar/branches/1.x')
            with ensure_blocked(self, error):
                svn.ci('bar')

            dot()
            svn.cp('foo/tags/1.0', 'bar/branches/1.x')
            with ensure_blocked(self, error):
                svn.ci('bar')

            dot()
            svn.cp('foo/tags/1.0', 'bar/tags/1.0')
            with ensure_blocked(self, error):
                svn.ci('bar')
コード例 #22
0
    def test_01_block_unrelated_component_interaction(self):
        """
        If foo/trunk or foo/branches/* is being copied, make sure the dest is
        also rooted in either foo/branches or foo/tags.
        """
        repo = self.create_repo(multi=True)
        svn = repo.svn

        error = 'component root path copied to unrelated component'
        paths = [ p.replace('/', '') for p in conf.standard_layout ]
        with chdir(repo.wc):
            for component in ('foo', 'bar'):
                svn.mkdir(component)
                for path in paths:
                    dot()
                    target = '/'.join((component, path))
                    svn.mkdir(target)
                svn.ci(component)

            dot()
            svn.cp('foo/trunk', 'foo/branches/1.x')
            svn.ci()

            dot()
            svn.cp('foo/branches/1.x', 'foo/tags/1.0')
            svn.ci()

            dot()
            svn.up()

            dot()
            svn.cp('foo/trunk', 'bar/branches/1.x')
            with ensure_blocked(self, error):
                svn.ci('bar')

            dot()
            svn.cp('foo/branches/1.x', 'bar/branches/1.x')
            with ensure_blocked(self, error):
                svn.ci('bar')

            dot()
            svn.cp('foo/tags/1.0', 'bar/branches/1.x')
            with ensure_blocked(self, error):
                svn.ci('bar')

            dot()
            svn.cp('foo/tags/1.0', 'bar/tags/1.0')
            with ensure_blocked(self, error):
                svn.ci('bar')
コード例 #23
0
    def test_01_creation(self):
        """
        Create a repository with component-depth support disabled, then create
        various levels of directories that would be blocked by simple/multi
        component layouts.
        """
        repo = self.create_repo(component_depth='-1')
        svn = repo.svn

        actual = svn.ls(repo.uri)
        self.assertEqual('', actual)
        dot()

        paths = [p.replace('/', '') for p in conf.standard_layout]
        with chdir(repo.wc):
            for path in paths:
                dot()
                svn.mkdir(path)
                svn.ci(path)

            dot()
            svn.mkdir('foo')
            svn.mkdir('foo/bar')
            svn.ci('foo')

            dot()
            svn.mkdir('foo/trunk')
            svn.ci('foo/trunk')

            dot()
            svn.up()
            svn.cp('foo/trunk', 'branches/foo-1.x')
            svn.ci(m='Branching 1.x')

            dot()
            svn.mkdir('viper')
            svn.mkdir('viper/eagle')
            svn.mkdir('viper/eagle/tomcat')
            svn.ci('viper')

            dot()
            svn.mkdir('fulcrum')
            svn.mkdir('fulcrum/flanker')
            svn.mkdir('fulcrum/flanker/foxbat')
            svn.mkdir('fulcrum/flanker/foxbat/tags')
            svn.mkdir('fulcrum/flanker/foxbat/trunk')
            svn.mkdir('fulcrum/flanker/foxbat/branches')
            svn.ci('fulcrum')
コード例 #24
0
    def test_01_creation(self):
        """
        Create a repository with component-depth support disabled, then create
        various levels of directories that would be blocked by simple/multi
        component layouts.
        """
        repo = self.create_repo(component_depth='-1')
        svn = repo.svn

        actual = svn.ls(repo.uri)
        self.assertEqual('', actual)
        dot()

        paths = [ p.replace('/', '') for p in conf.standard_layout ]
        with chdir(repo.wc):
            for path in paths:
                dot()
                svn.mkdir(path)
                svn.ci(path)

            dot()
            svn.mkdir('foo')
            svn.mkdir('foo/bar')
            svn.ci('foo')

            dot()
            svn.mkdir('foo/trunk')
            svn.ci('foo/trunk')

            dot()
            svn.up()
            svn.cp('foo/trunk', 'branches/foo-1.x')
            svn.ci(m='Branching 1.x')

            dot()
            svn.mkdir('viper')
            svn.mkdir('viper/eagle')
            svn.mkdir('viper/eagle/tomcat')
            svn.ci('viper')

            dot()
            svn.mkdir('fulcrum')
            svn.mkdir('fulcrum/flanker')
            svn.mkdir('fulcrum/flanker/foxbat')
            svn.mkdir('fulcrum/flanker/foxbat/tags')
            svn.mkdir('fulcrum/flanker/foxbat/trunk')
            svn.mkdir('fulcrum/flanker/foxbat/branches')
            svn.ci('fulcrum')
コード例 #25
0
    def test_03_no_svnmucc__commit_together(self):
        """
        Create an empty repo via `evnadmin create --no-svnmucc`, then issue
        three mkdirs followed by a single commit for:
            /trunk/
            /tags/
            /branches/
        """
        repo = self.create_repo(no_svnmucc=True)
        svn = repo.svn

        with chdir(repo.wc):
            for d in conf.standard_layout:
                # Lop-off the leading '/'.
                svn.mkdir(d[1:])
            svn.ci()
            dot()
コード例 #26
0
    def test_03_component_standard_layout_allowed(self):
        """
        Ensure top-level standard layout directories can be created if they're
        housed under a component.
        """
        repo = self.create_repo(multi=True)
        svn = repo.svn

        paths = [p.replace('/', '') for p in conf.standard_layout]
        with chdir(repo.wc):
            for component in ('foo', 'bar'):
                svn.mkdir(component)
                for path in paths:
                    dot()
                    target = '/'.join((component, path))
                    svn.mkdir(target)
                svn.ci(component)
コード例 #27
0
    def test_03_component_standard_layout_allowed(self):
        """
        Ensure top-level standard layout directories can be created if they're
        housed under a component.
        """
        repo = self.create_repo(multi=True)
        svn = repo.svn

        paths = [ p.replace('/', '') for p in conf.standard_layout ]
        with chdir(repo.wc):
            for component in ('foo', 'bar'):
                svn.mkdir(component)
                for path in paths:
                    dot()
                    target = '/'.join((component, path))
                    svn.mkdir(target)
                svn.ci(component)
コード例 #28
0
    def test_03_no_svnmucc__commit_together(self):
        """
        Create an empty repo via `evnadmin create --no-svnmucc`, then issue
        three mkdirs followed by a single commit for:
            /trunk/
            /tags/
            /branches/
        """
        repo = self.create_repo(no_svnmucc=True)
        svn = repo.svn

        with chdir(repo.wc):
            for d in conf.standard_layout:
                # Lop-off the leading '/'.
                svn.mkdir(d[1:])
            svn.ci()
            dot()
コード例 #29
0
    def test_02_standard_layout_blocked(self):
        """
        Ensure top-level standard layout directories can't be created.
        """
        repo = self.create_repo(multi=True)
        svn = repo.svn

        actual = svn.ls(repo.uri)
        self.assertEqual('', actual)

        error = e.StandardLayoutTopLevelDirectoryCreatedInMultiComponentRepo
        paths = [ p.replace('/', '') for p in conf.standard_layout ]
        with chdir(repo.wc):
            for path in paths:
                dot()
                svn.mkdir(path)
                with ensure_blocked(self, error):
                    svn.ci(path)
コード例 #30
0
    def test_02_standard_layout_blocked(self):
        """
        Ensure top-level standard layout directories can't be created.
        """
        repo = self.create_repo(multi=True)
        svn = repo.svn

        actual = svn.ls(repo.uri)
        self.assertEqual('', actual)

        error = e.StandardLayoutTopLevelDirectoryCreatedInMultiComponentRepo
        paths = [p.replace('/', '') for p in conf.standard_layout]
        with chdir(repo.wc):
            for path in paths:
                dot()
                svn.mkdir(path)
                with ensure_blocked(self, error):
                    svn.ci(path)
コード例 #31
0
    def test_04_block_two_deep_non_standard_dirs(self):
        """
        Prevent any two-level deep directories from being created if they're
        not a standard directory.
        """
        repo = self.create_repo(multi=True)
        svn = repo.svn

        error = e.InvalidTopLevelRepoComponentDirectoryCreated
        paths = [p.replace('/', '') for p in conf.standard_layout]
        with chdir(repo.wc):
            dot()
            svn.mkdir('foo')
            svn.ci()

            dot()
            svn.mkdir('foo/bar')
            with ensure_blocked(self, error):
                svn.ci()
コード例 #32
0
    def test_04_block_two_deep_non_standard_dirs(self):
        """
        Prevent any two-level deep directories from being created if they're
        not a standard directory.
        """
        repo = self.create_repo(multi=True)
        svn = repo.svn

        error = e.InvalidTopLevelRepoComponentDirectoryCreated
        paths = [ p.replace('/', '') for p in conf.standard_layout ]
        with chdir(repo.wc):
            dot()
            svn.mkdir('foo')
            svn.ci()

            dot()
            svn.mkdir('foo/bar')
            with ensure_blocked(self, error):
                svn.ci()
コード例 #33
0
    def test_02_add_new(self):
        repo = self.create_repo()
        conf = repo.conf
        svn = repo.svn

        #evnadmin = repo.evnadmin
        #evnadmin.enable_remote_debug(repo.path, hook='pre-commit')

        dot()
        tree = {
            'test.dll': bulk_chargen(100),
        }
        repo.build(tree, prefix='trunk')

        error = e.BlockedFileExtension
        with chdir(repo.wc):
            dot()
            svn.add('trunk/test.dll')
            with ensure_blocked(self, error):
                svn.ci('trunk/test.dll', m='Adding test.dll...')
コード例 #34
0
    def test_02_add_new(self):
        repo = self.create_repo()
        conf = repo.conf
        svn = repo.svn

        #evnadmin = repo.evnadmin
        #evnadmin.enable_remote_debug(repo.path, hook='pre-commit')

        dot()
        tree = {
            'test.dll': bulk_chargen(100),
        }
        repo.build(tree, prefix='trunk')

        error = e.BlockedFileExtension
        with chdir(repo.wc):
            dot()
            svn.add('trunk/test.dll')
            with ensure_blocked(self, error):
                svn.ci('trunk/test.dll', m='Adding test.dll...')
コード例 #35
0
    def test_01_over_limit(self):
        repo = self.create_repo()
        conf = repo.conf
        conf.set_max_file_size_in_bytes(1024)

        svn = repo.svn

        #evnadmin = repo.evnadmin
        #evnadmin.enable_remote_debug(repo.path, hook='pre-commit')

        dot()
        over = 1025
        tree = { 'over.txt': bulk_chargen(over) }
        repo.build(tree, prefix='trunk')

        error = format_file_exceeds_max_size_error(over, 1024)
        with chdir(repo.wc):
            dot()
            svn.add('trunk/over.txt')
            with ensure_blocked(self, error):
                svn.ci('trunk', m='Over limit')
コード例 #36
0
    def test_02_no_svnmucc__commit_individually(self):
        """
        Create an empty repo via `evnadmin create --no-svnmucc`, then issue
        three individual mkdirs then commits for:
            /trunk/
            /tags/
            /branches/
        """
        repo = self.create_repo(no_svnmucc=True)
        svn = repo.svn

        actual = svn.ls(repo.uri)
        self.assertEqual('', actual)
        dot()

        for d in conf.standard_layout:
            with chdir(repo.wc):
                # Lop-off the leading '/'.
                svn.mkdir(d[1:])
                svn.ci()
                dot()
コード例 #37
0
    def test_01_over_limit(self):
        repo = self.create_repo()
        conf = repo.conf
        conf.set_max_file_size_in_bytes(1024)

        svn = repo.svn

        #evnadmin = repo.evnadmin
        #evnadmin.enable_remote_debug(repo.path, hook='pre-commit')

        dot()
        over = 1025
        tree = {'over.txt': bulk_chargen(over)}
        repo.build(tree, prefix='trunk')

        error = format_file_exceeds_max_size_error(over, 1024)
        with chdir(repo.wc):
            dot()
            svn.add('trunk/over.txt')
            with ensure_blocked(self, error):
                svn.ci('trunk', m='Over limit')
コード例 #38
0
    def test_02_non_exempt(self):
        repo = self.create_repo()
        conf = repo.conf
        conf.set('main', 'exempt-symlinks-from-blocked-file-extensions', '0')
        conf.save()
        svn = repo.svn

        dot()
        self.assertFalse(conf.exempt_symlinks_from_blocked_file_extensions)

        dot()
        tree = { 'target': bulk_chargen(100) }
        repo.build(tree, prefix='trunk')
        trunk = join_path(repo.wc, 'trunk')
        error = e.BlockedFileExtension
        with chdir(trunk):
            dot()
            os.symlink('target', 'target.so')
            svn.add('target.so')
            with ensure_blocked(self, error):
                svn.ci('target.so', m='Adding symlink.')
コード例 #39
0
    def test_02_non_exempt(self):
        repo = self.create_repo()
        conf = repo.conf
        conf.set('main', 'exempt-symlinks-from-blocked-file-extensions', '0')
        conf.save()
        svn = repo.svn

        dot()
        self.assertFalse(conf.exempt_symlinks_from_blocked_file_extensions)

        dot()
        tree = {'target': bulk_chargen(100)}
        repo.build(tree, prefix='trunk')
        trunk = join_path(repo.wc, 'trunk')
        error = e.BlockedFileExtension
        with chdir(trunk):
            dot()
            os.symlink('target', 'target.so')
            svn.add('target.so')
            with ensure_blocked(self, error):
                svn.ci('target.so', m='Adding symlink.')
コード例 #40
0
    def test_02_no_svnmucc__commit_individually(self):
        """
        Create an empty repo via `evnadmin create --no-svnmucc`, then issue
        three individual mkdirs then commits for:
            /trunk/
            /tags/
            /branches/
        """
        repo = self.create_repo(no_svnmucc=True)
        svn = repo.svn

        actual = svn.ls(repo.uri)
        self.assertEqual('', actual)
        dot()

        for d in conf.standard_layout:
            with chdir(repo.wc):
                # Lop-off the leading '/'.
                svn.mkdir(d[1:])
                svn.ci()
                dot()
コード例 #41
0
    def test_01_exempt(self):
        repo = self.create_repo()
        conf = repo.conf
        svn = repo.svn

        dot()
        self.assertTrue(conf.exempt_symlinks_from_blocked_file_extensions)

        #evnadmin = repo.evnadmin
        #evnadmin.enable_remote_debug(repo.path, hook='pre-commit')

        dot()
        tree = { 'target': bulk_chargen(100) }
        repo.build(tree, prefix='trunk')
        trunk = join_path(repo.wc, 'trunk')
        error = e.BlockedFileExtension
        with chdir(trunk):
            dot()
            os.symlink('target', 'target.so')
            self.assertTrue(os.path.islink('target.so'))
            svn.add('target')
            svn.add('target.so')
            svn.ci('.', m='Adding target + symlink.')

            dot()
            svn.mv('target', 'target.dll')
            with ensure_blocked(self, error):
                svn.ci('.', m='Renaming target...')

            dot()
            svn.revert('target', 'target.dll')

            dot()
            os.rename('target.so', 'target.exe')
            self.assertTrue(os.path.islink('target.exe'))
            #evnadmin = repo.evnadmin
            #evnadmin.enable_remote_debug(repo.path, hook='pre-commit')
            svn.rm('target.so')
            svn.add('target.exe')
            svn.ci('.', m='Renaming target.so to target.exe.')
コード例 #42
0
    def test_01_exempt(self):
        repo = self.create_repo()
        conf = repo.conf
        svn = repo.svn

        dot()
        self.assertTrue(conf.exempt_symlinks_from_blocked_file_extensions)

        #evnadmin = repo.evnadmin
        #evnadmin.enable_remote_debug(repo.path, hook='pre-commit')

        dot()
        tree = {'target': bulk_chargen(100)}
        repo.build(tree, prefix='trunk')
        trunk = join_path(repo.wc, 'trunk')
        error = e.BlockedFileExtension
        with chdir(trunk):
            dot()
            os.symlink('target', 'target.so')
            self.assertTrue(os.path.islink('target.so'))
            svn.add('target')
            svn.add('target.so')
            svn.ci('.', m='Adding target + symlink.')

            dot()
            svn.mv('target', 'target.dll')
            with ensure_blocked(self, error):
                svn.ci('.', m='Renaming target...')

            dot()
            svn.revert('target', 'target.dll')

            dot()
            os.rename('target.so', 'target.exe')
            self.assertTrue(os.path.islink('target.exe'))
            #evnadmin = repo.evnadmin
            #evnadmin.enable_remote_debug(repo.path, hook='pre-commit')
            svn.rm('target.so')
            svn.add('target.exe')
            svn.ci('.', m='Renaming target.so to target.exe.')
コード例 #43
0
    def test_01_under_limit(self):
        repo = self.create_repo()
        conf = repo.conf
        conf.set_max_file_size_in_bytes(1024)

        svn = repo.svn

        #evnadmin = repo.evnadmin
        #evnadmin.enable_remote_debug(repo.path, hook='pre-commit')

        dot()
        tree = {
            '1000-bytes.txt': bulk_chargen(1000),
            '1023-bytes.txt': bulk_chargen(1023),
        }
        repo.build(tree, prefix='trunk')

        with chdir(repo.wc):
            dot()
            svn.add('trunk/1000-bytes.txt')
            dot()
            svn.add('trunk/1023-bytes.txt')
            svn.ci('trunk', m='Adding files under limit...')
コード例 #44
0
    def test_01_under_limit(self):
        repo = self.create_repo()
        conf = repo.conf
        conf.set_max_file_size_in_bytes(1024)

        svn = repo.svn

        #evnadmin = repo.evnadmin
        #evnadmin.enable_remote_debug(repo.path, hook='pre-commit')

        dot()
        tree = {
            '1000-bytes.txt': bulk_chargen(1000),
            '1023-bytes.txt': bulk_chargen(1023),
        }
        repo.build(tree, prefix='trunk')

        with chdir(repo.wc):
            dot()
            svn.add('trunk/1000-bytes.txt')
            dot()
            svn.add('trunk/1023-bytes.txt')
            svn.ci('trunk', m='Adding files under limit...')
コード例 #45
0
    def test_05_block_n_deep_non_standard_dirs(self):
        """
        Prevent any > two-level deep directories from being created if they're
        not a standard directory.
        """
        repo = self.create_repo(multi=True)
        svn = repo.svn

        error = e.InvalidTopLevelRepoComponentDirectoryCreated
        paths = [p.replace('/', '') for p in conf.standard_layout]
        with chdir(repo.wc):
            dot()
            svn.mkdir('foo')
            svn.ci()

            dot()
            svn.mkdir('foo/bar')
            svn.mkdir('foo/bar/tmp')
            with ensure_blocked(self, error):
                svn.ci()

            dot()
            svn.mkdir('viper')
            svn.mkdir('viper/eagle')
            svn.mkdir('viper/eagle/tomcat')
            with ensure_blocked(self, error):
                svn.ci('viper')

            dot()
            svn.mkdir('fulcrum')
            svn.mkdir('fulcrum/flanker')
            svn.mkdir('fulcrum/flanker/foxbat')
            svn.mkdir('fulcrum/flanker/foxbat/tags')
            svn.mkdir('fulcrum/flanker/foxbat/trunk')
            svn.mkdir('fulcrum/flanker/foxbat/branches')
            with ensure_blocked(self, error):
                svn.ci('fulcrum')
コード例 #46
0
    def test_05_block_n_deep_non_standard_dirs(self):
        """
        Prevent any > two-level deep directories from being created if they're
        not a standard directory.
        """
        repo = self.create_repo(multi=True)
        svn = repo.svn

        error = e.InvalidTopLevelRepoComponentDirectoryCreated
        paths = [ p.replace('/', '') for p in conf.standard_layout ]
        with chdir(repo.wc):
            dot()
            svn.mkdir('foo')
            svn.ci()

            dot()
            svn.mkdir('foo/bar')
            svn.mkdir('foo/bar/tmp')
            with ensure_blocked(self, error):
                svn.ci()

            dot()
            svn.mkdir('viper')
            svn.mkdir('viper/eagle')
            svn.mkdir('viper/eagle/tomcat')
            with ensure_blocked(self, error):
                svn.ci('viper')

            dot()
            svn.mkdir('fulcrum')
            svn.mkdir('fulcrum/flanker')
            svn.mkdir('fulcrum/flanker/foxbat')
            svn.mkdir('fulcrum/flanker/foxbat/tags')
            svn.mkdir('fulcrum/flanker/foxbat/trunk')
            svn.mkdir('fulcrum/flanker/foxbat/branches')
            with ensure_blocked(self, error):
                svn.ci('fulcrum')
コード例 #47
0
    def test_01_basic(self):
        """
        Given:
            /trunk/
            /tags/
            /branches/
        Make sure we can't create:
            /bar/
        """
        repo = self.create_repo()
        svn = repo.svn

        expected = conf.standard_layout
        raw = svn.ls(repo.uri)
        actual = frozenset(format_dir(l) for l in raw.splitlines())
        self.assertEqual(expected, actual)
        dot()

        expected = e.InvalidTopLevelRepoDirectoryCreated
        with chdir(repo.wc):
            svn.mkdir('bar')
            with ensure_blocked(self, expected):
                svn.ci()
                dot()
コード例 #48
0
    def test_01_basic(self):
        """
        Given:
            /trunk/
            /tags/
            /branches/
        Make sure we can't create:
            /bar/
        """
        repo = self.create_repo()
        svn = repo.svn

        expected = conf.standard_layout
        raw = svn.ls(repo.uri)
        actual = frozenset(format_dir(l) for l in raw.splitlines())
        self.assertEqual(expected, actual)
        dot()

        expected = e.InvalidTopLevelRepoDirectoryCreated
        with chdir(repo.wc):
            svn.mkdir('bar')
            with ensure_blocked(self, expected):
                svn.ci()
                dot()
コード例 #49
0
ファイル: commands.py プロジェクト: tpn/enversion
 def run(self):
     with chdir(self.conf.selftest_base_dir):
         import evn.test
         evn.test.main(quiet=self.options.quiet)
コード例 #50
0
    def test_01(self):
        repo = self.create_repo()
        svn = repo.svn
        evnadmin = repo.evnadmin
        evnadmin.disable(repo.path)

        dot()
        tree = { 'foo/moo/bar.txt': bulk_chargen(100) }
        repo.build(tree, prefix='branches')
        with chdir(repo.wc):
            # r2
            svn.add('branches/foo')
            svn.ci('branches/foo', m='Initializing foo component.')

        dot()
        evnadmin.enable(repo.path)
        error = 'valid root subtree path renamed to valid root path'
        with ensure_blocked(self, error):
            svn.mv(repo.ra('/branches/foo/moo'),
                   repo.ra('/branches/bar/'),
                   m='Branch')

        dot()
        evnadmin.disable(repo.path)
        # r3
        svn.mv(repo.ra('/branches/foo/moo/'),
               repo.ra('/branches/bar/'), m='Branch')

        dot()
        evn_props_r3_expected = {
            'errors': {
                '/branches/bar/': [ error ],
            },
            'roots': {
                '/trunk/': { 'created': 1 },
            },
        }
        evnadmin.enable(repo.name)
        self.assertEqual(repo.revprops_at(3)['evn'], evn_props_r3_expected)

        dot()
        evnadmin.set_repo_readonly(repo.name)

        dot()
        evnadmin.add_root_hint(
            repo.name,
            path='/branches/bar/',
            revision='3',
            root_type='branch',
        )
        evnadmin.enable(repo.name)

        dot()
        evnadmin.unset_repo_readonly(repo.name)

        dot()
        evn_props_r3_expected = {
            'roots': {
                '/trunk/': { 'created': 1 },
                '/branches/bar/': {
                    'copies': {},
                    'created': 3,
                    'creation_method': 'renamed',
                    'renamed_from': ('/branches/foo/moo/', 2),
                },
            },
        }
        self.assertEqual(repo.revprops_at(3)['evn'], evn_props_r3_expected)
コード例 #51
0
    def test_01(self):
        """
        Create a single-component repo, then convert to multi-component.
        """
        repo = self.create_repo()

        svn = repo.svn
        name = repo.name
        evnadmin = repo.evnadmin

        expected = conf.standard_layout
        raw = svn.ls(repo.uri)
        actual = frozenset(format_dir(l) for l in raw.splitlines())
        self.assertEqual(expected, actual)

        dot()
        self.assertEqual(0, repo.component_depth)

        dot()
        roots = {
            '/trunk/': {
                'copies': {},
                'created': 1,
                'creation_method': 'created',
            }
        }
        self.assertEqual(roots, repo.roots)

        dot()
        with chdir(repo.wc):
            svn.cp('trunk', 'branches/1.x')
            svn.ci(m='Branching 1.x.')

        dot()
        with chdir(repo.wc):
            svn.cp('branches/1.x', 'tags/1.1')
            svn.ci(m='Tagging 1.1.')

        dot()
        error = 'root ancestor path renamed to unknown path'
        with chdir(repo.wc):
            svn.up()
            svn.mkdir('foo')
            svn.mv('tags', 'foo')
            svn.mv('trunk', 'foo')
            svn.mv('branches', 'foo')
            with ensure_blocked(self, error):
                svn.ci()

        dot()
        evnadmin.disable(name)
        with chdir(repo.wc):
            svn.ci()
        evnadmin.set_repo_component_depth(repo.name, multi=True)
        evnadmin.enable(name)

        roots = {
            '/foo/branches/1.x/': {
                'copies': {},
                'created': 4,
                'creation_method': 'renamed_indirectly',
                'errors': ['root ancestor path renamed to unknown path'],
                'renamed_from': ('/branches/1.x/', 3),
                'renamed_indirectly_from': (
                    '/branches/',
                    '/foo/branches/',
                ),
            },
            '/foo/tags/1.1/': {
                'copies': {},
                'created': 4,
                'creation_method': 'renamed_indirectly',
                'errors': ['root ancestor path renamed to unknown path'],
                'renamed_from': ('/tags/1.1/', 3),
                'renamed_indirectly_from': (
                    '/tags/',
                    '/foo/tags/',
                ),
            },
            '/foo/trunk/': {
                'copies': {},
                'created': 4,
                'creation_method': 'renamed',
                'errors': [],
                'renamed_from': ('/trunk/', 3)
            }
        }

        self.assertEqual(roots, repo.roots)
コード例 #52
0
ファイル: test_root_hints.py プロジェクト: tpn/enversion
    def test_01(self):
        repo = self.create_repo()
        svn = repo.svn
        evnadmin = repo.evnadmin
        evnadmin.disable(repo.path)

        dot()
        tree = {'foo/moo/bar.txt': bulk_chargen(100)}
        repo.build(tree, prefix='branches')
        with chdir(repo.wc):
            # r2
            svn.add('branches/foo')
            svn.ci('branches/foo', m='Initializing foo component.')

        dot()
        evnadmin.enable(repo.path)
        error = 'valid root subtree path renamed to valid root path'
        with ensure_blocked(self, error):
            svn.mv(repo.ra('/branches/foo/moo'),
                   repo.ra('/branches/bar/'),
                   m='Branch')

        dot()
        evnadmin.disable(repo.path)
        # r3
        svn.mv(repo.ra('/branches/foo/moo/'),
               repo.ra('/branches/bar/'),
               m='Branch')

        dot()
        evn_props_r3_expected = {
            'errors': {
                '/branches/bar/': [error],
            },
            'roots': {
                '/trunk/': {
                    'created': 1
                },
            },
        }
        evnadmin.enable(repo.name)
        self.assertEqual(repo.revprops_at(3)['evn'], evn_props_r3_expected)

        dot()
        evnadmin.set_repo_readonly(repo.name)

        dot()
        evnadmin.add_root_hint(
            repo.name,
            path='/branches/bar/',
            revision='3',
            root_type='branch',
        )
        evnadmin.enable(repo.name)

        dot()
        evnadmin.unset_repo_readonly(repo.name)

        dot()
        evn_props_r3_expected = {
            'roots': {
                '/trunk/': {
                    'created': 1
                },
                '/branches/bar/': {
                    'copies': {},
                    'created': 3,
                    'creation_method': 'renamed',
                    'renamed_from': ('/branches/foo/moo/', 2),
                },
            },
        }
        self.assertEqual(repo.revprops_at(3)['evn'], evn_props_r3_expected)
コード例 #53
0
    def test_01(self):
        repo = self.create_repo()
        svn = repo.svn
        evnadmin = repo.evnadmin

        # Disable so we can mkdir ^/other
        dot()
        evnadmin.disable(repo.path)
        svn.mkdir(repo.ra("/other/"), m="Creating other directory")

        dot()
        evnadmin.enable(repo.path)
        svn.cp(repo.ra("/trunk/"), repo.ra("/branches/1.x/"), m="Branching")
        svn.cp(repo.ra("/branches/1.x/"), repo.ra("/tags/1.0/"), m="Tagging")
        svn.cp(repo.ra("/branches/1.x/"), repo.ra("/tags/1.1/"), m="Tagging")
        svn.cp(repo.ra("/branches/1.x/"), repo.ra("/tags/1.2/"), m="Tagging")

        # Lazy (quick) test of roots.
        dot()
        expected_roots = set(("/trunk/", "/branches/1.x/", "/tags/1.0/", "/tags/1.1/", "/tags/1.2/"))
        actual_roots = set(repo.roots.keys())
        self.assertEqual(expected_roots, actual_roots)

        is_repo_admin = lambda u: evnadmin.is_repo_admin(repo.name, u=u)
        add_repo_admin = lambda u: evnadmin.add_repo_admin(repo.name, u=u)
        show_repo_admins = lambda: evnadmin.show_repo_admins(repo.name)
        remove_repo_admin = lambda u: evnadmin.remove_repo_admin(repo.name, u=u)

        dot()
        username = svn.username
        self.assertEqual(is_repo_admin(username), "no")
        self.assertEqual(is_repo_admin("laskdjflsdkjf"), "no")

        dot()
        error = e.TagCopied
        with ensure_blocked(self, error):
            svn.cp(repo.ra("/tags/1.0/"), repo.ra("/other/1.0/"), m="Tagging")

        dot()
        error = "commits with errors can only be forced through by"
        with ensure_blocked(self, error):
            svn.cp(repo.ra("/tags/1.0/"), repo.ra("/other/1.0/"), m="IGNORE ERRORS")

        # dot()
        # error = e.TagCopied
        # with ensure_blocked(self, error):
        #    svn.cp(repo.ra('/tags/1.0/'), repo.ra('/other/1.0/'),
        #           m=EVN_ERROR_CONFIRMATIONS[e.TagCopied])

        dot()
        add_repo_admin(username)
        self.assertEqual(is_repo_admin(username), "yes")

        # Make sure we're still blocked if we're an admin but we haven't
        # explicitly included IGNORE ERRORS.
        dot()
        error = e.TagCopied
        with ensure_blocked(self, error):
            svn.cp(repo.ra("/tags/1.0/"), repo.ra("/other/1.0/"), m="Tagging")

        dot()
        error = e.TagCopied
        svn.cp(repo.ra("/tags/1.0/"), repo.ra("/other/1.0/"), m="IGNORE ERRORS")

        # dot()
        # error = e.TagRemoved
        # svn.rm(repo.ra('/tags/1.1/'), m=EVN_ERROR_CONFIRMATIONS[error])

        with chdir(repo.wc):
            svn.up()
            svn.cp("tags/1.2", "other/1.2")
            svn.cp("trunk", "other/foobar")
            svn.cp("branches/1.x", "other/1.x")
            svn.ci(m="IGNORE ERRORS")
コード例 #54
0
    def test_01(self):
        repo = self.create_repo()
        svn = repo.svn
        svnmucc = repo.svnmucc
        evnadmin = repo.evnadmin

        # Disable so we can mkdir ^/other
        dot()
        evnadmin.disable(repo.path)
        with chdir(repo.wc):
            svn.mkdir('other')
            svn.mkdir('keep')
            svn.ci()

        dot()
        evnadmin.enable(repo.path)
        svn.cp(repo.ra('/trunk/'), repo.ra('/branches/1.x/'), m='Branching')
        svn.cp(repo.ra('/branches/1.x/'), repo.ra('/tags/1.0/'), m='Tagging')

        # Lazy (quick) test of roots.
        dot()
        expected_roots = set(('/trunk/', '/branches/1.x/', '/tags/1.0/'))
        actual_roots = set(repo.roots.keys())
        self.assertEqual(expected_roots, actual_roots)

        # Add ourselves as a repo admin so that we can force through the next
        # commit.
        dot()
        evnadmin.add_repo_admin(repo.name, username=svn.username)
        expected = 'yes'
        actual = evnadmin.is_repo_admin(repo.name, username=svn.username)
        self.assertEqual(expected, actual)

        dot()
        with chdir(repo.wc):
            svn.up()
            svn.cp('trunk', 'other/foobar')
            svn.cp('branches/1.x', 'other/1.x')
            svn.cp('tags/1.0', 'other/1.0')
            svn.ci(m='IGNORE ERRORS')

        dot()
        evnadmin.set_repo_component_depth(repo.name, component_depth='-1')

        evnadmin.add_root_exclusion(
            repo.name,
            root_exclusion='/other/',
        )
        dot()
        svnmucc.rm(
            repo.ra('/other/'),
            'cp', '5', repo.ra('/other/'), repo.ra('/other/'),
            m='IGNORE ERRORS',
        )

        error = 'root ancestor path copied via replace to root ancestor path'
        evn_props_r6_expected = {
            'errors': {
                '/other/': [ error, ]
            },
            'roots' : {
                '/branches/1.x/': {'created': 3},
                '/tags/1.0/': {'created': 4},
                '/trunk/': {'created': 1},
            }
        }
        self.assertEqual(repo.revprops_at(6)['evn'], evn_props_r6_expected)

        evn_brprops_expected_after_r6 = {
            'last_rev': 6,
            'version': 1,
            'root_exclusions': ['/other/'],
            'root_ancestor_actions': {
                '/other/': {
                    6: [
                        {
                            'action': 'replaced',
                            'num_roots_removed': 3,
                        },
                        {
                            'action': 'copied',
                            'copied_from': ('/other/', 5),
                            'num_origin_roots': 3,
                            'num_roots_created': 0,
                        },
                    ],
                },
            },
        }
        self.assertEqual(
            repo.revprops_at(0)['evn'],
            evn_brprops_expected_after_r6,
        )
コード例 #55
0
    def test_01(self):
        repo = self.create_repo()
        svn = repo.svn
        evnadmin = repo.evnadmin

        # Disable so we can mkdir ^/other
        dot()
        evnadmin.disable(repo.path)
        with chdir(repo.wc):
            svn.mkdir('other')
            svn.mkdir('keep')
            svn.ci()

        dot()
        evnadmin.enable(repo.path)
        svn.cp(repo.ra('/trunk/'), repo.ra('/branches/1.x/'), m='Branching')
        svn.cp(repo.ra('/branches/1.x/'), repo.ra('/tags/1.0/'), m='Tagging')

        # Lazy (quick) test of roots.
        dot()
        expected_roots = set(('/trunk/', '/branches/1.x/', '/tags/1.0/'))
        actual_roots = set(repo.roots.keys())
        self.assertEqual(expected_roots, actual_roots)

        # Add ourselves as a repo admin so that we can force through the next
        # commit.
        dot()
        evnadmin.add_repo_admin(repo.name, username=svn.username)
        expected = 'yes'
        actual = evnadmin.is_repo_admin(repo.name, username=svn.username)
        self.assertEqual(expected, actual)

        dot()
        with chdir(repo.wc):
            svn.up()
            svn.cp('trunk', 'other/foobar')
            svn.cp('branches/1.x', 'other/1.x')
            svn.cp('tags/1.0', 'other/1.0')
            svn.ci(m='IGNORE ERRORS')

        evn_props_r5_expected = {
            'errors': {
                '/other/1.0/': [
                    'tag copied',
                    'known root path copied to unknown path',
                ],
                '/other/1.x/': [ 'known root path copied to unknown path' ],
                '/other/foobar/': [ 'known root path copied to unknown path' ],
            },
            'roots': {
                '/branches/1.x/': { 'created': 3 },
                '/other/1.0/': {
                    'copied_from': ('/tags/1.0/', 4),
                    'copies': {},
                    'created': 5,
                    'creation_method': 'copied',
                    'errors': [
                        'tag copied',
                        'known root path copied to unknown path',
                    ],
                },
                '/other/1.x/': {
                    'copied_from': ('/branches/1.x/', 4),
                    'copies': {},
                    'created': 5,
                    'creation_method': 'copied',
                    'errors': ['known root path copied to unknown path'],
                },
                '/other/foobar/': {
                    'copied_from': ('/trunk/', 4),
                    'copies': {},
                    'created': 5,
                    'creation_method': 'copied',
                    'errors': ['known root path copied to unknown path'],
                },
                '/tags/1.0/': { 'created': 4 },
                '/trunk/': { 'created': 1 }
            }
        }
        self.assertEqual(repo.revprops_at(5)['evn'], evn_props_r5_expected)

        dot()
        svn.mv(repo.ra('/other/'), repo.ra('/other.bak/'), m='IGNORE ERRORS')

        evn_props_r6_expected = {
            'errors': {
                '/other.bak/': ['root ancestor path renamed to unknown path'],
            },
            'roots' : {
                '/other.bak/1.0/': {
                    'renamed_indirectly_from': ('/other/', '/other.bak/'),
                    'renamed_from': ('/other/1.0/', 5),
                    'copies': {},
                    'created': 6,
                    'creation_method': 'renamed_indirectly',
                    'errors': ['root ancestor path renamed to unknown path'],
                },
                '/other.bak/1.x/': {
                    'renamed_indirectly_from': ('/other/', '/other.bak/'),
                    'renamed_from': ('/other/1.x/', 5),
                    'copies': {},
                    'created': 6,
                    'creation_method': 'renamed_indirectly',
                    'errors': ['root ancestor path renamed to unknown path'],
                },
                '/other.bak/foobar/': {
                    'renamed_indirectly_from': ('/other/', '/other.bak/'),
                    'renamed_from': ('/other/foobar/', 5),
                    'copies': {},
                    'created': 6,
                    'creation_method': 'renamed_indirectly',
                    'errors': ['root ancestor path renamed to unknown path'],
                },
                '/branches/1.x/': {'created': 3},
                '/tags/1.0/': {'created': 4},
                '/trunk/': {'created': 1},
            }
        }
        self.assertEqual(repo.revprops_at(6)['evn'], evn_props_r6_expected)

        evn_brprops_expected_after_r6 = {
            'component_depth': 0,
            'last_rev': 6,
            'version': 1,
            'root_ancestor_actions': {
                '/other.bak/': {
                    6: [
                        {
                            'action': 'renamed',
                            'renamed_from': '/other/',
                            'num_origin_roots': 3,
                            'num_roots_created': 3,
                            'num_roots_removed': 3,
                        },
                    ],
                },
            },
        }
        self.assertEqual(
            repo.revprops_at(0)['evn'],
            evn_brprops_expected_after_r6,
        )