Пример #1
0
    def clone(self, task, project_name):
        callbacks = RemoteCallbacks(self)

        fetch_options = Ggit.FetchOptions()
        fetch_options.set_remote_callbacks(callbacks)

        clone_options = Ggit.CloneOptions()
        clone_options.set_is_bare(False)
        clone_options.set_checkout_branch("master")
        clone_options.set_fetch_options(fetch_options)

        uri = self.get_project_uri(project_name)
        self.location = self.get_project_dir(project_name)

        self.write_line("Cloning %s into %s ..." %
                        (project_name, self.location.get_path()))

        try:
            repository = Ggit.Repository.clone(uri, self.location,
                                               clone_options)
        except Exception as ex:
            self.printerr(ex.message)
            task.return_int(1)
            return

        # TODO: Find project dependencies, install
        #       that could be xdg-app runtime, jhbuild, etc
        #self.write_line("Locating project dependencies")

        # Load the project and try to build it.
        Ide.Context.new_async(self.location, task.get_cancellable(),
                              self.get_context_cb, task)
Пример #2
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
Пример #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):
        GObject.Object.__init__(self)

        Ggit.init()

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

        Ggit.init()

        self.view_activatables = weakref.WeakSet()

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

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

        Ggit.init()

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

        Ggit.init()

        GitAppActivatable.__instance = self