File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Filter options
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Original file line number Diff line number Diff line change @@ -53,8 +53,8 @@ def get_msgs(lines):
53
53
lineno += 1
54
54
return msgids , msgstrs
55
55
56
- def main (fp ):
57
- p = subprocess .Popen (['git' , 'show' , 'HEAD:' + fp ], stdout = subprocess .PIPE )
56
+ def main (fp , original_po_commit = 'HEAD' ):
57
+ p = subprocess .Popen (['git' , 'show' , '{}:' . format ( original_po_commit ) + fp ], stdout = subprocess .PIPE )
58
58
out , err = p .communicate ()
59
59
head_po = out .decode ().splitlines ()
60
60
msgids , msgstrs = get_msgs (head_po )
@@ -95,10 +95,15 @@ def main(fp):
95
95
if __name__ == '__main__' :
96
96
import sys
97
97
if len (sys .argv ) < 2 :
98
- print ('Usage: python fix_diffs.py <po_file_path>' )
98
+ print ('Usage: python fix_diffs.py <po_file_path> <original_po_file_commit_hash> ' )
99
99
100
100
fp = sys .argv [1 ]
101
- output_lines = main (fp )
101
+ output_lines = None
102
+ if len (sys .argv ) == 3 :
103
+ original_hash = sys .argv [2 ]
104
+ output_lines = main (fp , original_hash )
105
+ else :
106
+ output_lines = main (fp )
102
107
103
108
with open (fp , 'w' ) as f :
104
109
f .writelines ([s + '\n ' for s in output_lines ])
You can’t perform that action at this time.
0 commit comments