Пример #1
0
    def run(self):
        RepositoryCommand.run(self)
        tags_basedir = self.tags_basedir

        rc0 = self.r0_revprop_conf
        if not rc0.get('tags_basedirs'):
            raise CommandError('no tags basedirs present')

        basedirs = rc0.tags_basedirs
        if tags_basedir not in basedirs:
            msg = 'no such tags basedir: %s' % tags_basedir
            raise CommandError(msg)

        basedirs.remove(tags_basedir)
        msg = "Removed tags basedir %s from %s."
        self._out(msg % (tags_basedir, self.conf.repo_name))
Пример #2
0
    def run(self):
        RepoHookCommand.run(self)

        h = self.hook_file(self.hook_name)
        if not h.needs_fixing:
            raise CommandError(
                "Hook '%s' for repository '%s' "
                "does not need fixing." % (
                    self.hook_name,
                    self.name,
                )
            )

        self._out("Fixing repository hook '%s'..." % self.hook_name)
        if not h.exists or h.is_empty:
            self._out("    Creating new file.")
            h.create()

        if not h.executable:
            self._out("    Setting correct file permissions.")
            h.fix_perms()

        if not h.configured:
            self._out("    Configuring for use with Enversion.")
            h.configure()

        assert not h.needs_fixing
        self._out("Done!")
Пример #3
0
    def run(self):
        RepositoryCommand.run(self)

        h = self.evn_hook_file
        if not h.needs_fixing:
            raise CommandError(
                "Hook '%s' for repository '%s' "
                "does not need fixing." % (
                    h.name,
                    self.name,
                )
            )

        self._out(
            "Fixing hook '%s' for repository '%s'..." % (
                h.name,
                self.path,
            )
        )

        if not h.exists or h.is_empty:
            self._out("    Creating new file.")
            h.create()

        if not h.executable:
            self._out("    Setting correct file permissions.")
            h.fix_perms()

        if not h.is_valid:
            self._out("    Correcting hook code.")
            h.fix_code()

        assert not h.needs_fixing
        self._out("Done!")
Пример #4
0
    def run(self):
        RepositoryCommand.run(self)
        branches_basedir = self.branches_basedir

        rc0 = self.r0_revprop_conf
        if not rc0.get('branches_basedirs'):
            raise CommandError('no branches basedirs present')

        basedirs = rc0.branches_basedirs
        if branches_basedir not in basedirs:
            msg = 'no such branches basedir: %s' % branches_basedir
            raise CommandError(msg)

        basedirs.remove(branches_basedir)
        msg = "Removed branches basedir %s from %s."
        self._out(msg % (branches_basedir, self.conf.repo_name))
Пример #5
0
    def run(self):
        RepositoryCommand.run(self)

        root_exclusion = self.root_exclusion

        rc0 = self.r0_revprop_conf

        if not rc0.get('root_exclusions'):
            raise CommandError('no root exclusions set')

        if root_exclusion not in rc0.root_exclusions:
            raise CommandError('no such root exclusion: %s' % root_exclusions)

        rc0.root_exclusions.remove(root_exclusion)
        msg = 'Removed root exclusion %s from %s.' % (
            root_exclusion,
            self.conf.repo_name,
        )
        self._out(msg)
Пример #6
0
 def run(self):
     RepositoryCommand.run(self)
     from ..config import NoModificationsMade
     try:
         conf = self.conf.create_new_conf_from_modifications()
     except NoModificationsMade:
         raise CommandError(
             "repository '%s' has no custom configuration "
             "modifications made" % (self.conf.repo_name)
         )
     conf.write(self.ostream)
Пример #7
0
    def _process_parser_results(self):
        opts = self.options

        if opts.root_type not in ('trunk', 'tag', 'branch'):
            msg = (
                "invalid root type %s, expected one of 'trunk', "
                "'tag', or 'branch'" % opts.root_type
            )
            raise CommandError(msg)

        self.command.root_type = opts.root_type
        self.command.root_path = opts.path
