Ejemplo n.º 1
0
    def __init__(
        self,
        path,
        params,
        log,
        persistent_cache=False,
        git_bin='git',
        git_fs_encoding='utf-8',
        shortrev_len=7,
        rlookup_uid=lambda _: None,
        use_committer_id=False,
        use_committer_time=False,
    ):

        self.logger = log
        self.gitrepo = path
        self.params = params
        self.shortrev_len = max(4, min(shortrev_len, 40))
        self.rlookup_uid = rlookup_uid
        self.use_committer_time = use_committer_time
        self.use_committer_id = use_committer_id

        try:
            self.git = PyGIT.StorageFactory(path, log, not persistent_cache,
                                            git_bin=git_bin,
                                            git_fs_encoding=git_fs_encoding) \
                            .getInstance()
        except PyGIT.GitError, e:
            raise TracError("%s does not appear to be a Git "
                            "repository." % path)
Ejemplo n.º 2
0
    def __init__(self, env, path, params, log,
                 persistent_cache=False,
                 git_bin='git',
                 git_fs_encoding='utf-8',
                 shortrev_len=7,
                 rlookup_uid=lambda _: None,
                 use_committer_id=False,
                 use_committer_time=False,
                 ):

        self.env = env
        self.logger = log
        self.gitrepo = path
        self.params = params
        self.persistent_cache = persistent_cache
        self.shortrev_len = max(4, min(shortrev_len, 40))
        self.rlookup_uid = rlookup_uid
        self.use_committer_time = use_committer_time
        self.use_committer_id = use_committer_id

        try:
            factory = PyGIT.StorageFactory(path, log, not persistent_cache,
                                           git_bin=git_bin,
                                           git_fs_encoding=git_fs_encoding)
            self._git = factory.getInstance()
        except PyGIT.GitError as e:
            log.error(exception_to_unicode(e))
            raise InvalidRepository(
                _("%(path)s does not appear to be a Git repository.",
                  path=path))

        Repository.__init__(self, 'git:' + path, self.params, log)
        self._cached_git_id = str(self.id)
Ejemplo n.º 3
0
    def __init__(
        self,
        path,
        params,
        log,
        persistent_cache=False,
        git_bin='git',
        git_fs_encoding='utf-8',
        shortrev_len=7,
        rlookup_uid=lambda _: None,
        use_committer_id=False,
        use_committer_time=False,
    ):

        self.logger = log
        self.gitrepo = path
        self.params = params
        self._shortrev_len = max(4, min(shortrev_len, 40))
        self.rlookup_uid = rlookup_uid
        self._use_committer_time = use_committer_time
        self._use_committer_id = use_committer_id

        self.git = PyGIT.StorageFactory(path, log, not persistent_cache,
                                        git_bin=git_bin,
                                        git_fs_encoding=git_fs_encoding) \
                        .getInstance()

        Repository.__init__(self, 'git:' + path, self.params, log)