# HG changeset patch # User Matt Mackall # Date 2011-09-17 18:42:11 # Node ID 9b41ccb2043e724690018f7cd25645dc5b980d51 # Parent efa213b14ec0dc15e8f9587b133fbb3acbb88e8e minirst: don't choke on empty text diff --git a/mercurial/minirst.py b/mercurial/minirst.py --- a/mercurial/minirst.py +++ b/mercurial/minirst.py @@ -38,9 +38,10 @@ def findblocks(text): blocks = [] for b in _blockre.split(text.lstrip('\n').rstrip()): lines = b.splitlines() - indent = min((len(l) - len(l.lstrip())) for l in lines) - lines = [l[indent:] for l in lines] - blocks.append(dict(indent=indent, lines=lines)) + if lines: + indent = min((len(l) - len(l.lstrip())) for l in lines) + lines = [l[indent:] for l in lines] + blocks.append(dict(indent=indent, lines=lines)) return blocks def findliteralblocks(blocks):