Advertisement
lenkaseg

create_pull_request

Jan 18th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.27 KB | None | 0 0
  1.     def create_pull_request(self, repo, title, branch_to, branch_from,
  2.             initial_comment=None):
  3.         """
  4.        Create pull-request
  5.         -------------------
  6.        Open a new pull-request from this project to itself or its parent (if
  7.        this project is a fork).
  8.        :param repo: the repo of the pull-request
  9.        :param title: the title to give the pull-request
  10.        :param branch_to: the name of the branch the submitted changes should
  11.            be merged into
  12.        :param branch_from: the name of the branch containing the changes to merge
  13.        :param initial_comment: the initial comment describing what these changes
  14.            are about
  15.        :return:
  16.        """
  17.         request_url = "{}pull-request/new".format(self.create_basic_url())
  18.         #request_url = 'https://pagure.io/api/0/carrot/pull-request/new'
  19.         print(request_url)
  20.  
  21.         payload = {"title": title,
  22.                 "branch_to": branch_to, "branch_from": branch_from
  23.                 }
  24.         if initial_comment is not None:
  25.             payload["initial_comment"] = initial_comment
  26.  
  27.         return_value = self._call_api(request_url, method="POST", data=payload)
  28.        
  29.         LOG.debug(return_value)
  30.        
  31.         return return_value
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement