@@ -1475,7 +1475,7 @@ def blob(self, sha, filepath, **kwargs):
14751475 return r .content
14761476
14771477 def raw_blob (self , sha , ** kwargs ):
1478- """Return the raw file contents for a blob by blob SHA.
1478+ """Returns the raw file contents for a blob by blob SHA.
14791479
14801480 Args:
14811481 sha(str): ID of the blob
@@ -1492,6 +1492,26 @@ def raw_blob(self, sha, **kwargs):
14921492 raise_error_from_response (r , GitlabGetError )
14931493 return r .content
14941494
1495+ def compare (self , from_ , to , ** kwargs ):
1496+ """Returns a diff between two branches/commits.
1497+
1498+ Args:
1499+ from_(str): orig branch/SHA
1500+ to(str): dest branch/SHA
1501+
1502+ Returns:
1503+ str: The diff
1504+
1505+ Raises:
1506+ GitlabConnectionError: If the server cannot be reached.
1507+ GitlabGetError: If the server fails to perform the request.
1508+ """
1509+ url = "/projects/%s/repository/compare" % self .id
1510+ url = "%s?from=%s&to=%s" % (url , from_ , to )
1511+ r = self .gitlab ._raw_get (url , ** kwargs )
1512+ raise_error_from_response (r , GitlabGetError )
1513+ return r .json ()
1514+
14951515 def archive (self , sha = None , ** kwargs ):
14961516 """Return a tarball of the repository.
14971517
0 commit comments