|
4 | 4 | to the headers and do not contain changes to the translation strings.
|
5 | 5 | """
|
6 | 6 |
|
7 |
| -# Copyright (C) 2023 Bob Swift |
| 7 | +# Copyright (C) 2023-2024 Bob Swift |
8 | 8 |
|
9 | 9 |
|
10 | 10 | import argparse
|
|
18 | 18 |
|
19 | 19 |
|
20 | 20 | SCRIPT_NAME = 'Picard Docs Git File Stager'
|
21 |
| -SCRIPT_VERS = '0.4' |
22 |
| -SCRIPT_INITIAL_COPYRIGHT = '2023' |
| 21 | +SCRIPT_VERS = '0.5' |
| 22 | +SCRIPT_INITIAL_COPYRIGHT = '2024' |
23 | 23 | SCRIPT_INITIAL_AUTHOR = 'Bob Swift'
|
24 | 24 |
|
25 | 25 | DEFAULT_COMPARISON_DISPLAY_LEVEL = 'changed'
|
@@ -287,7 +287,12 @@ def process_change(files_to_stage: dict, fullfilename: str, minus: str, plus: st
|
287 | 287 | if minus != plus:
|
288 | 288 | files_to_stage[fullfilename] = 'Modified'
|
289 | 289 |
|
290 |
| - for line in git_diff: |
| 290 | + line_count = len(git_diff) |
| 291 | + line_num = 0 |
| 292 | + while line_num < line_count: |
| 293 | + line = git_diff[line_num] |
| 294 | + line_num += 1 |
| 295 | + # for line in git_diff: |
291 | 296 | # Ignore nearby lines and unchanged ranges
|
292 | 297 | if line and line[0] in {' ', '@'}:
|
293 | 298 | continue
|
@@ -338,6 +343,10 @@ def process_change(files_to_stage: dict, fullfilename: str, minus: str, plus: st
|
338 | 343 | if re.match(r'[+-].*\\n"$', line) or re.match(r'[+-]"(' + HEADER_KEYS_TO_IGNORE + r')', line, re.IGNORECASE):
|
339 | 344 | process_change(files_to_stage, fullfilename, minus, plus)
|
340 | 345 | minus = plus = last = ''
|
| 346 | + # Keep skipping lines until header line ends with '\n"' |
| 347 | + while line_num < line_count and not re.match(r'[+-].*\\n"$', line.strip()): |
| 348 | + line = git_diff[line_num] |
| 349 | + line_num += 1 |
341 | 350 | continue
|
342 | 351 |
|
343 | 352 | # Add files with changed translation text lines
|
|
0 commit comments