##// END OF EJS Templates
deltas: at a `target_rev` parameter to finddeltainfo...
marmoute -
r48249:93f4e183 default
parent child Browse files
Show More
@@ -1033,8 +1033,7 b' class deltacomputer(object):'
1033 snapshotdepth,
1033 snapshotdepth,
1034 )
1034 )
1035
1035
1036 def _fullsnapshotinfo(self, fh, revinfo):
1036 def _fullsnapshotinfo(self, fh, revinfo, curr):
1037 curr = len(self.revlog)
1038 rawtext = self.buildtext(revinfo, fh)
1037 rawtext = self.buildtext(revinfo, fh)
1039 data = self.revlog.compress(rawtext)
1038 data = self.revlog.compress(rawtext)
1040 compresseddeltalen = deltalen = dist = len(data[1]) + len(data[0])
1039 compresseddeltalen = deltalen = dist = len(data[1]) + len(data[0])
@@ -1053,7 +1052,7 b' class deltacomputer(object):'
1053 snapshotdepth,
1052 snapshotdepth,
1054 )
1053 )
1055
1054
1056 def finddeltainfo(self, revinfo, fh, excluded_bases=None):
1055 def finddeltainfo(self, revinfo, fh, excluded_bases=None, target_rev=None):
1057 """Find an acceptable delta against a candidate revision
1056 """Find an acceptable delta against a candidate revision
1058
1057
1059 revinfo: information about the revision (instance of _revisioninfo)
1058 revinfo: information about the revision (instance of _revisioninfo)
@@ -1070,8 +1069,11 b' class deltacomputer(object):'
1070 a delta base. Use this to recompute delta suitable in censor or strip
1069 a delta base. Use this to recompute delta suitable in censor or strip
1071 context.
1070 context.
1072 """
1071 """
1072 if target_rev is None:
1073 curr = len(self.revlog)
1074
1073 if not revinfo.textlen:
1075 if not revinfo.textlen:
1074 return self._fullsnapshotinfo(fh, revinfo)
1076 return self._fullsnapshotinfo(fh, revinfo, target_rev)
1075
1077
1076 if excluded_bases is None:
1078 if excluded_bases is None:
1077 excluded_bases = set()
1079 excluded_bases = set()
@@ -1080,7 +1082,7 b' class deltacomputer(object):'
1080 # not calling candelta since only one revision needs test, also to
1082 # not calling candelta since only one revision needs test, also to
1081 # avoid overhead fetching flags again.
1083 # avoid overhead fetching flags again.
1082 if revinfo.flags & REVIDX_RAWTEXT_CHANGING_FLAGS:
1084 if revinfo.flags & REVIDX_RAWTEXT_CHANGING_FLAGS:
1083 return self._fullsnapshotinfo(fh, revinfo)
1085 return self._fullsnapshotinfo(fh, revinfo, target_rev)
1084
1086
1085 cachedelta = revinfo.cachedelta
1087 cachedelta = revinfo.cachedelta
1086 p1 = revinfo.p1
1088 p1 = revinfo.p1
@@ -1102,6 +1104,8 b' class deltacomputer(object):'
1102 for candidaterev in candidaterevs:
1104 for candidaterev in candidaterevs:
1103 if candidaterev in excluded_bases:
1105 if candidaterev in excluded_bases:
1104 continue
1106 continue
1107 if candidaterev >= target_rev:
1108 continue
1105 candidatedelta = self._builddeltainfo(revinfo, candidaterev, fh)
1109 candidatedelta = self._builddeltainfo(revinfo, candidaterev, fh)
1106 if candidatedelta is not None:
1110 if candidatedelta is not None:
1107 if isgooddeltainfo(self.revlog, candidatedelta, revinfo):
1111 if isgooddeltainfo(self.revlog, candidatedelta, revinfo):
@@ -1114,7 +1118,7 b' class deltacomputer(object):'
1114 candidaterevs = next(groups)
1118 candidaterevs = next(groups)
1115
1119
1116 if deltainfo is None:
1120 if deltainfo is None:
1117 deltainfo = self._fullsnapshotinfo(fh, revinfo)
1121 deltainfo = self._fullsnapshotinfo(fh, revinfo, target_rev)
1118 return deltainfo
1122 return deltainfo
1119
1123
1120
1124
General Comments 0
You need to be logged in to leave comments. Login now