mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 10:51:14 +00:00
Structure the result of PullRequest.merge
This commit is contained in:
@@ -1125,6 +1125,14 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "PullRequestMergeStatus",
|
||||
"attributes": [
|
||||
{ "name": "sha", "type": "string" },
|
||||
{ "name": "merged", "type": "bool" },
|
||||
{ "name": "message", "type": "string" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "PullRequest",
|
||||
"isCompletable": true,
|
||||
@@ -1223,7 +1231,7 @@
|
||||
},
|
||||
{
|
||||
"name": [ "merge" ],
|
||||
"type": "void",
|
||||
"type": "PullRequestMergeStatus",
|
||||
"group": "merging",
|
||||
"optionalParameters": [
|
||||
{ "name": "commit_message", "type": "string" }
|
||||
|
||||
@@ -7085,9 +7085,9 @@
|
||||
}
|
||||
],
|
||||
"type": {
|
||||
"simple": true,
|
||||
"simple": false,
|
||||
"cardinality": "scalar",
|
||||
"name": "void"
|
||||
"name": "PullRequestMergeStatus"
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -7329,6 +7329,37 @@
|
||||
"name": "PullRequestFile",
|
||||
"methods": []
|
||||
},
|
||||
{
|
||||
"attributes": [
|
||||
{
|
||||
"type": {
|
||||
"simple": true,
|
||||
"cardinality": "scalar",
|
||||
"name": "bool"
|
||||
},
|
||||
"name": "merged"
|
||||
},
|
||||
{
|
||||
"type": {
|
||||
"simple": true,
|
||||
"cardinality": "scalar",
|
||||
"name": "string"
|
||||
},
|
||||
"name": "message"
|
||||
},
|
||||
{
|
||||
"type": {
|
||||
"simple": true,
|
||||
"cardinality": "scalar",
|
||||
"name": "string"
|
||||
},
|
||||
"name": "sha"
|
||||
}
|
||||
],
|
||||
"isCompletable": false,
|
||||
"name": "PullRequestMergeStatus",
|
||||
"methods": []
|
||||
},
|
||||
{
|
||||
"attributes": [
|
||||
{
|
||||
|
||||
@@ -914,7 +914,7 @@ Files
|
||||
Merging
|
||||
-------
|
||||
* `is_merged()`: bool
|
||||
* `merge( [commit_message] )`
|
||||
* `merge( [commit_message] )`: `PullRequestMergeStatus`
|
||||
* `commit_message`: string
|
||||
|
||||
Modification
|
||||
@@ -965,6 +965,15 @@ Attributes
|
||||
* `sha`: string
|
||||
* `status`: string
|
||||
|
||||
Class `PullRequestMergeStatus`
|
||||
==============================
|
||||
|
||||
Attributes
|
||||
----------
|
||||
* `merged`: bool
|
||||
* `message`: string
|
||||
* `sha`: string
|
||||
|
||||
Class `Repository`
|
||||
==================
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import PaginatedList
|
||||
from GithubObject import *
|
||||
import Commit
|
||||
import NamedUser
|
||||
import PullRequestMergeStatus
|
||||
import PullRequestComment
|
||||
import PullRequestFile
|
||||
|
||||
@@ -261,6 +262,7 @@ class PullRequest( object ):
|
||||
None,
|
||||
post_parameters
|
||||
)
|
||||
return PullRequestMergeStatus.PullRequestMergeStatus( self.__requester, data, completion = NoCompletion )
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__additions = None
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
# WARNING: this file is generated automaticaly.
|
||||
# Do not modify it manually, your work would be lost.
|
||||
|
||||
import PaginatedList
|
||||
from GithubObject import *
|
||||
|
||||
class PullRequestMergeStatus( object ):
|
||||
def __init__( self, requester, attributes, completion ):
|
||||
self.__requester = requester
|
||||
self.__initAttributes()
|
||||
self.__useAttributes( attributes )
|
||||
|
||||
@property
|
||||
def merged( self ):
|
||||
return self.__merged
|
||||
|
||||
@property
|
||||
def message( self ):
|
||||
return self.__message
|
||||
|
||||
@property
|
||||
def sha( self ):
|
||||
return self.__sha
|
||||
|
||||
def __initAttributes( self ):
|
||||
self.__merged = None
|
||||
self.__message = None
|
||||
self.__sha = None
|
||||
|
||||
def __useAttributes( self, attributes ):
|
||||
if "merged" in attributes and attributes[ "merged" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "merged" ], bool ), attributes[ "merged" ]
|
||||
self.__merged = attributes[ "merged" ]
|
||||
if "message" in attributes and attributes[ "message" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "message" ], ( str, unicode ) ), attributes[ "message" ]
|
||||
self.__message = attributes[ "message" ]
|
||||
if "sha" in attributes and attributes[ "sha" ] is not None: # pragma no branch
|
||||
assert isinstance( attributes[ "sha" ], ( str, unicode ) ), attributes[ "sha" ]
|
||||
self.__sha = attributes[ "sha" ]
|
||||
@@ -58,6 +58,9 @@ class PullRequest( Framework.TestCase ):
|
||||
def testMerge( self ):
|
||||
self.assertFalse( self.pull.is_merged() )
|
||||
status = self.pull.merge()
|
||||
self.assertEqual( status.sha, "688208b1a5a074871d0e9376119556897439697d" )
|
||||
self.assertEqual( status.merged, True )
|
||||
self.assertEqual( status.message, "Pull Request successfully merged" )
|
||||
self.assertTrue( self.pull.is_merged() )
|
||||
|
||||
def testMergeWithCommitMessage( self ):
|
||||
|
||||
Reference in New Issue
Block a user