Exemplo n.º 1
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!")
Exemplo n.º 2
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!")
Exemplo n.º 3
0
    def run(self):
        RepositoryCommand.run(self)

        self.__init_rev_or_txn()

        self.result = ChangeSet(**self.changeset_kwds)
        self.result.load()
Exemplo n.º 4
0
    def run(self):
        RepositoryCommand.run(self)

        self.__init_rev_or_txn()

        self.result = ChangeSet(**self.changeset_kwds)
        self.result.load()
Exemplo n.º 5
0
    def run(self):
        RepositoryCommand.run(self)
        message = self.options.message or self.conf.readonly_error_message

        rc0 = self.r0_revprop_conf
        rc0.readonly = 1
        if message:
            rc0.readonly_message = message
Exemplo n.º 6
0
    def run(self):
        RepositoryCommand.run(self)
        username = self.username
        if not self.conf.is_repo_admin(username):
            msg = "%s is not a repo admin for %s"
            self._out(msg % (username, self.name))
            return

        self.conf.remove_repo_admin(username)
Exemplo n.º 7
0
    def run(self):
        RepositoryCommand.run(self)
        username = self.username
        if self.conf.is_repo_admin(username):
            msg = "%s is already a repo admin for %s"
            self._out(msg % (username, self.name))
            return

        self.conf.add_repo_admin(username)
Exemplo n.º 8
0
    def run(self):
        RepositoryCommand.run(self)
        rc0 = self.r0_revprop_conf

        if 'readonly' not in rc0:
            return

        del rc0.readonly
        if 'readonly_message' in rc0:
            del rc0.readonly_message
Exemplo n.º 9
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)
Exemplo n.º 10
0
    def run(self):
        RepositoryCommand.run(self)
        rc0 = self.r0_revprop_conf
        out = self._out
        err = self._err

        readonly = 'no'

        if 'readonly' in rc0:
            if rc0.get('readonly') == 1:
                readonly = 'yes'

        out(readonly)
Exemplo n.º 11
0
 def run(self):
     RepositoryCommand.run(self)
     rc0 = self.r0_revprop_conf
     out = self._out
     err = self._err
     if 'component_depth' not in rc0:
         out('-1 (none)')
     else:
         depth = rc0.component_depth
         if depth in (0, 1):
             out('%d (%s)' % (depth, { 0: 'single', 1: 'multi' }[depth]))
         else:
             err('Invalid depth: %s' % str(depth))
Exemplo n.º 12
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'),
             )
         )
Exemplo n.º 13
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'),
             )
         )
Exemplo n.º 14
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))
Exemplo n.º 15
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))
Exemplo n.º 16
0
    def run(self):
        RepositoryCommand.run(self)

        d = Dict()
        d.name = self.name
        d.path = self.path
        d.hook_dir = self.hook_dir

        t = dict()
        for hf in self.hook_files:
            assert hf.name not in t
            t[hf.name] = h = Dict()
            h.name = hf.name
            h.exists = hf.exists

            h.remote_debug      = hf.is_remote_debug_enabled
            h.remote_debug_host = hf.remote_debug_host
            h.remote_debug_port = hf.remote_debug_port

            h.remote_debug_sessions         = hf.remote_debug_sessions
            h.stale_remote_debug_sessions   = hf.remote_debug_sessions
            h.invalid_remote_debug_sessions = hf.invalid_remote_debug_sessions

            if not h.exists:
                continue

            h.executable = hf.executable
            h.configured = hf.configured
            if not h.configured:
                continue

            h.enabled = hf.is_enabled

        d.hook_files = [ RepoHookFileStatus(**k) for k in t.values() ]

        eh = self.evn_hook_file
        h = Dict()
        h.name   = eh.name
        h.exists = eh.exists
        if h.exists:
            h.valid = eh.is_valid
            h.executable = eh.executable

        d.evn_hook_file = EvnHookFileStatus(**h)

        self.result = RepoHookFilesStatus(**d)
Exemplo n.º 17
0
    def run(self):
        RepositoryCommand.run(self)

        d = Dict()
        d.name = self.name
        d.path = self.path
        d.hook_dir = self.hook_dir

        t = dict()
        for hf in self.hook_files:
            assert hf.name not in t
            t[hf.name] = h = Dict()
            h.name = hf.name
            h.exists = hf.exists

            h.remote_debug      = hf.is_remote_debug_enabled
            h.remote_debug_host = hf.remote_debug_host
            h.remote_debug_port = hf.remote_debug_port

            h.remote_debug_sessions         = hf.remote_debug_sessions
            h.stale_remote_debug_sessions   = hf.remote_debug_sessions
            h.invalid_remote_debug_sessions = hf.invalid_remote_debug_sessions

            if not h.exists:
                continue

            h.executable = hf.executable
            h.configured = hf.configured
            if not h.configured:
                continue

            h.enabled = hf.is_enabled

        d.hook_files = [ RepoHookFileStatus(**k) for k in t.values() ]

        eh = self.evn_hook_file
        h = Dict()
        h.name   = eh.name
        h.exists = eh.exists
        if h.exists:
            h.valid = eh.is_valid
            h.executable = eh.executable

        d.evn_hook_file = EvnHookFileStatus(**h)

        self.result = RepoHookFilesStatus(**d)
