Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 52bb30c

Browse filesBrowse files
committed
Update git show to take an arbitrary hash
* Add original_po_file_commit_hash to main func argument * Add argument <original_po_file_commit_hash> to argv
1 parent 3df3585 commit 52bb30c
Copy full SHA for 52bb30c

File tree

Expand file treeCollapse file tree

1 file changed

+9
-4
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+9
-4
lines changed

‎scripts/fix_diffs.py

Copy file name to clipboardExpand all lines: scripts/fix_diffs.py
+9-4Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ def get_msgs(lines):
5353
lineno += 1
5454
return msgids, msgstrs
5555

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)
5858
out, err = p.communicate()
5959
head_po = out.decode().splitlines()
6060
msgids, msgstrs = get_msgs(head_po)
@@ -95,10 +95,15 @@ def main(fp):
9595
if __name__ == '__main__':
9696
import sys
9797
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>')
9999

100100
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)
102107

103108
with open(fp, 'w') as f:
104109
f.writelines([s + '\n' for s in output_lines])

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.