예제 #1
0
def get_repo(alias, url):
    """Returns a git repository object initialized for usage.
    """

    repo = GitRepo(url)
    repo.get_revs()
    repo.get_head()

    hasher = _digest()
    hasher.update(repo.path)
    repo.hash = hasher.hexdigest()

    repo.get_base_path = lambda base: os.path.join(base, 'info', 'fast-import',
                                                   repo.hash)

    prefix = 'refs/testgit/%s/' % alias
    debug("prefix: '%s'", prefix)

    repo.gitdir = ""
    repo.alias = alias
    repo.prefix = prefix

    repo.exporter = GitExporter(repo)
    repo.importer = GitImporter(repo)
    repo.non_local = NonLocalGit(repo)

    return repo
예제 #2
0
    def get_repo(self, alias, url):
        """Returns a git repository object initialized for usage.
        """

        repo = GitRepo(url)
        repo.get_revs()
        repo.get_head()

        prefix = 'refs/testgit/%s/' % alias
        debug("prefix: '%s'", prefix)

        repo.marksfile = 'testgit.marks'
        repo.prefix = prefix

        self.setup_repo(repo, alias)

        repo.exporter = GitExporter(repo)
        repo.importer = GitImporter(repo)
        repo.non_local = NonLocalGit(repo)

        return repo