mercurial/filelog.py
changeset 39878 3e896b51aa5d
parent 39876 a269fa55467e
child 39880 1b65fb4d43d6
equal deleted inserted replaced
39877:f8eb71f9e3bd 39878:3e896b51aa5d
    12     repository,
    12     repository,
    13     revlog,
    13     revlog,
    14 )
    14 )
    15 from .utils import (
    15 from .utils import (
    16     interfaceutil,
    16     interfaceutil,
       
    17     storageutil,
    17 )
    18 )
    18 
    19 
    19 @interfaceutil.implementer(repository.ifilestorage)
    20 @interfaceutil.implementer(repository.ifilestorage)
    20 class filelog(object):
    21 class filelog(object):
    21     def __init__(self, opener, path):
    22     def __init__(self, opener, path):
   118         s = t.index('\1\n', 2)
   119         s = t.index('\1\n', 2)
   119         return t[s + 2:]
   120         return t[s + 2:]
   120 
   121 
   121     def add(self, text, meta, transaction, link, p1=None, p2=None):
   122     def add(self, text, meta, transaction, link, p1=None, p2=None):
   122         if meta or text.startswith('\1\n'):
   123         if meta or text.startswith('\1\n'):
   123             text = revlog.packmeta(meta, text)
   124             text = storageutil.packmeta(meta, text)
   124         return self.addrevision(text, transaction, link, p1, p2)
   125         return self.addrevision(text, transaction, link, p1, p2)
   125 
   126 
   126     def renamed(self, node):
   127     def renamed(self, node):
   127         if self.parents(node)[0] != revlog.nullid:
   128         if self.parents(node)[0] != revlog.nullid:
   128             return False
   129             return False
   129         t = self.revision(node)
   130         t = self.revision(node)
   130         m = revlog.parsemeta(t)[0]
   131         m = storageutil.parsemeta(t)[0]
   131         # copy and copyrev occur in pairs. In rare cases due to bugs,
   132         # copy and copyrev occur in pairs. In rare cases due to bugs,
   132         # one can occur without the other.
   133         # one can occur without the other.
   133         if m and "copy" in m and "copyrev" in m:
   134         if m and "copy" in m and "copyrev" in m:
   134             return (m["copy"], revlog.bin(m["copyrev"]))
   135             return (m["copy"], revlog.bin(m["copyrev"]))
   135         return False
   136         return False