mercurial/utils/storageutil.py
changeset 40005 1d97a332c6d9
parent 40004 fa3dc85a747e
child 40006 422beffd71ba
equal deleted inserted replaced
40004:fa3dc85a747e 40005:1d97a332c6d9
    87         return text
    87         return text
    88 
    88 
    89     offset = text.index(b'\x01\n', 2)
    89     offset = text.index(b'\x01\n', 2)
    90     return text[offset + 2:]
    90     return text[offset + 2:]
    91 
    91 
       
    92 def filerevisioncopied(store, node):
       
    93     """Resolve file revision copy metadata.
       
    94 
       
    95     Returns ``False`` if the file has no copy metadata. Otherwise a
       
    96     2-tuple of the source filename and node.
       
    97     """
       
    98     if store.parents(node)[0] != nullid:
       
    99         return False
       
   100 
       
   101     meta = parsemeta(store.revision(node))[0]
       
   102 
       
   103     # copy and copyrev occur in pairs. In rare cases due to old bugs,
       
   104     # one can occur without the other. So ensure both are present to flag
       
   105     # as a copy.
       
   106     if meta and b'copy' in meta and b'copyrev' in meta:
       
   107         return meta[b'copy'], bin(meta[b'copyrev'])
       
   108 
       
   109     return False
       
   110 
    92 def iterrevs(storelen, start=0, stop=None):
   111 def iterrevs(storelen, start=0, stop=None):
    93     """Iterate over revision numbers in a store."""
   112     """Iterate over revision numbers in a store."""
    94     step = 1
   113     step = 1
    95 
   114 
    96     if stop is not None:
   115     if stop is not None: