Mercurial > hg
comparison mercurial/crecord.py @ 25821:d68544b69736
crecord: throws error instead of crashing for large diffs
Before this patch, crecord was crashing for large diffs
(30k lines on my laptop). This patch catches the exception raised in that case
and use the error reporting mechanism introduced in the previous patch for
notifying the user of the issue. It is not possible to add a test for that for
now as we don't yet have full blown ui tests for the curses interface.
author | Laurent Charignon <lcharignon@fb.com> |
---|---|
date | Fri, 17 Jul 2015 13:44:01 -0700 |
parents | 701d8c362aa2 |
children | f4356e5094ba |
comparison
equal
deleted
inserted
replaced
25820:701d8c362aa2 | 25821:d68544b69736 |
---|---|
1610 # stupid hack to prevent getnumlinesdisplayed from failing | 1610 # stupid hack to prevent getnumlinesdisplayed from failing |
1611 self.chunkpad = curses.newpad(1, self.xscreensize) | 1611 self.chunkpad = curses.newpad(1, self.xscreensize) |
1612 | 1612 |
1613 # add 1 so to account for last line text reaching end of line | 1613 # add 1 so to account for last line text reaching end of line |
1614 self.numpadlines = self.getnumlinesdisplayed(ignorefolding=True) + 1 | 1614 self.numpadlines = self.getnumlinesdisplayed(ignorefolding=True) + 1 |
1615 self.chunkpad = curses.newpad(self.numpadlines, self.xscreensize) | 1615 |
1616 | 1616 try: |
1617 self.chunkpad = curses.newpad(self.numpadlines, self.xscreensize) | |
1618 except curses.error: | |
1619 self.initerr = _('this diff is too large to be displayed') | |
1620 return | |
1617 # initialize selecteitemendline (initial start-line is 0) | 1621 # initialize selecteitemendline (initial start-line is 0) |
1618 self.selecteditemendline = self.getnumlinesdisplayed( | 1622 self.selecteditemendline = self.getnumlinesdisplayed( |
1619 self.currentselecteditem, recursechildren=False) | 1623 self.currentselecteditem, recursechildren=False) |
1620 | 1624 |
1621 while True: | 1625 while True: |