changeset 31753:5d11b5edcb0b

revlog: use raw revisions in revdiff See the added comment. revdiff is meant to output the raw delta that will be written to revlog. It should use raw. test-revlog-raw.py now shows "addgroupcopy test passed", but there is more to fix.
author Jun Wu <quark@fb.com>
date Thu, 30 Mar 2017 18:23:27 -0700
parents f424fb180fea
children 5b93c6fdb391
files mercurial/revlog.py tests/test-revlog-raw.py.out
diffstat 2 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Thu Mar 30 17:58:03 2017 -0700
+++ b/mercurial/revlog.py	Thu Mar 30 18:23:27 2017 -0700
@@ -1239,12 +1239,16 @@
             return rev - 1
 
     def revdiff(self, rev1, rev2):
-        """return or calculate a delta between two revisions"""
+        """return or calculate a delta between two revisions
+
+        The delta calculated is in binary form and is intended to be written to
+        revlog data directly. So this function needs raw revision data.
+        """
         if rev1 != nullrev and self.deltaparent(rev2) == rev1:
             return bytes(self._chunk(rev2))
 
-        return mdiff.textdiff(self.revision(rev1),
-                              self.revision(rev2))
+        return mdiff.textdiff(self.revision(rev1, raw=True),
+                              self.revision(rev2, raw=True))
 
     def revision(self, nodeorrev, _df=None, raw=False):
         """return an uncompressed revision of a given node or revision
--- a/tests/test-revlog-raw.py.out	Thu Mar 30 17:58:03 2017 -0700
+++ b/tests/test-revlog-raw.py.out	Thu Mar 30 18:23:27 2017 -0700
@@ -1,2 +1,3 @@
 local test passed
+addgroupcopy test passed
 abort: crashed: invalid patch