mercurial/linelog.py
changeset 38924 6fed8b323651
parent 38809 57af5ee15b35
child 38935 27a54096c92e
equal deleted inserted replaced
38923:8460c3cbca7e 38924:6fed8b323651
   278     def clear(self):
   278     def clear(self):
   279         self._program = []
   279         self._program = []
   280         self._maxrev = 0
   280         self._maxrev = 0
   281         self._lastannotate = None
   281         self._lastannotate = None
   282 
   282 
   283     def replacelines(self, rev, a1, a2, b1, b2):
   283     def replacelines_vec(self, rev, a1, a2, blines):
       
   284         return self.replacelines(rev, a1, a2, 0, len(blines),
       
   285                                  _internal_blines=blines)
       
   286 
       
   287     def replacelines(self, rev, a1, a2, b1, b2, _internal_blines=None):
   284         """Replace lines [a1, a2) with lines [b1, b2)."""
   288         """Replace lines [a1, a2) with lines [b1, b2)."""
   285         if self._lastannotate:
   289         if self._lastannotate:
   286             # TODO(augie): make replacelines() accept a revision at
   290             # TODO(augie): make replacelines() accept a revision at
   287             # which we're editing as well as a revision to mark
   291             # which we're editing as well as a revision to mark
   288             # responsible for the edits. In hg-experimental it's
   292             # responsible for the edits. In hg-experimental it's
   313             # the new block.
   317             # the new block.
   314             tgt = oldproglen + (b2 - b1 + 1)
   318             tgt = oldproglen + (b2 - b1 + 1)
   315             # Jump to skip the insert if we're at an older revision.
   319             # Jump to skip the insert if we're at an older revision.
   316             appendinst(_jl(rev, tgt))
   320             appendinst(_jl(rev, tgt))
   317             for linenum in pycompat.xrange(b1, b2):
   321             for linenum in pycompat.xrange(b1, b2):
   318                 appendinst(_line(rev, linenum))
   322                 if _internal_blines is None:
       
   323                     appendinst(_line(rev, linenum))
       
   324                 else:
       
   325                     appendinst(_line(*_internal_blines[linenum]))
   319         # delete
   326         # delete
   320         if a1 < a2:
   327         if a1 < a2:
   321             if a2 > len(ar.lines):
   328             if a2 > len(ar.lines):
   322                 raise LineLogError(
   329                 raise LineLogError(
   323                     '%d contains %d lines, tried to access line %d' % (
   330                     '%d contains %d lines, tried to access line %d' % (