mercurial/revlog.py
changeset 40325 b0fbd1792e2d
parent 40298 9cadb0f5f227
child 40418 256b1f0c24e8
child 40495 59a870a4ad6e
equal deleted inserted replaced
40324:6637b079ae45 40325:b0fbd1792e2d
  2107     def _peek_iscensored(self, baserev, delta, flush):
  2107     def _peek_iscensored(self, baserev, delta, flush):
  2108         """Quickly check if a delta produces a censored revision."""
  2108         """Quickly check if a delta produces a censored revision."""
  2109         if not self._censorable:
  2109         if not self._censorable:
  2110             return False
  2110             return False
  2111 
  2111 
  2112         # Fragile heuristic: unless new file meta keys are added alphabetically
  2112         return storageutil.deltaiscensored(delta, baserev, self.rawsize)
  2113         # preceding "censored", all censored revisions are prefixed by
       
  2114         # "\1\ncensored:". A delta producing such a censored revision must be a
       
  2115         # full-replacement delta, so we inspect the first and only patch in the
       
  2116         # delta for this prefix.
       
  2117         hlen = struct.calcsize(">lll")
       
  2118         if len(delta) <= hlen:
       
  2119             return False
       
  2120 
       
  2121         oldlen = self.rawsize(baserev)
       
  2122         newlen = len(delta) - hlen
       
  2123         if delta[:hlen] != mdiff.replacediffheader(oldlen, newlen):
       
  2124             return False
       
  2125 
       
  2126         add = "\1\ncensored:"
       
  2127         addlen = len(add)
       
  2128         return newlen >= addlen and delta[hlen:hlen + addlen] == add
       
  2129 
  2113 
  2130     def getstrippoint(self, minlink):
  2114     def getstrippoint(self, minlink):
  2131         """find the minimum rev that must be stripped to strip the linkrev
  2115         """find the minimum rev that must be stripped to strip the linkrev
  2132 
  2116 
  2133         Returns a tuple containing the minimum rev and a set of all revs that
  2117         Returns a tuple containing the minimum rev and a set of all revs that