#42 add repo_from correction
Merged 5 years ago by cverna. Opened 5 years ago by lenkaseg.
lenkaseg/libpagure repo_from  into  master

file modified
+10 -14
@@ -33,7 +33,7 @@ 

      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 @@ 

          """

          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 @@ 

          """

          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 @@ 

                  )

              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 @@ 

  

          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 @@ 

          :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 @@ 

              "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

Correction of the errors in repo_to and repo_from variables.

Pull-Request has been merged by cverna

5 years ago

I assume consumers of this that were using pagure_repository will now need to provide repo_to ? I suspect you'll have some people opening issues when their code starts breaking.

I assume consumers of this that were using pagure_repository will now need to provide repo_to ? I suspect you'll have some people opening issues when their code starts breaking.

True. I will fix it.

Should be fixed in PR #45
Could you please check it?

Should be fixed in PR #45
Could you please check it?

looks like it should work. I'm not sure of the lineage of repo_to, but if it is more correct you could allow for both options (for backwards compatibility) and just set it as repo_t in the init function.

Metadata