mercurial/manifest.py
branchstable
changeset 42376 89c0c8edc9d4
parent 41965 e4ac7e63c213
child 42377 0546ead39a7e
equal deleted inserted replaced
42324:2338bdea4474 42376:89c0c8edc9d4
    32     interfaceutil,
    32     interfaceutil,
    33 )
    33 )
    34 
    34 
    35 parsers = policy.importmod(r'parsers')
    35 parsers = policy.importmod(r'parsers')
    36 propertycache = util.propertycache
    36 propertycache = util.propertycache
       
    37 
       
    38 # Allow tests to more easily test the alternate path in manifestdict.fastdelta()
       
    39 FASTDELTA_TEXTDIFF_THRESHOLD = 1000
    37 
    40 
    38 def _parse(data):
    41 def _parse(data):
    39     # This method does a little bit of excessive-looking
    42     # This method does a little bit of excessive-looking
    40     # precondition checking. This is so that the behavior of this
    43     # precondition checking. This is so that the behavior of this
    41     # class exactly matches its C counterpart to try and help
    44     # class exactly matches its C counterpart to try and help
   556         start = 0
   559         start = 0
   557         # zero copy representation of base as a buffer
   560         # zero copy representation of base as a buffer
   558         addbuf = util.buffer(base)
   561         addbuf = util.buffer(base)
   559 
   562 
   560         changes = list(changes)
   563         changes = list(changes)
   561         if len(changes) < 1000:
   564         if len(changes) < FASTDELTA_TEXTDIFF_THRESHOLD:
   562             # start with a readonly loop that finds the offset of
   565             # start with a readonly loop that finds the offset of
   563             # each line and creates the deltas
   566             # each line and creates the deltas
   564             for f, todelete in changes:
   567             for f, todelete in changes:
   565                 # bs will either be the index of the item or the insert point
   568                 # bs will either be the index of the item or the insert point
   566                 start, end = _msearch(addbuf, f, start)
   569                 start, end = _msearch(addbuf, f, start)