mercurial/manifest.py
changeset 22408 dc97e04c12ad
parent 21879 090dcaaf3fff
child 22409 8f09b785b59b
equal deleted inserted replaced
22407:d259322a394b 22408:dc97e04c12ad
    37                 if flags:
    37                 if flags:
    38                     ret._flags[fn] = flags
    38                     ret._flags[fn] = flags
    39         return ret
    39         return ret
    40     def flagsdiff(self, d2):
    40     def flagsdiff(self, d2):
    41         return dicthelpers.diff(self._flags, d2._flags, "")
    41         return dicthelpers.diff(self._flags, d2._flags, "")
       
    42 
       
    43 
       
    44 def checkforbidden(l):
       
    45     """Check filenames for illegal characters."""
       
    46     for f in l:
       
    47         if '\n' in f or '\r' in f:
       
    48             raise error.RevlogError(
       
    49                 _("'\\n' and '\\r' disallowed in filenames: %r") % f)
       
    50 
    42 
    51 
    43 class manifest(revlog.revlog):
    52 class manifest(revlog.revlog):
    44     def __init__(self, opener):
    53     def __init__(self, opener):
    45         # we expect to deal with not more than four revs at a time,
    54         # we expect to deal with not more than four revs at a time,
    46         # during a commit --amend
    55         # during a commit --amend
   150 
   159 
   151             deltatext = "".join(struct.pack(">lll", start, end, len(content))
   160             deltatext = "".join(struct.pack(">lll", start, end, len(content))
   152                            + content for start, end, content in x)
   161                            + content for start, end, content in x)
   153             return deltatext, newaddlist
   162             return deltatext, newaddlist
   154 
   163 
   155         def checkforbidden(l):
       
   156             for f in l:
       
   157                 if '\n' in f or '\r' in f:
       
   158                     raise error.RevlogError(
       
   159                         _("'\\n' and '\\r' disallowed in filenames: %r") % f)
       
   160 
       
   161         # if we're using the cache, make sure it is valid and
   164         # if we're using the cache, make sure it is valid and
   162         # parented by the same node we're diffing against
   165         # parented by the same node we're diffing against
   163         if not (changed and p1 and (p1 in self._mancache)):
   166         if not (changed and p1 and (p1 in self._mancache)):
   164             files = sorted(map)
   167             files = sorted(map)
   165             checkforbidden(files)
   168             checkforbidden(files)