Пример #8
0
 def run(self):
     RepositoryCommand.run(self)
     path = self.options.path
     conf = self.conf
     if conf.does_path_match_file_size_exclusion_regex(path):
         return
     else:
         raise CommandError(
             "path '%s' does not match regex '%s'" % (
                 path,
                 conf.get('main', 'max-file-size-exclusion-regex'),
             )
         )
Пример #9
0
 def run(self):
     RepositoryCommand.run(self)
     path = self.options.path
     conf = self.conf
     if conf.does_path_match_blocked_file_extensions_regex(path):
         return
     else:
         raise CommandError(
             "path '%s' does not match regex '%s'" % (
                 path,
                 conf.get('main', 'blocked-file-extensions-regex'),
             )
         )
Пример #10
0
    def run(self):
        RepositoryRevisionCommand.run(self)
        root_path = format_dir(self.root_path)

        rev = self.rev

        rc0 = self.r0_revprop_conf

        if not rc0.get('root_hints'):
            raise CommandError("no such root hint: %s" % root_path)

        hints = rc0['root_hints'].get(rev)
        if not hints:
            msg = "no such root hint at r%d: %s" % (rev, root_path)
            raise CommandError(msg)

        if root_path not in hints:
            msg = "no such root hint at r%d: %s" % (rev, root_path)
            raise CommandError(msg)

        del hints[root_path]
        msg = "Removed root hint %r for r%d from %s."
        repo_name = self.conf.repo_name
        self._out(msg % (hint, rev, repo_name))
Пример #11
0
    def _process_parser_results(self):
        opts = self.options

        cd = None

        if opts.multi:
            cd = 1
        elif opts.single:
            cd = 0
        else:
            cd = opts.component_depth

        if cd not in (-1, 0, 1):
            raise CommandError("invalid component depth: %r" % cd)

        self.command.component_depth = cd
Пример #12
0
    def run(self):
        RepositoryCommand.run(self)
        tags_basedir = format_dir(self.tags_basedir)

        rc0 = self.r0_revprop_conf

        if not rc0.get('tags_basedirs'):
            rc0.tags_basedirs = []

        basedirs = rc0.tags_basedirs
        if tags_basedir in basedirs:
            msg = "tags basedir already exists for %s" % tags_basedir
            raise CommandError(msg)

        basedirs.append(tags_basedir)
        repo_name = self.conf.repo_name
        msg = 'Added tags basedir %s to %s.' % (tags_basedir, repo_name)
        self._out(msg)
Пример #13
0
    def run(self):
        RepositoryCommand.run(self)

        root_exclusion = self.root_exclusion

        rc0 = self.r0_revprop_conf

        if not rc0.get('root_exclusions'):
            rc0.root_exclusions = []

        if root_exclusion in rc0.root_exclusions:
            msg = "root exclusion already exists for %s" % root_exclusion
            raise CommandError(msg)

        rc0.root_exclusions.append(root_exclusion)
        msg = 'Added root exclusion %s to %s.' % (
            root_exclusion,
            self.conf.repo_name,
        )
        self._out(msg)
Пример #14
0
    def run(self):
        RepositoryCommand.run(self)
        branches_basedir = format_dir(self.branches_basedir)

        rc0 = self.r0_revprop_conf

        if not rc0.get('branches_basedirs'):
            rc0.branches_basedirs = []

        basedirs = rc0.branches_basedirs
        if branches_basedir in basedirs:
            msg = "branches basedir already exists for %s" % branches_basedir
            raise CommandError(msg)

        basedirs.append(branches_basedir)
        repo_name = self.conf.repo_name
        msg = 'Added branches basedir %s to %s.' % (
            branches_basedir,
            self.conf.repo_name,
        )
        self._out(msg)
Пример #15
0
def _process_parser_username(obj):
    username = obj.options.username
    if not username:
        raise CommandError('-u/--username is mandatory')
    obj.command.username = username
