Пример #1
0
def open_or_create_repo(path):
    """Open an existing repo, or create a new one

    :param path: path to recipe directory
    :type path: string
    :returns: A repository object
    :rtype: Git.Repository
    :raises: Can raise errors from Ggit

    A bare git repo will be created in the git directory of the specified path.
    If a repo already exists it will be opened and returned instead of
    creating a new one.
    """
    Git.init()
    git_path = joinpaths(path, "git")
    if os.path.exists(joinpaths(git_path, "HEAD")):
        return Git.Repository.open(gfile(git_path))

    repo = Git.Repository.init_repository(gfile(git_path), True)

    # Make an initial empty commit
    sig = Git.Signature.new_now("bdcs-api-server", "user-email")
    tree_id = repo.get_index().write_tree()
    tree = repo.lookup(tree_id, Git.Tree)
    repo.create_commit("HEAD", sig, sig, "UTF-8", "Initial Recipe repository commit", tree, [])
    return repo
Пример #2
0
    def __init__(self):
        GObject.Object.__init__(self)

        Ggit.init()

        self.diff_timeout = 0
        self.file_contents_list = None
        self.file_context = None
Пример #3
0
    def __init__(self):
        GObject.Object.__init__(self)

        Ggit.init()

        self.diff_timeout = 0
        self.file_contents_list = None
        self.file_context = None
Пример #4
0
    def __init__(self):
        super().__init__()

        Ggit.init()

        self.view_activatables = weakref.WeakSet()

        self.files = {}
        self.monitors = {}

        self.repo = None
        self.tree = None
Пример #5
0
    def __init__(self):
        super().__init__()

        Ggit.init()

        GitAppActivatable.__instance = self
Пример #6
0
    def __init__(self):
        super().__init__()

        Ggit.init()

        GitAppActivatable.__instance = self