##// END OF EJS Templates
absorb: use pycompat to get xrange...
Augie Fackler -
r38956:a5c8c547 default
parent child Browse files
Show More
@@ -43,6 +43,7 b' from mercurial import ('
43 43 obsolete,
44 44 patch,
45 45 phases,
46 pycompat,
46 47 registrar,
47 48 repair,
48 49 scmutil,
@@ -390,7 +391,7 b' class filefixupstate(object):'
390 391 newfixups.append((fixuprev, a1, a2, b1, b2))
391 392 elif a2 - a1 == b2 - b1 or b1 == b2:
392 393 # 1:1 line mapping, or chunk was deleted
393 for i in xrange(a1, a2):
394 for i in pycompat.xrange(a1, a2):
394 395 rev, linenum = annotated[i]
395 396 if rev > 1:
396 397 if b1 == b2: # deletion, simply remove that single line
@@ -417,7 +418,7 b' class filefixupstate(object):'
417 418 """
418 419 llog = linelog.linelog()
419 420 a, alines = '', []
420 for i in xrange(len(self.contents)):
421 for i in pycompat.xrange(len(self.contents)):
421 422 b, blines = self.contents[i], self.contentlines[i]
422 423 llrev = i * 2 + 1
423 424 chunks = self._alldiffchunks(a, b, alines, blines)
@@ -429,7 +430,7 b' class filefixupstate(object):'
429 430 def _checkoutlinelog(self):
430 431 """() -> [str]. check out file contents from linelog"""
431 432 contents = []
432 for i in xrange(len(self.contents)):
433 for i in pycompat.xrange(len(self.contents)):
433 434 rev = (i + 1) * 2
434 435 self.linelog.annotate(rev)
435 436 content = ''.join(map(self._getline, self.linelog.annotateresult))
@@ -554,18 +555,18 b' class filefixupstate(object):'
554 555 a1, a2, b1, b2 = chunk
555 556 aidxs, bidxs = [0] * (a2 - a1), [0] * (b2 - b1)
556 557 for idx, fa1, fa2, fb1, fb2 in fixups:
557 for i in xrange(fa1, fa2):
558 for i in pycompat.xrange(fa1, fa2):
558 559 aidxs[i - a1] = (max(idx, 1) - 1) // 2
559 for i in xrange(fb1, fb2):
560 for i in pycompat.xrange(fb1, fb2):
560 561 bidxs[i - b1] = (max(idx, 1) - 1) // 2
561 562
562 563 buf = [] # [(idx, content)]
563 564 buf.append((0, label('@@ -%d,%d +%d,%d @@'
564 565 % (a1, a2 - a1, b1, b2 - b1), 'diff.hunk')))
565 566 buf += [(aidxs[i - a1], label('-' + alines[i], 'diff.deleted'))
566 for i in xrange(a1, a2)]
567 for i in pycompat.xrange(a1, a2)]
567 568 buf += [(bidxs[i - b1], label('+' + blines[i], 'diff.inserted'))
568 for i in xrange(b1, b2)]
569 for i in pycompat.xrange(b1, b2)]
569 570 for idx, line in buf:
570 571 shortnode = idx and node.short(self.fctxs[idx].node()) or ''
571 572 ui.write(ui.label(shortnode[0:7].ljust(8), 'absorb.node') +
General Comments 0
You need to be logged in to leave comments. Login now