OLD | NEW |
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 Loading... |
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 |
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 Loading... |
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() |
OLD | NEW |