Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHG2525c4943c09: grep: difflib sequencematcher opcodes are native strs
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/commands.py (6 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Augie Fackler | Aug 9 2018, 11:12 PM |
m = matches[rev][fn] | m = matches[rev][fn] | ||||
for lnum, cstart, cend, line in matchlines(body): | for lnum, cstart, cend, line in matchlines(body): | ||||
s = linestate(line, lnum, cstart, cend) | s = linestate(line, lnum, cstart, cend) | ||||
m.append(s) | m.append(s) | ||||
def difflinestates(a, b): | def difflinestates(a, b): | ||||
sm = difflib.SequenceMatcher(None, a, b) | sm = difflib.SequenceMatcher(None, a, b) | ||||
for tag, alo, ahi, blo, bhi in sm.get_opcodes(): | for tag, alo, ahi, blo, bhi in sm.get_opcodes(): | ||||
if tag == 'insert': | if tag == r'insert': | ||||
for i in pycompat.xrange(blo, bhi): | for i in pycompat.xrange(blo, bhi): | ||||
yield ('+', b[i]) | yield ('+', b[i]) | ||||
elif tag == 'delete': | elif tag == r'delete': | ||||
for i in pycompat.xrange(alo, ahi): | for i in pycompat.xrange(alo, ahi): | ||||
yield ('-', a[i]) | yield ('-', a[i]) | ||||
elif tag == 'replace': | elif tag == r'replace': | ||||
for i in pycompat.xrange(alo, ahi): | for i in pycompat.xrange(alo, ahi): | ||||
yield ('-', a[i]) | yield ('-', a[i]) | ||||
for i in pycompat.xrange(blo, bhi): | for i in pycompat.xrange(blo, bhi): | ||||
yield ('+', b[i]) | yield ('+', b[i]) | ||||
def display(fm, fn, ctx, pstates, states): | def display(fm, fn, ctx, pstates, states): | ||||
rev = scmutil.intrev(ctx) | rev = scmutil.intrev(ctx) | ||||
if fm.isplain(): | if fm.isplain(): |