Beispiel #1
0
    def __init__(self, name, rootpath, authorizer, utilities):
        if not os.path.isdir(rootpath):
            raise vclib.ReposNotFound(name)

        self.name = name
        self.rootpath = rootpath
        self.auth = authorizer
        self.utilities = utilities

        # See if this repository is even viewable, authz-wise.
        if not vclib.check_root_access(self):
            raise vclib.ReposNotFound(name)
Beispiel #2
0
    def __init__(self, name, rootpath, authorizer, utilities, config_dir):
        if not (os.path.isdir(rootpath) \
                and os.path.isfile(os.path.join(rootpath, 'format'))):
            raise vclib.ReposNotFound(name)

        # Initialize some stuff.
        self.rootpath = rootpath
        self.name = name
        self.auth = authorizer
        self.diff_cmd = utilities.diff or 'diff'
        self.config_dir = config_dir or None

        # See if this repository is even viewable, authz-wise.
        if not vclib.check_root_access(self):
            raise vclib.ReposNotFound(name)
Beispiel #3
0
    def __init__(self, name, rootpath, authorizer, utilities, config_dir):
        self.name = name
        self.rootpath = rootpath
        self.auth = authorizer
        self.diff_cmd = utilities.diff or 'diff'
        self.config_dir = config_dir or None

        # See if this repository is even viewable, authz-wise.
        if not vclib.check_root_access(self):
            raise vclib.ReposNotFound(name)
Beispiel #4
0
    def __init__(self, name, rootpath, svn_path):
        if not os.path.isdir(rootpath):
            raise vclib.ReposNotFound(name)

        # Initialize some stuff.
        self.pool = None
        self.apr_init = 0
        self.rootpath = rootpath
        self.name = name
        self.svn_client_path = os.path.normpath(os.path.join(svn_path, 'svn'))

        # Register a handler for SIGTERM so we can have a chance to
        # cleanup.  If ViewVC takes too long to start generating CGI
        # output, Apache will grow impatient and SIGTERM it.  While we
        # don't mind getting told to bail, we want to gracefully close the
        # repository before we bail.
        def _sigterm_handler(signum, frame, self=self):
            self._close()
            sys.exit(-1)

        try:
            signal.signal(signal.SIGTERM, _sigterm_handler)
        except ValueError:
            # This is probably "ValueError: signal only works in main
            # thread", which will get thrown by the likes of mod_python
            # when trying to install a signal handler from a thread that
            # isn't the main one.  We'll just not care.
            pass

        # Initialize APR and get our top-level pool.
        core.apr_initialize()
        self.apr_init = 1
        self.pool = core.svn_pool_create(None)
        self.scratch_pool = core.svn_pool_create(self.pool)

        # Open the repository and init some other variables.
        self.repos = repos.svn_repos_open(rootpath, self.pool)
        self.fs_ptr = repos.svn_repos_fs(self.repos)
        self.youngest = fs.youngest_rev(self.fs_ptr, self.pool)
        self._fsroots = {}
Beispiel #5
0
    def __init__(self, name, rootpath):
        if not os.path.isdir(rootpath):
            raise vclib.ReposNotFound(name)

        self.name = name
        self.rootpath = rootpath