8000 Merge pull request #727 from balloob/add-merge-commit-sha · pythonthings/github3.py@47727c9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 47727c9

Browse files
authored
Merge pull request sigmavirus24#727 from balloob/add-merge-commit-sha
Add merge_commit_sha attribute to PullRequest object
2 parents 6dcfd1d + ac8b91f commit 47727c9

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

github3/pulls.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,12 @@ def _update_attributes(self, pull):
185185
#: Dictionary of _links. Changed in 1.0
186186
self.links = self._get_attribute(pull, '_links', {})
187187

188+
#: If unmerged, holds the sha of the commit to test mergability.
189+
#: If merged, holds commit sha of the merge commit, squashed commit on
190+
#: the base branch or the commit that the base branch was updated to
191+
#: after rebasing the PR.
192+
self.merge_commit_sha = self._get_attribute(pull, 'merge_commit_sha')
193+
188194
#: Boolean representing whether the pull request has been merged
189195
self.merged = self._get_attribute(pull, 'merged')
190196

tests/unit/test_pulls.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,13 @@ def test_update(self):
144144
}
145145
)
146146

147+
def test_attributes(self):
148+
"""Show that we extract attributes correctly."""
149+
assert self.instance.merge_commit_sha == \
150+
'e5bd3914e2e596debea16f433f57875b5b90bcd6'
151+
assert not self.instance.merged
152+
assert self.instance.mergeable
153+
147154

148155
class TestPullRequestRequiresAuthentication(
149156
helper.UnitRequiresAuthenticationHelper):

0 commit comments

Comments
 (0)
0