mercurial/revlog.py
changeset 11929 1839a7518b0d
parent 11928 b69899dbad40
child 11930 12547cedc264
equal deleted inserted replaced
11928:b69899dbad40 11929:1839a7518b0d
  1014         return decompress(self._chunkraw(rev, rev))
  1014         return decompress(self._chunkraw(rev, rev))
  1015 
  1015 
  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):
  1022             return self._chunk(rev2)
  1044             return self._chunk(rev2)
  1023 
  1045