Exemplo n.º 18
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)
Exemplo n.º 19
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)
Exemplo n.º 20
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)
Exemplo n.º 21
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)
Exemplo n.º 22
0
    def run(self, from_enable=False):
        RepositoryCommand.run(self)

        rc0 = self.r0_revprop_conf

        last_rev = rc0.get('last_rev', None)
        start_rev = last_rev if last_rev is not None else 0
        end_rev = svn.fs.youngest_rev(self.fs)

        if end_rev == 0 or from_enable:
            self.options.quiet = True

        if last_rev is not None:
            if start_rev == end_rev:
                m = "Repository '%s' is up to date (r%d)."
                self._out(m % (self.name, end_rev))
                return
            elif start_rev == 0:
                if from_enable:
                    self.options.quiet = False
                m = "Analyzing repository '%s'..." % self.name
                self._out(m)
            else:
                if from_enable:
                    self.options.quiet = False
                self._out(
                    "Resuming analysis for repository '%s' "
                    "from revision %d..." % (self.name, start_rev)
                )

        k = self.repo_kwds
        for i in xrange(start_rev, end_rev+1):
            with RepositoryRevOrTxn(**k) as r:
                r.process_rev_or_txn(i)
                if i == 0:
                    continue
                cs = r.changeset
                self._out(str(i) + ':' + cs.analysis.one_liner)

        self._out("Finished analyzing repository '%s'." % self.name)
Exemplo n.º 23
0
    def run(self):
        RepositoryCommand.run(self)

        assert self.component_depth in (-1, 0, 1)

        out = self._out
        err = self._err

        rc0 = self.r0_revprop_conf

        cur_depth = rc0.get('component_depth', -1)
        if self.component_depth == -1:
            if cur_depth in (0, 1):
                out("Removing component depth from %s." % self.name)
                del rc0.component_depth
        else:
            args = (self.name, self.component_depth)
            if self.component_depth != cur_depth:
                out("Setting component depth for %s to %d." % args)
                rc0.component_depth = self.component_depth
            else:
                err("Component depth for %s is already %d." % args)
Exemplo n.º 24
0
    def run(self):
        RepositoryCommand.run(self)

        streams = (self.istream, self.ostream, self.estream)

        for h in self.hook_files:
            if not h.needs_fixing:
                continue

            with FixHookCommand(*streams) as fh:
                fh.path = self.path
                fh.conf = self.conf
                fh.options = self.options
                fh.hook_name = h.name
                fh.run()

        if not self.evn_hook_file.needs_fixing:
            return

        with FixEvnHookCommand(*streams) as fh:
            fh.path = self.path
            fh.conf = self.conf
            fh.options = self.options
            fh.run()
Exemplo n.º 25
0
    def run(self):
        RepositoryCommand.run(self)

        streams = (self.istream, self.ostream, self.estream)

        for h in self.hook_files:
            if not h.needs_fixing:
                continue

            with FixHookCommand(*streams) as fh:
                fh.path = self.path
                fh.conf = self.conf
                fh.options = self.options
                fh.hook_name = h.name
                fh.run()

        if not self.evn_hook_file.needs_fixing:
            return

        with FixEvnHookCommand(*streams) as fh:
            fh.path = self.path
            fh.conf = self.conf
            fh.options = self.options
            fh.run()
Exemplo n.º 26
0
    def run(self):
        RepositoryCommand.run(self)

        h = self.evn_hook_file
        h.write(self.ostream)
Exemplo n.º 27
0
 def run(self):
     RepositoryCommand.run(self)
     self._out(self.conf.repo_admins_repr)
Exemplo n.º 28
0
 def run(self):
     RepositoryCommand.run(self)
     self.conf.write(self.ostream)
Exemplo n.º 29
0
    def run(self):
        RepositoryCommand.run(self)

        h = self.evn_hook_file
        h.write(self.ostream)
Exemplo n.º 30
0
 def run(self):
     RepositoryCommand.run(self)
     self._out(os.linesep.join(self.conf.possible_repo_conf_filenames))
Exemplo n.º 31
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))
Exemplo n.º 32
0
 def run(self):
     RepositoryCommand.run(self)
     self._out(self.conf.writable_repo_override_conf_filename)
Exemplo n.º 33
0
 def run(self):
     RepositoryCommand.run(self)
     self._out(self.conf.custom_hook_classname)
Exemplo n.º 34
0
 def run(self):
     RepositoryCommand.run(self)
     custom_hook_classname = self.options.custom_hook_classname
     self.conf.set_custom_hook_classname(custom_hook_classname)
Exemplo n.º 35
0
    def run(self):
        RepositoryCommand.run(self)

        for h in self.hook_files:
            h.disable()