mercurial/utils/storageutil.py
changeset 39880 1b65fb4d43d6
parent 39879 d269ddbf54f0
child 39881 d63153611ed5
equal deleted inserted replaced
39879:d269ddbf54f0 39880:1b65fb4d43d6
    67     return b'\x01\n%s\x01\n%s' % (metatext, text)
    67     return b'\x01\n%s\x01\n%s' % (metatext, text)
    68 
    68 
    69 def iscensoredtext(text):
    69 def iscensoredtext(text):
    70     meta = parsemeta(text)[0]
    70     meta = parsemeta(text)[0]
    71     return meta and b'censored' in meta
    71     return meta and b'censored' in meta
       
    72 
       
    73 def filtermetadata(text):
       
    74     """Extract just the revision data from source text.
       
    75 
       
    76     Returns ``text`` unless it has a metadata header, in which case we return
       
    77     a new buffer without hte metadata.
       
    78     """
       
    79     if not text.startswith(b'\x01\n'):
       
    80         return text
       
    81 
       
    82     offset = text.index(b'\x01\n', 2)
       
    83     return text[offset + 2:]