# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/.
import json
from six.moves.urllib.parse import urljoin
requests = None
class GitHubError(Exception): def __init__(self, status, data):
self.status = status
self.data = data
def create_pr(self, title, head, base, body): """Create a Pull Request in the repository
:param title: Pull Request title
:param head: ref to the HEAD of the PR branch.
:param base: ref to the base branch for the Pull Request
:param body: Description of the PR """ return PullRequest.create(self, title, head, base, body)
def load_pr(self, number): """Load an existing Pull Request by number.
:param number: Pull Request number """ return PullRequest.from_number(self, number)
@property def issue(self): """Issue related to the Pull Request""" if self._issue isNone:
self._issue = Issue.from_number(self.repo, self.number) return self._issue
def merge(self): """Merge the Pull Request into its base branch."""
self.repo.gh.put(
self.path("merge"),
{"merge_method": "merge"},
headers={"Accept": "application/vnd.github.polaris-preview+json"},
)
class Issue(object): def __init__(self, repo, data): """Object representing a GitHub Issue"""
self.repo = repo
self._data = data
self.number = data["number"]
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.