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 1641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1652 hash_before, hash_after = self.hashes.get(filename, (None,None)) | 1652 hash_before, hash_after = self.hashes.get(filename, (None,None)) |
1653 base_content = None | 1653 base_content = None |
1654 new_content = None | 1654 new_content = None |
1655 status = None | 1655 status = None |
1656 | 1656 |
1657 if filename in self.renames: | 1657 if filename in self.renames: |
1658 status = "A +" # Match svn attribute name for renames. | 1658 status = "A +" # Match svn attribute name for renames. |
1659 if filename not in self.hashes: | 1659 if filename not in self.hashes: |
1660 # If a rename doesn't change the content, we never get a hash. | 1660 # If a rename doesn't change the content, we never get a hash. |
1661 base_content = RunShell( | 1661 base_content = RunShell( |
1662 ["git", "show", "HEAD:" + filename], silent_ok=True) | 1662 ["git", "show", "HEAD:" + filename], silent_ok=True, |
| 1663 universal_newlines=False) |
1663 elif not hash_before: | 1664 elif not hash_before: |
1664 status = "A" | 1665 status = "A" |
1665 base_content = "" | 1666 base_content = "" |
1666 elif not hash_after: | 1667 elif not hash_after: |
1667 status = "D" | 1668 status = "D" |
1668 else: | 1669 else: |
1669 status = "M" | 1670 status = "M" |
1670 | 1671 |
1671 # Grab the before/after content if we need it. | 1672 # Grab the before/after content if we need it. |
1672 # Grab the base content if we don't have it already. | 1673 # Grab the base content if we don't have it already. |
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2704 os.environ['LC_ALL'] = 'C' | 2705 os.environ['LC_ALL'] = 'C' |
2705 RealMain(sys.argv) | 2706 RealMain(sys.argv) |
2706 except KeyboardInterrupt: | 2707 except KeyboardInterrupt: |
2707 print | 2708 print |
2708 StatusUpdate("Interrupted.") | 2709 StatusUpdate("Interrupted.") |
2709 sys.exit(1) | 2710 sys.exit(1) |
2710 | 2711 |
2711 | 2712 |
2712 if __name__ == "__main__": | 2713 if __name__ == "__main__": |
2713 main() | 2714 main() |
OLD | NEW |