Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 38823:e7aa113b14f7
global: use pycompat.xrange()
On Python 3, our module importer automatically rewrites xrange()
to pycompat.xrange().
We want to move away from the custom importer on Python 3.
This commit converts all instances of xrange() to use
pycompat.xrange().
Differential Revision: https://phab.mercurial-scm.org/D4032
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Wed, 01 Aug 2018 13:00:45 -0700 |
parents | aabc01da9834 |
children | 6c8e3c847977 |
comparison
equal
deleted
inserted
replaced
38822:7eba8f83129b | 38823:e7aa113b14f7 |
---|---|
2605 | 2605 |
2606 def difflinestates(a, b): | 2606 def difflinestates(a, b): |
2607 sm = difflib.SequenceMatcher(None, a, b) | 2607 sm = difflib.SequenceMatcher(None, a, b) |
2608 for tag, alo, ahi, blo, bhi in sm.get_opcodes(): | 2608 for tag, alo, ahi, blo, bhi in sm.get_opcodes(): |
2609 if tag == 'insert': | 2609 if tag == 'insert': |
2610 for i in xrange(blo, bhi): | 2610 for i in pycompat.xrange(blo, bhi): |
2611 yield ('+', b[i]) | 2611 yield ('+', b[i]) |
2612 elif tag == 'delete': | 2612 elif tag == 'delete': |
2613 for i in xrange(alo, ahi): | 2613 for i in pycompat.xrange(alo, ahi): |
2614 yield ('-', a[i]) | 2614 yield ('-', a[i]) |
2615 elif tag == 'replace': | 2615 elif tag == 'replace': |
2616 for i in xrange(alo, ahi): | 2616 for i in pycompat.xrange(alo, ahi): |
2617 yield ('-', a[i]) | 2617 yield ('-', a[i]) |
2618 for i in xrange(blo, bhi): | 2618 for i in pycompat.xrange(blo, bhi): |
2619 yield ('+', b[i]) | 2619 yield ('+', b[i]) |
2620 | 2620 |
2621 def display(fm, fn, ctx, pstates, states): | 2621 def display(fm, fn, ctx, pstates, states): |
2622 rev = scmutil.intrev(ctx) | 2622 rev = scmutil.intrev(ctx) |
2623 if fm.isplain(): | 2623 if fm.isplain(): |