equal
deleted
inserted
replaced
2827 ui.warn("%s\n" % res2) |
2827 ui.warn("%s\n" % res2) |
2828 |
2828 |
2829 def _parsewirelangblocks(fh): |
2829 def _parsewirelangblocks(fh): |
2830 activeaction = None |
2830 activeaction = None |
2831 blocklines = [] |
2831 blocklines = [] |
|
2832 lastindent = 0 |
2832 |
2833 |
2833 for line in fh: |
2834 for line in fh: |
2834 line = line.rstrip() |
2835 line = line.rstrip() |
2835 if not line: |
2836 if not line: |
2836 continue |
2837 continue |
2843 if activeaction: |
2844 if activeaction: |
2844 yield activeaction, blocklines |
2845 yield activeaction, blocklines |
2845 |
2846 |
2846 activeaction = line |
2847 activeaction = line |
2847 blocklines = [] |
2848 blocklines = [] |
|
2849 lastindent = 0 |
2848 continue |
2850 continue |
2849 |
2851 |
2850 # Else we start with an indent. |
2852 # Else we start with an indent. |
2851 |
2853 |
2852 if not activeaction: |
2854 if not activeaction: |
2853 raise error.Abort(_('indented line outside of block')) |
2855 raise error.Abort(_('indented line outside of block')) |
2854 |
2856 |
2855 blocklines.append(line) |
2857 indent = len(line) - len(line.lstrip()) |
|
2858 |
|
2859 # If this line is indented more than the last line, concatenate it. |
|
2860 if indent > lastindent and blocklines: |
|
2861 blocklines[-1] += line.lstrip() |
|
2862 else: |
|
2863 blocklines.append(line) |
|
2864 lastindent = indent |
2856 |
2865 |
2857 # Flush last block. |
2866 # Flush last block. |
2858 if activeaction: |
2867 if activeaction: |
2859 yield activeaction, blocklines |
2868 yield activeaction, blocklines |
2860 |
2869 |