mercurial/utils/storageutil.py
branchstable
changeset 49787 bb2c663c840f
parent 49786 0bda07f34c01
child 49788 31b4675ca998
equal deleted inserted replaced
49786:0bda07f34c01 49787:bb2c663c840f
   428             baserev = p1rev
   428             baserev = p1rev
   429 
   429 
   430         # There is a delta in storage. We try to use that because it
   430         # There is a delta in storage. We try to use that because it
   431         # amounts to effectively copying data from storage and is
   431         # amounts to effectively copying data from storage and is
   432         # therefore the fastest.
   432         # therefore the fastest.
   433         elif deltaparentrev != nullrev:
   433         elif is_usable_base(deltaparentrev):
   434             # If the stored delta works, let us use it !
   434             baserev = deltaparentrev
   435             if is_usable_base(deltaparentrev):
   435         else:
   436                 baserev = deltaparentrev
   436             # No guarantee the receiver has the delta parent, or Storage has a
   437             # No guarantee the receiver has the delta parent. Send delta
   437             # fulltext revision.
   438             # against last revision (if possible), which in the common case
   438             #
   439             # should be similar enough to this revision that the delta is
   439             # Send delta against last revision (if possible), which in the
   440             # reasonable.
   440             # common case should be similar enough to this revision that the
   441             elif prevrev is not None:
   441             # delta is reasonable.
       
   442             if prevrev is not None:
   442                 baserev = prevrev
   443                 baserev = prevrev
   443             else:
   444             else:
   444                 baserev = nullrev
   445                 baserev = nullrev
   445 
       
   446         # Storage has a fulltext revision.
       
   447 
       
   448         # Let's use the previous revision, which is as good a guess as any.
       
   449         # There is definitely room to improve this logic.
       
   450         elif prevrev is not None:
       
   451             baserev = prevrev
       
   452         else:
       
   453             baserev = nullrev
       
   454 
   446 
   455         # But we can't actually use our chosen delta base for whatever
   447         # But we can't actually use our chosen delta base for whatever
   456         # reason. Reset to fulltext.
   448         # reason. Reset to fulltext.
   457         if baserev != nullrev and (candeltafn and not candeltafn(baserev, rev)):
   449         if baserev != nullrev and (candeltafn and not candeltafn(baserev, rev)):
   458             baserev = nullrev
   450             baserev = nullrev