##// END OF EJS Templates
revlog: deltachain() returns chain of revs need to construct a revision
Pradeepkumar Gayam -
r11929:1839a751 default
parent child Browse files
Show More
@@ -1016,6 +1016,28 class revlog(object):
1016 def _chunkclear(self):
1016 def _chunkclear(self):
1017 self._chunkcache = (0, '')
1017 self._chunkcache = (0, '')
1018
1018
1019 def deltaparent(self, rev):
1020 """return previous revision or parentrev according to flags"""
1021 if self.base(rev) == rev:
1022 return nullrev
1023 elif self.flags(rev) & REVIDX_PARENTDELTA:
1024 return self.parentrevs(rev)[0]
1025 else:
1026 return rev - 1
1027
1028
1029 def deltachain(self, rev, cache):
1030 """return chain of revisions to construct a given revision"""
1031 chain = []
1032 check = False
1033 while self.base(rev) != rev and rev != cache:
1034 chain.append(rev)
1035 rev = self.deltaparent(rev)
1036 chain.reverse()
1037 if rev == cache:
1038 check = True
1039 return check, rev, chain
1040
1019 def revdiff(self, rev1, rev2):
1041 def revdiff(self, rev1, rev2):
1020 """return or calculate a delta between two revisions"""
1042 """return or calculate a delta between two revisions"""
1021 if rev1 + 1 == rev2 and self.base(rev1) == self.base(rev2):
1043 if rev1 + 1 == rev2 and self.base(rev1) == self.base(rev2):
General Comments 0
You need to be logged in to leave comments. Login now