@@ -1648,15 +1648,27 @@ def __init__(self, commit, session=None):
1648
1648
def __repr__ (self ):
1649
1649
return '<Repository Commit [{0}]>' .format (self .sha [:7 ])
1650
1650
1651
+ def diff (self ):
1652
+ """Return the diff"""
1653
+ resp = self ._get (self ._api ,
1654
+ headers = {'Accept' : 'application/vnd.github.diff' })
1655
+ return resp .content if self ._boolean (resp , 200 , 404 ) else None
1651
1656
1652
- class Comparison (GitHubObject ):
1657
+ def patch (self ):
1658
+ """Return the patch"""
1659
+ resp = self ._get (self ._api ,
1660
+ headers = {'Accept' : 'application/vnd.github.patch' })
1661
+ return resp .content if self ._boolean (resp , 200 , 404 ) else None
1662
+
1663
+
1664
+ class Comparison (GitHubCore ):
1653
1665
"""The :class:`Comparison <Comparison>` object. This encapsulates the
1654
1666
information returned by GitHub comparing two commit objects in a
1655
1667
repository."""
1656
1668
1657
1669
def __init__ (self , compare ):
1658
1670
super (Comparison , self ).__init__ (compare )
1659
- self ._api = compare .get ('api ' , '' )
1671
+ self ._api = compare .get ('url ' , '' )
1660
1672
#: URL to view the comparison at GitHub
1661
1673
self .html_url = compare .get ('html_url' )
1662
1674
#: Permanent link to this comparison.
@@ -1684,6 +1696,18 @@ def __init__(self, compare):
1684
1696
def __repr__ (self ):
1685
1697
return '<Comparison of {0} commits>' .format (self .total_commits )
1686
1698
1699
+ def diff (self ):
1700
+ """Return the diff"""
1701
+ resp = self ._get (self ._api ,
1702
+ headers = {'Accept' : 'application/vnd.github.diff' })
1703
+ return resp .content if self ._boolean (resp , 200 , 404 ) else None
1704
+
1705
+ def patch (self ):
1706
+ """Return the patch"""
1707
+ resp = self ._get (self ._api ,
1708
+ headers = {'Accept' : 'application/vnd.github.patch' })
1709
+ return resp .content if self ._boolean (resp , 200 , 404 ) else None
1710
+
1687
1711
1688
1712
class Status (GitHubObject ):
1689
1713
"""The :class:`Status <Status>` object. This represents information from
0 commit comments