We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parent3df3585 commit52bb30cCopy full SHA for 52bb30c
scripts/fix_diffs.py
@@ -53,8 +53,8 @@ def get_msgs(lines):
53
lineno+=1
54
returnmsgids,msgstrs
55
56
-defmain(fp):
57
-p=subprocess.Popen(['git','show','HEAD:'+fp],stdout=subprocess.PIPE)
+defmain(fp,original_po_commit='HEAD'):
+p=subprocess.Popen(['git','show','{}:'.format(original_po_commit)+fp],stdout=subprocess.PIPE)
58
out,err=p.communicate()
59
head_po=out.decode().splitlines()
60
msgids,msgstrs=get_msgs(head_po)
@@ -95,10 +95,15 @@ def main(fp):
95
if__name__=='__main__':
96
importsys
97
iflen(sys.argv)<2:
98
-print('Usage: python fix_diffs.py <po_file_path>')
+print('Usage: python fix_diffs.py <po_file_path> <original_po_file_commit_hash>')
99
100
fp=sys.argv[1]
101
-output_lines=main(fp)
+output_lines=None
102
+iflen(sys.argv)==3:
103
+original_hash=sys.argv[2]
104
+output_lines=main(fp,original_hash)
105
+else:
106
+output_lines=main(fp)
107
108
withopen(fp,'w')asf:
109
f.writelines([s+'\n'forsinoutput_lines])