Chromium Code Reviews| 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 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1378 base_content = RunShell( | 1378 base_content = RunShell( |
| 1379 ["git", "show", "HEAD:" + filename], silent_ok=True) | 1379 ["git", "show", "HEAD:" + filename], silent_ok=True) |
| 1380 elif not hash_before: | 1380 elif not hash_before: |
| 1381 status = "A" | 1381 status = "A" |
| 1382 base_content = "" | 1382 base_content = "" |
| 1383 elif not hash_after: | 1383 elif not hash_after: |
| 1384 status = "D" | 1384 status = "D" |
| 1385 else: | 1385 else: |
| 1386 status = "M" | 1386 status = "M" |
| 1387 | 1387 |
| 1388 is_binary = self.IsBinaryData(base_content) | |
| 1389 is_image = self.IsImage(filename) | 1388 is_image = self.IsImage(filename) |
| 1389 is_binary = self.IsBinaryData(base_content) or is_image | |
|
cbiesinger
2013/05/08 04:54:15
I'm sort of confused by this code, base_content is
| |
| 1390 | 1390 |
| 1391 # Grab the before/after content if we need it. | 1391 # Grab the before/after content if we need it. |
| 1392 # Grab the base content if we don't have it already. | 1392 # Grab the base content if we don't have it already. |
| 1393 if base_content is None and hash_before: | 1393 if base_content is None and hash_before: |
| 1394 base_content = self.GetFileContent(hash_before, is_binary) | 1394 base_content = self.GetFileContent(hash_before, is_binary) |
| 1395 # Only include the "after" file if it's an image; otherwise it | 1395 # Only include the "after" file if it's an image; otherwise it |
| 1396 # it is reconstructed from the diff. | 1396 # it is reconstructed from the diff. |
| 1397 if is_image and hash_after: | 1397 if is_image and hash_after: |
| 1398 new_content = self.GetFileContent(hash_after, is_binary) | 1398 new_content = self.GetFileContent(hash_after, is_binary) |
| 1399 | 1399 |
| (...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2384 os.environ['LC_ALL'] = 'C' | 2384 os.environ['LC_ALL'] = 'C' |
| 2385 RealMain(sys.argv) | 2385 RealMain(sys.argv) |
| 2386 except KeyboardInterrupt: | 2386 except KeyboardInterrupt: |
| 2387 print | 2387 print |
| 2388 StatusUpdate("Interrupted.") | 2388 StatusUpdate("Interrupted.") |
| 2389 sys.exit(1) | 2389 sys.exit(1) |
| 2390 | 2390 |
| 2391 | 2391 |
| 2392 if __name__ == "__main__": | 2392 if __name__ == "__main__": |
| 2393 main() | 2393 main() |
| OLD | NEW |