From 61206079bc9a8a9c4b161d7a48bac74af1b15dbd Mon Sep 17 00:00:00 2001 From: Lenka Segura Date: May 07 2019 10:37:29 +0000 Subject: add repo_from correction --- diff --git a/libpagure/libpagure.py b/libpagure/libpagure.py index d06ff43..0535ea6 100644 --- a/libpagure/libpagure.py +++ b/libpagure/libpagure.py @@ -33,7 +33,7 @@ class Pagure(object): def __init__( self, pagure_token=None, - pagure_repository=None, + repo_to=None, fork_username=None, namespace=None, instance_url="https://pagure.io", @@ -42,14 +42,14 @@ class Pagure(object): """ Create an instance. :param pagure_token: pagure API token - :param pagure_repository: pagure project name + :param repo_to: pagure project name :param fork_username: if this is a fork, it's the username of the fork creator :param instance_url: the URL of pagure instance name :return: """ self.token = pagure_token - self.repo = pagure_repository + self.repo_to = repo_to self.username = fork_username self.namespace = namespace self.instance = instance_url @@ -117,7 +117,7 @@ class Pagure(object): """ if self.username is None: if self.namespace is None: - request_url = "{}/api/0/{}/".format(self.instance, self.repo) + request_url = "{}/api/0/{}/".format(self.instance, self.repo_to) else: request_url = "{}/api/0/{}/{}/".format( self.instance, self.namespace, self.repo_to @@ -129,7 +129,7 @@ class Pagure(object): ) else: request_url = "{}/api/0/fork/{}/{}/{}/".format( - self.instance, self.username, self.namespace, self.repo + self.instance, self.username, self.namespace, self.repo_to ) return request_url @@ -628,7 +628,7 @@ class Pagure(object): return return_value["activities"] - def create_pull_request(self, title, branch_to, branch_from, initial_comment=None): + def create_pull_request(self, title, branch_to, branch_from, repo_from, initial_comment=None): """ Create pull-request ------------------- @@ -641,11 +641,7 @@ class Pagure(object): :param initial_comment: the initial comment describing what these changes are about :param repo_from: the name on the project the changes originate from, - received as a dictionary and posted as a string - :param repo_from_username: the username of the project the changes - originate from, received as a dictionary and posted as a string - :param repo_from_namespace: the namespace of the project the changes - originate from, received as a dictionary and posted as a string + received as a dictionary and posted as three strings :return: """ request_url = "{}pull-request/new".format(self.create_basic_url()) @@ -653,9 +649,9 @@ class Pagure(object): "title": title, "branch_to": branch_to, "branch_from": branch_from, - "repo_from": self.repo_from["repo"], - "repo_from_username": self.repo_from["username"], - "repo_from_namespace": self.repo_from["namespace"], + "repo_from": repo_from["repo"], + "repo_from_username": repo_from["username"], + "repo_from_namespace": repo_from["namespace"], } if initial_comment is not None: payload["initial_comment"] = initial_comment