@@ -1475,7 +1475,7 @@ def blob(self, sha, filepath, **kwargs):
1475
1475
return r .content
1476
1476
1477
1477
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.
1479
1479
1480
1480
Args:
1481
1481
sha(str): ID of the blob
@@ -1492,6 +1492,26 @@ def raw_blob(self, sha, **kwargs):
1492
1492
raise_error_from_response (r , GitlabGetError )
1493
1493
return r .content
1494
1494
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
+
1495
1515
def archive (self , sha = None , ** kwargs ):
1496
1516
"""Return a tarball of the repository.
1497
1517
0 commit comments