OLD | NEW |
1 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """SCM-specific utility classes.""" | 5 """SCM-specific utility classes.""" |
6 | 6 |
7 import cStringIO | 7 import cStringIO |
8 import glob | 8 import glob |
9 import logging | 9 import logging |
10 import os | 10 import os |
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 if info.get("Node Kind") != "directory": | 726 if info.get("Node Kind") != "directory": |
727 # svn diff on a mv/cp'd file outputs nothing if there was no change. | 727 # svn diff on a mv/cp'd file outputs nothing if there was no change. |
728 data = SVN.Capture(command) | 728 data = SVN.Capture(command) |
729 if not data: | 729 if not data: |
730 # We put in an empty Index entry so upload.py knows about them. | 730 # We put in an empty Index entry so upload.py knows about them. |
731 data = "Index: %s\n" % filename.replace(os.sep, '/') | 731 data = "Index: %s\n" % filename.replace(os.sep, '/') |
732 # Otherwise silently ignore directories. | 732 # Otherwise silently ignore directories. |
733 else: | 733 else: |
734 if info.get("Node Kind") != "directory": | 734 if info.get("Node Kind") != "directory": |
735 # Normal simple case. | 735 # Normal simple case. |
736 data = SVN.Capture(command) | 736 try: |
| 737 data = SVN.Capture(command) |
| 738 except gclient_utils.CheckCallError, e: |
| 739 if revision: |
| 740 data = GenFakeDiff(filename) |
| 741 else: |
| 742 raise |
737 # Otherwise silently ignore directories. | 743 # Otherwise silently ignore directories. |
738 return data | 744 return data |
739 | 745 |
740 @staticmethod | 746 @staticmethod |
741 def GenerateDiff(filenames, root=None, full_move=False, revision=None): | 747 def GenerateDiff(filenames, root=None, full_move=False, revision=None): |
742 """Returns a string containing the diff for the given file list. | 748 """Returns a string containing the diff for the given file list. |
743 | 749 |
744 The files in the list should either be absolute paths or relative to the | 750 The files in the list should either be absolute paths or relative to the |
745 given root. If no root directory is provided, the repository root will be | 751 given root. If no root directory is provided, the repository root will be |
746 used. | 752 used. |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
971 if (file_status[0][0] in ('D', 'A', '!') or | 977 if (file_status[0][0] in ('D', 'A', '!') or |
972 not file_status[0][1:].isspace()): | 978 not file_status[0][1:].isspace()): |
973 # Added, deleted file requires manual intervention and require calling | 979 # Added, deleted file requires manual intervention and require calling |
974 # revert, like for properties. | 980 # revert, like for properties. |
975 try: | 981 try: |
976 SVN.Capture(['revert', file_status[1]], cwd=repo_root) | 982 SVN.Capture(['revert', file_status[1]], cwd=repo_root) |
977 except gclient_utils.CheckCallError: | 983 except gclient_utils.CheckCallError: |
978 if not os.path.exists(file_path): | 984 if not os.path.exists(file_path): |
979 continue | 985 continue |
980 raise | 986 raise |
OLD | NEW |