equal
deleted
inserted
replaced
408 del self.buf[0] |
408 del self.buf[0] |
409 return l |
409 return l |
410 return self.fp.readline() |
410 return self.fp.readline() |
411 |
411 |
412 def __iter__(self): |
412 def __iter__(self): |
413 while True: |
413 return iter(self.readline, '') |
414 l = self.readline() |
|
415 if not l: |
|
416 break |
|
417 yield l |
|
418 |
414 |
419 class abstractbackend(object): |
415 class abstractbackend(object): |
420 def __init__(self, ui): |
416 def __init__(self, ui): |
421 self.ui = ui |
417 self.ui = ui |
422 |
418 |
1686 lr = linereader(fp) |
1682 lr = linereader(fp) |
1687 |
1683 |
1688 def scanwhile(first, p): |
1684 def scanwhile(first, p): |
1689 """scan lr while predicate holds""" |
1685 """scan lr while predicate holds""" |
1690 lines = [first] |
1686 lines = [first] |
1691 while True: |
1687 for line in iter(lr.readline, ''): |
1692 line = lr.readline() |
|
1693 if not line: |
|
1694 break |
|
1695 if p(line): |
1688 if p(line): |
1696 lines.append(line) |
1689 lines.append(line) |
1697 else: |
1690 else: |
1698 lr.push(line) |
1691 lr.push(line) |
1699 break |
1692 break |
1700 return lines |
1693 return lines |
1701 |
1694 |
1702 while True: |
1695 for line in iter(lr.readline, ''): |
1703 line = lr.readline() |
|
1704 if not line: |
|
1705 break |
|
1706 if line.startswith('diff --git a/') or line.startswith('diff -r '): |
1696 if line.startswith('diff --git a/') or line.startswith('diff -r '): |
1707 def notheader(line): |
1697 def notheader(line): |
1708 s = line.split(None, 1) |
1698 s = line.split(None, 1) |
1709 return not s or s[0] not in ('---', 'diff') |
1699 return not s or s[0] not in ('---', 'diff') |
1710 header = scanwhile(line, notheader) |
1700 header = scanwhile(line, notheader) |
1770 # our states |
1760 # our states |
1771 BFILE = 1 |
1761 BFILE = 1 |
1772 context = None |
1762 context = None |
1773 lr = linereader(fp) |
1763 lr = linereader(fp) |
1774 |
1764 |
1775 while True: |
1765 for x in iter(lr.readline, ''): |
1776 x = lr.readline() |
|
1777 if not x: |
|
1778 break |
|
1779 if state == BFILE and ( |
1766 if state == BFILE and ( |
1780 (not context and x[0] == '@') |
1767 (not context and x[0] == '@') |
1781 or (context is not False and x.startswith('***************')) |
1768 or (context is not False and x.startswith('***************')) |
1782 or x.startswith('GIT binary patch')): |
1769 or x.startswith('GIT binary patch')): |
1783 gp = None |
1770 gp = None |