Convert range to the "ed" format
(start, stop)
| 1181 | ######################################################################## |
| 1182 | |
| 1183 | def _format_range_context(start, stop): |
| 1184 | 'Convert range to the "ed" format' |
| 1185 | # Per the diff spec at http://www.unix.org/single_unix_specification/ |
| 1186 | beginning = start + 1 # lines start numbering with one |
| 1187 | length = stop - start |
| 1188 | if not length: |
| 1189 | beginning -= 1 # empty ranges begin at line just before the range |
| 1190 | if length <= 1: |
| 1191 | return '{}'.format(beginning) |
| 1192 | return '{},{}'.format(beginning, beginning + length - 1) |
| 1193 | |
| 1194 | # See http://www.unix.org/single_unix_specification/ |
| 1195 | def context_diff(a, b, fromfile='', tofile='', |
no test coverage detected
searching dependent graphs…