D2069: revlog: resolve lfs rawtext to vanilla rawtext before applying delta

quark (Jun Wu) phabricator at mercurial-scm.org
Tue Mar 6 13:55:24 EST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG369aadf7a326: revlog: resolve lfs rawtext to vanilla rawtext before applying delta (authored by quark, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2069?vs=6471&id=6674

REVISION DETAIL
  https://phab.mercurial-scm.org/D2069

AFFECTED FILES
  mercurial/revlog.py
  tests/test-lfs-bundle.t

CHANGE DETAILS

diff --git a/tests/test-lfs-bundle.t b/tests/test-lfs-bundle.t
--- a/tests/test-lfs-bundle.t
+++ b/tests/test-lfs-bundle.t
@@ -90,7 +90,7 @@
   ---- Applying src-normal.bundle to dst-normal ----
   OK
   ---- Applying src-normal.bundle to dst-lfs ----
-  CRASHED
+  OK
   ---- Applying src-lfs.bundle to dst-normal ----
   OK
   ---- Applying src-lfs.bundle to dst-lfs ----
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -336,7 +336,9 @@
                                                    len(delta) - hlen):
             btext[0] = delta[hlen:]
         else:
-            basetext = revlog.revision(baserev, _df=fh, raw=True)
+            # deltabase is rawtext before changed by flag processors, which is
+            # equivalent to non-raw text
+            basetext = revlog.revision(baserev, _df=fh, raw=False)
             btext[0] = mdiff.patch(basetext, delta)
 
         try:
@@ -2084,7 +2086,10 @@
         # full versions are inserted when the needed deltas
         # become comparable to the uncompressed text
         if rawtext is None:
-            textlen = mdiff.patchedsize(self.rawsize(cachedelta[0]),
+            # need rawtext size, before changed by flag processors, which is
+            # the non-raw size. use revlog explicitly to avoid filelog's extra
+            # logic that might remove metadata size.
+            textlen = mdiff.patchedsize(revlog.size(self, cachedelta[0]),
                                         cachedelta[1])
         else:
             textlen = len(rawtext)



To: quark, indygreg, #hg-reviewers, ryanmce
Cc: mercurial-devel


More information about the Mercurial-devel mailing list