| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # | 2 # |
| 3 # Copyright 2008-2009 Google Inc. All Rights Reserved. | 3 # Copyright 2008-2009 Google Inc. All Rights Reserved. |
| 4 # | 4 # |
| 5 # Licensed under the Apache License, Version 2.0 (the "License"); | 5 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 # you may not use this file except in compliance with the License. | 6 # you may not use this file except in compliance with the License. |
| 7 # You may obtain a copy of the License at | 7 # You may obtain a copy of the License at |
| 8 # | 8 # |
| 9 # http://www.apache.org/licenses/LICENSE-2.0 | 9 # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 # | 10 # |
| (...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1085 self.mox.ReplayAll() | 1085 self.mox.ReplayAll() |
| 1086 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, | 1086 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, |
| 1087 relpath=self.relpath) | 1087 relpath=self.relpath) |
| 1088 scm.revert(options, self.args, files_list) | 1088 scm.revert(options, self.args, files_list) |
| 1089 | 1089 |
| 1090 def testRevertNone(self): | 1090 def testRevertNone(self): |
| 1091 options = self.Options(verbose=True) | 1091 options = self.Options(verbose=True) |
| 1092 base_path = os.path.join(self.root_dir, self.relpath) | 1092 base_path = os.path.join(self.root_dir, self.relpath) |
| 1093 gclient.os.path.isdir(base_path).AndReturn(True) | 1093 gclient.os.path.isdir(base_path).AndReturn(True) |
| 1094 gclient_scm.CaptureSVNStatus(base_path).AndReturn([]) | 1094 gclient_scm.CaptureSVNStatus(base_path).AndReturn([]) |
| 1095 gclient_scm.RunSVNAndGetFileList(['update', '--revision', 'BASE'], base_path
, | 1095 gclient_scm.RunSVNAndGetFileList(['update', '--revision', 'BASE'], |
| 1096 mox.IgnoreArg()) | 1096 base_path, mox.IgnoreArg()) |
| 1097 | 1097 |
| 1098 self.mox.ReplayAll() | 1098 self.mox.ReplayAll() |
| 1099 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, | 1099 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, |
| 1100 relpath=self.relpath) | 1100 relpath=self.relpath) |
| 1101 file_list = [] | 1101 file_list = [] |
| 1102 scm.revert(options, self.args, file_list) | 1102 scm.revert(options, self.args, file_list) |
| 1103 | 1103 |
| 1104 def testRevert2Files(self): | 1104 def testRevert2Files(self): |
| 1105 options = self.Options(verbose=True) | 1105 options = self.Options(verbose=True) |
| 1106 base_path = os.path.join(self.root_dir, self.relpath) | 1106 base_path = os.path.join(self.root_dir, self.relpath) |
| 1107 gclient.os.path.isdir(base_path).AndReturn(True) | 1107 gclient.os.path.isdir(base_path).AndReturn(True) |
| 1108 items = [ | 1108 items = [ |
| 1109 ('M ', 'a'), | 1109 ('M ', 'a'), |
| 1110 ('A ', 'b'), | 1110 ('A ', 'b'), |
| 1111 ] | 1111 ] |
| 1112 file_path1 = os.path.join(base_path, 'a') | 1112 file_path1 = os.path.join(base_path, 'a') |
| 1113 file_path2 = os.path.join(base_path, 'b') | 1113 file_path2 = os.path.join(base_path, 'b') |
| 1114 gclient_scm.CaptureSVNStatus(base_path).AndReturn(items) | 1114 gclient_scm.CaptureSVNStatus(base_path).AndReturn(items) |
| 1115 gclient_scm.os.path.exists(file_path1).AndReturn(True) | 1115 gclient_scm.os.path.exists(file_path1).AndReturn(True) |
| 1116 gclient_scm.os.path.isfile(file_path1).AndReturn(True) | 1116 gclient_scm.os.path.isfile(file_path1).AndReturn(True) |
| 1117 gclient_scm.os.remove(file_path1) | 1117 gclient_scm.os.remove(file_path1) |
| 1118 gclient_scm.os.path.exists(file_path2).AndReturn(True) | 1118 gclient_scm.os.path.exists(file_path2).AndReturn(True) |
| 1119 gclient_scm.os.path.isfile(file_path2).AndReturn(True) | 1119 gclient_scm.os.path.isfile(file_path2).AndReturn(True) |
| 1120 gclient_scm.os.remove(file_path2) | 1120 gclient_scm.os.remove(file_path2) |
| 1121 gclient_scm.RunSVNAndGetFileList(['update', '--revision', 'BASE'], base_path
, | 1121 gclient_scm.RunSVNAndGetFileList(['update', '--revision', 'BASE'], |
| 1122 mox.IgnoreArg()) | 1122 base_path, mox.IgnoreArg()) |
| 1123 print(os.path.join(base_path, 'a')) | 1123 print(os.path.join(base_path, 'a')) |
| 1124 print(os.path.join(base_path, 'b')) | 1124 print(os.path.join(base_path, 'b')) |
| 1125 | 1125 |
| 1126 self.mox.ReplayAll() | 1126 self.mox.ReplayAll() |
| 1127 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, | 1127 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, |
| 1128 relpath=self.relpath) | 1128 relpath=self.relpath) |
| 1129 file_list = [] | 1129 file_list = [] |
| 1130 scm.revert(options, self.args, file_list) | 1130 scm.revert(options, self.args, file_list) |
| 1131 | 1131 |
| 1132 def testRevertDirectory(self): | 1132 def testRevertDirectory(self): |
| 1133 options = self.Options(verbose=True) | 1133 options = self.Options(verbose=True) |
| 1134 base_path = os.path.join(self.root_dir, self.relpath) | 1134 base_path = os.path.join(self.root_dir, self.relpath) |
| 1135 gclient.os.path.isdir(base_path).AndReturn(True) | 1135 gclient.os.path.isdir(base_path).AndReturn(True) |
| 1136 items = [ | 1136 items = [ |
| 1137 ('~ ', 'a'), | 1137 ('~ ', 'a'), |
| 1138 ] | 1138 ] |
| 1139 gclient_scm.CaptureSVNStatus(base_path).AndReturn(items) | 1139 gclient_scm.CaptureSVNStatus(base_path).AndReturn(items) |
| 1140 file_path = os.path.join(base_path, 'a') | 1140 file_path = os.path.join(base_path, 'a') |
| 1141 print(file_path) | 1141 print(file_path) |
| 1142 gclient_scm.os.path.exists(file_path).AndReturn(True) | 1142 gclient_scm.os.path.exists(file_path).AndReturn(True) |
| 1143 gclient_scm.os.path.isfile(file_path).AndReturn(False) | 1143 gclient_scm.os.path.isfile(file_path).AndReturn(False) |
| 1144 gclient_scm.os.path.isdir(file_path).AndReturn(True) | 1144 gclient_scm.os.path.isdir(file_path).AndReturn(True) |
| 1145 #gclient_scm.os.remove(file_path) | |
| 1146 gclient_utils.RemoveDirectory(file_path) | 1145 gclient_utils.RemoveDirectory(file_path) |
| 1147 file_list1 = [] | 1146 file_list1 = [] |
| 1148 gclient_scm.RunSVNAndGetFileList(['update', '--revision', 'BASE'], base_path
, | 1147 gclient_scm.RunSVNAndGetFileList(['update', '--revision', 'BASE'], base_path
, |
| 1149 mox.IgnoreArg()) | 1148 mox.IgnoreArg()) |
| 1150 | 1149 |
| 1151 self.mox.ReplayAll() | 1150 self.mox.ReplayAll() |
| 1152 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, | 1151 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, |
| 1153 relpath=self.relpath) | 1152 relpath=self.relpath) |
| 1154 file_list2 = [] | 1153 file_list2 = [] |
| 1155 scm.revert(options, self.args, file_list2) | 1154 scm.revert(options, self.args, file_list2) |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1419 """ | 1418 """ |
| 1420 gclient_scm.CaptureSVN = CaptureSVNMock | 1419 gclient_scm.CaptureSVN = CaptureSVNMock |
| 1421 info = gclient_scm.CaptureSVNStatus(None) | 1420 info = gclient_scm.CaptureSVNStatus(None) |
| 1422 self.assertEquals(info, []) | 1421 self.assertEquals(info, []) |
| 1423 | 1422 |
| 1424 | 1423 |
| 1425 if __name__ == '__main__': | 1424 if __name__ == '__main__': |
| 1426 unittest.main() | 1425 unittest.main() |
| 1427 | 1426 |
| 1428 # vim: ts=2:sw=2:tw=80:et: | 1427 # vim: ts=2:sw=2:tw=80:et: |
| OLD | NEW |