equal
deleted
inserted
replaced
41 if stopdepth is None: |
41 if stopdepth is None: |
42 stopdepth = maxlogdepth |
42 stopdepth = maxlogdepth |
43 if stopdepth == 0: |
43 if stopdepth == 0: |
44 return |
44 return |
45 if stopdepth < 0: |
45 if stopdepth < 0: |
46 raise error.ProgrammingError('negative stopdepth') |
46 raise error.ProgrammingError(b'negative stopdepth') |
47 if reverse: |
47 if reverse: |
48 heapsign = -1 # max heap |
48 heapsign = -1 # max heap |
49 else: |
49 else: |
50 heapsign = +1 # min heap |
50 heapsign = +1 # min heap |
51 |
51 |
328 if diff from fctx2 to fctx1 has changes in linerange2 and |
328 if diff from fctx2 to fctx1 has changes in linerange2 and |
329 `linerange1` is the new line range for fctx1. |
329 `linerange1` is the new line range for fctx1. |
330 """ |
330 """ |
331 blocks = mdiff.allblocks(fctx1.data(), fctx2.data(), diffopts) |
331 blocks = mdiff.allblocks(fctx1.data(), fctx2.data(), diffopts) |
332 filteredblocks, linerange1 = mdiff.blocksinrange(blocks, linerange2) |
332 filteredblocks, linerange1 = mdiff.blocksinrange(blocks, linerange2) |
333 diffinrange = any(stype == '!' for _, stype in filteredblocks) |
333 diffinrange = any(stype == b'!' for _, stype in filteredblocks) |
334 return diffinrange, linerange1 |
334 return diffinrange, linerange1 |
335 |
335 |
336 |
336 |
337 def blockancestors(fctx, fromline, toline, followfirst=False): |
337 def blockancestors(fctx, fromline, toline, followfirst=False): |
338 """Yield ancestors of `fctx` with respect to the block of lines within |
338 """Yield ancestors of `fctx` with respect to the block of lines within |
426 # full file content |
426 # full file content |
427 text = attr.ib() |
427 text = attr.ib() |
428 |
428 |
429 |
429 |
430 def _countlines(text): |
430 def _countlines(text): |
431 if text.endswith("\n"): |
431 if text.endswith(b"\n"): |
432 return text.count("\n") |
432 return text.count(b"\n") |
433 return text.count("\n") + int(bool(text)) |
433 return text.count(b"\n") + int(bool(text)) |
434 |
434 |
435 |
435 |
436 def _decoratelines(text, fctx): |
436 def _decoratelines(text, fctx): |
437 n = _countlines(text) |
437 n = _countlines(text) |
438 linenos = pycompat.rangelist(1, n + 1) |
438 linenos = pycompat.rangelist(1, n + 1) |
462 # TODO: change this? |
462 # TODO: change this? |
463 for parent, blocks in pblocks: |
463 for parent, blocks in pblocks: |
464 for (a1, a2, b1, b2), t in blocks: |
464 for (a1, a2, b1, b2), t in blocks: |
465 # Changed blocks ('!') or blocks made only of blank lines ('~') |
465 # Changed blocks ('!') or blocks made only of blank lines ('~') |
466 # belong to the child. |
466 # belong to the child. |
467 if t == '=': |
467 if t == b'=': |
468 child.fctxs[b1:b2] = parent.fctxs[a1:a2] |
468 child.fctxs[b1:b2] = parent.fctxs[a1:a2] |
469 child.linenos[b1:b2] = parent.linenos[a1:a2] |
469 child.linenos[b1:b2] = parent.linenos[a1:a2] |
470 child.skips[b1:b2] = parent.skips[a1:a2] |
470 child.skips[b1:b2] = parent.skips[a1:a2] |
471 |
471 |
472 if skipchild: |
472 if skipchild: |