5 ret
= subprocess
.run(["git", "config", "rebase.instructionFormat"], capture_output
=True)
6 if ret
.returncode
!= 0 or ret
.stdout
.decode('ascii').strip() != "(%an <%ae>) %s":
7 print("Git is using the wrong rebase instruction format, reconfigure it.")
11 f
= open(".git/rebase-merge/git-rebase-todo", "r")
13 print("Initiate the rebase first!")
15 lines
= list(s
.strip("\r\n") for s
in f
.readlines())
18 for i
in range(len(lines
)):
20 if line
.startswith("#") or " Translated using Weblate " not in line
: continue
23 author
= line
[line
.find("("):line
.rfind(")", 0, pos
)+1]
24 # try to grab the next commit by the same author for the same language
25 for j
in range(i
+1, len(lines
)):
26 if lines
[j
].startswith("#") or not lines
[j
].endswith(lang
): continue
27 if author
in lines
[j
]:
28 lines
.insert(i
+1, "f " + lines
.pop(j
)[5:])
31 with
open(".git/rebase-merge/git-rebase-todo", "w") as f
:
32 f
.write("\n".join(lines
) + "\n")
33 print("You can now continue with the rebase.")