Show More
@@ -1025,25 +1025,6 b' class revlog(object):' | |||||
1025 | else: |
|
1025 | else: | |
1026 | return rev - 1 |
|
1026 | return rev - 1 | |
1027 |
|
1027 | |||
1028 |
|
||||
1029 | def deltachain(self, rev, cache): |
|
|||
1030 | """return chain of revisions to construct a given revision""" |
|
|||
1031 | chain = [] |
|
|||
1032 | check = False |
|
|||
1033 | index = self.index |
|
|||
1034 | e = index[rev] |
|
|||
1035 | while rev != e[3] and rev != cache: |
|
|||
1036 | chain.append(rev) |
|
|||
1037 | if e[0] & REVIDX_PARENTDELTA: |
|
|||
1038 | rev = e[5] |
|
|||
1039 | else: |
|
|||
1040 | rev -= 1 |
|
|||
1041 | e = index[rev] |
|
|||
1042 | chain.reverse() |
|
|||
1043 | if rev == cache: |
|
|||
1044 | check = True |
|
|||
1045 | return check, rev, chain |
|
|||
1046 |
|
||||
1047 | def revdiff(self, rev1, rev2): |
|
1028 | def revdiff(self, rev1, rev2): | |
1048 | """return or calculate a delta between two revisions""" |
|
1029 | """return or calculate a delta between two revisions""" | |
1049 | if rev1 != nullrev and self.deltaparent(rev2) == rev1: |
|
1030 | if rev1 != nullrev and self.deltaparent(rev2) == rev1: | |
@@ -1074,10 +1055,22 b' class revlog(object):' | |||||
1074 |
|
1055 | |||
1075 | # build delta chain |
|
1056 | # build delta chain | |
1076 | self._loadindex(base, rev + 1) |
|
1057 | self._loadindex(base, rev + 1) | |
1077 | cachehit, base, chain = self.deltachain(rev, cachedrev) |
|
1058 | chain = [] | |
|
1059 | index = self.index # for performance | |||
|
1060 | iterrev = rev | |||
|
1061 | e = index[iterrev] | |||
|
1062 | while iterrev != base and iterrev != cachedrev: | |||
|
1063 | chain.append(iterrev) | |||
|
1064 | if e[0] & REVIDX_PARENTDELTA: | |||
|
1065 | iterrev = e[5] | |||
|
1066 | else: | |||
|
1067 | iterrev -= 1 | |||
|
1068 | e = index[iterrev] | |||
|
1069 | chain.reverse() | |||
|
1070 | base = iterrev | |||
1078 |
|
1071 | |||
1079 | # do we have useful data cached? |
|
1072 | if iterrev == cachedrev: | |
1080 |
|
|
1073 | # cache hit | |
1081 | text = self._cache[2] |
|
1074 | text = self._cache[2] | |
1082 |
|
1075 | |||
1083 | # drop cache to save memory |
|
1076 | # drop cache to save memory |
General Comments 0
You need to be logged in to leave comments.
Login now