Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(37)

Side by Side Diff: upload.py

Issue 9183044: Images are binaries too. (Closed)
Patch Set: Created 11 years, 11 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # coding: utf-8 2 # coding: utf-8
3 # 3 #
4 # Copyright 2007 Google Inc. 4 # Copyright 2007 Google Inc.
5 # 5 #
6 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License. 7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at 8 # You may obtain a copy of the License at
9 # 9 #
10 # http://www.apache.org/licenses/LICENSE-2.0 10 # http://www.apache.org/licenses/LICENSE-2.0
(...skipping 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after
1588 base_content = RunShell( 1588 base_content = RunShell(
1589 ["git", "show", "HEAD:" + filename], silent_ok=True) 1589 ["git", "show", "HEAD:" + filename], silent_ok=True)
1590 elif not hash_before: 1590 elif not hash_before:
1591 status = "A" 1591 status = "A"
1592 base_content = "" 1592 base_content = ""
1593 elif not hash_after: 1593 elif not hash_after:
1594 status = "D" 1594 status = "D"
1595 else: 1595 else:
1596 status = "M" 1596 status = "M"
1597 1597
1598 is_binary = self.IsBinaryData(base_content)
1599 is_image = self.IsImage(filename) 1598 is_image = self.IsImage(filename)
1599 is_binary = self.IsBinaryData(base_content) or is_image
M-A 2013/05/07 01:45:27 This helps so lgtm but it's not sufficient. It sho
1600 1600
1601 # Grab the before/after content if we need it. 1601 # Grab the before/after content if we need it.
1602 # Grab the base content if we don't have it already. 1602 # Grab the base content if we don't have it already.
1603 if base_content is None and hash_before: 1603 if base_content is None and hash_before:
1604 base_content = self.GetFileContent(hash_before, is_binary) 1604 base_content = self.GetFileContent(hash_before, is_binary)
1605 # Only include the "after" file if it's an image; otherwise it 1605 # Only include the "after" file if it's an image; otherwise it
1606 # it is reconstructed from the diff. 1606 # it is reconstructed from the diff.
1607 if is_image and hash_after: 1607 if is_image and hash_after:
1608 new_content = self.GetFileContent(hash_after, is_binary) 1608 new_content = self.GetFileContent(hash_after, is_binary)
1609 1609
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after
2603 os.environ['LC_ALL'] = 'C' 2603 os.environ['LC_ALL'] = 'C'
2604 RealMain(sys.argv) 2604 RealMain(sys.argv)
2605 except KeyboardInterrupt: 2605 except KeyboardInterrupt:
2606 print 2606 print
2607 StatusUpdate("Interrupted.") 2607 StatusUpdate("Interrupted.")
2608 sys.exit(1) 2608 sys.exit(1)
2609 2609
2610 2610
2611 if __name__ == "__main__": 2611 if __name__ == "__main__":
2612 main() 2612 main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b