Пример #16
0
    def run(self):
        RepositoryRevisionCommand.run(self)
        rev = self.rev
        root_path = format_dir(self.root_path)
        root_type = self.root_type
        assert root_type in ('tag', 'trunk', 'branch')

        rc0 = self.r0_revprop_conf
        self.ensure_readonly()

        if not rc0.get('root_hints'):
            rc0.root_hints = {}

        if not rc0['root_hints'].get(rev):
            rc0['root_hints'][rev] = {}

        hints = rc0['root_hints'][rev]
        if root_path in hints:
            msg = "hint already exists for %s@%d" % (root_path, rev)
            raise CommandError(msg)

        from evn.change import ChangeSet
        opts = Options()
        cs = ChangeSet(self.path, self.rev, opts)
        cs.load()

        import svn.fs
        from svn.core import (
            svn_node_dir,
            svn_node_file,
            svn_node_none,
            svn_node_unknown,
        )

        svn_root = cs._get_root(rev)
        node_kind = svn.fs.check_path(svn_root, root_path, self.pool)
        if node_kind == svn_node_none:
            msg = "no such path %s in revision %d"
            raise CommandError(msg % (root_path, rev))
        elif node_kind == svn_node_unknown:
            msg = "unexpected node type 'unknown' for path %s in revision %d"
            raise CommandError(msg % (root_path, rev))
        elif node_kind == svn_node_file:
            msg = "path %s was a file in revision %d, not a directory"
            raise CommandError(msg % (root_path, rev))
        else:
            assert node_kind == svn_node_dir, node_kind

        change = cs.get_change_for_path(root_path)
        if not change:
            msg = (
                "path %s already existed in revision %d; specify the revision "
                "it was created in when adding a root hint (tip: try running "
                "`svn log --stop-on-copy --limit 1 %s%s@%d` to get the "
                "correct revision to use)" % (
                    root_path,
                    rev,
                    self.uri,
                    root_path,
                    rev,
                )
            )
            raise CommandError(msg)

        if change.is_remove or change.is_modify:
            msg = (
                "path %s wasn't created in revision %d; you need to specify "
                "the revision it was created in when adding a root hint "
                "(tip: try running `svn log --stop-on-copy --limit 1 %s%s@%d`"
                " to get the correct revision to use)" % (
                    root_path,
                    rev,
                    self.uri,
                    root_path,
                    rev,
                )
            )
            raise CommandError(msg)

        hints[root_path] = root_type

        repo_name = self.conf.repo_name
        msg = 'Added root hint for %s@%d to %s.' % (root_path, rev, repo_name)
        self._out(msg)

        last_rev = rev-1
        if rc0.last_rev <= last_rev:
            msg = (
                'evn:last_rev (%d) is already set less than or equal to the '
                'new would-be evn:last_rev (%d) based on the revision used '
                'for this root hint (%d); run `evnadmin analyze %s` when '
                'ready to restart analysis from revision %d.' % (
                    rc0.last_rev,
                    last_rev,
                    rev,
                    repo_name,
                    rc0.last_rev,
                )
            )
        else:
            rc0.last_rev = last_rev
            msg = (
                'evn:last_rev has been reset from %d to %d; '
                'run `evnadmin analyze %s` when ready to '
                'restart analysis from revision %d.' % (
                    rev,
                    last_rev,
                    repo_name,
                    last_rev,
                )
            )
        self._out(msg)
Пример #17
0
 def run(self):
     RepositoryCommand.run(self)
     if not self.conf.actual_repo_conf_filenames:
         raise CommandError('no repo configuration files are being loaded')
     self._out(os.linesep.join(self.conf.actual_repo_conf_filenames))
Пример #18
0
 def run(self):
     if not self.conf.actual_conf_filenames:
         raise CommandError('no configuration files are being loaded')
     self._out(os.linesep.join(self.conf.actual_conf_filenames))