コード例 #1
0
    def __init__(self, repo_or_path, origin_uri=None, auth=None, report_activity=None, *args, **kwargs):
        if isinstance(repo_or_path, DulwichRepo):
            self.repo = repo_or_path
        elif isinstance(repo_or_path, Gittle):
            self.repo = DulwichRepo(repo_or_path.path)
        elif isinstance(repo_or_path, basestring):
            path = os.path.abspath(repo_or_path)
            self.repo = DulwichRepo(path)
        else:
            logging.warning('Repo is of type %s' % type(repo_or_path))
            raise Exception('Gittle must be initialized with either a dulwich repository or a string to the path')

        # Set path
        self.path = self.repo.path

        # The remote url
        self.origin_uri = origin_uri

        # Report client activty
        self._report_activity = report_activity

        # Build ignore filter
        self.hidden_regexes = copy.copy(self.HIDDEN_REGEXES)
        self.hidden_regexes.extend(self._get_ignore_regexes())
        self.ignore_filter = utils.paths.path_filter_regex(self.hidden_regexes)
        self.filters = [
            self.ignore_filter,
        ]

        # Get authenticator
        if auth:
            self.authenticator = auth
        else:
            self.auth(*args, **kwargs)
コード例 #2
0
 def __init__(self, objects_root):
     """Initalize this instance"""
     PureGitODB.__init__(self, objects_root)
     if hasattr(self, 'working_dir'):
         wd = self.working_dir
     else:
         wd = os.path.dirname(os.path.dirname(objects_root))
     # END try to figure out good entry for dulwich, which doesn't do an extensive search
     self._dw_repo = DulwichRepo(wd)
コード例 #3
0
 def __init__(self, path):
     self.repo = DulwichRepo(path)  # The inner Dulwich Repo object.
     self.root = path
コード例 #4
0
ファイル: backend.py プロジェクト: vikramahuja1001/backend
 def load_repo(self, repo_name):
     self.repo_name = repo_name
     self.repo = DulwichRepo(self.repo_name)
     self.current_dir = os.getcwd()
     self.repo_path = self.current_dir + '/' + self.repo_name