| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Unit tests for gclient_scm.py.""" | 6 """Unit tests for gclient_scm.py.""" |
| 7 | 7 |
| 8 # Import before super_mox to keep valid references. | 8 # Import before super_mox to keep valid references. |
| 9 from os import rename | 9 from os import rename |
| 10 from shutil import rmtree | 10 from shutil import rmtree |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 class SVNWrapperTestCase(BaseTestCase): | 57 class SVNWrapperTestCase(BaseTestCase): |
| 58 class OptionsObject(object): | 58 class OptionsObject(object): |
| 59 def __init__(self, verbose=False, revision=None): | 59 def __init__(self, verbose=False, revision=None): |
| 60 self.verbose = verbose | 60 self.verbose = verbose |
| 61 self.revision = revision | 61 self.revision = revision |
| 62 self.manually_grab_svn_rev = True | 62 self.manually_grab_svn_rev = True |
| 63 self.deps_os = None | 63 self.deps_os = None |
| 64 self.force = False | 64 self.force = False |
| 65 self.reset = False | 65 self.reset = False |
| 66 self.nohooks = False | 66 self.nohooks = False |
| 67 self.stdout = gclient_scm.sys.stdout | |
| 68 | 67 |
| 69 def Options(self, *args, **kwargs): | 68 def Options(self, *args, **kwargs): |
| 70 return self.OptionsObject(*args, **kwargs) | 69 return self.OptionsObject(*args, **kwargs) |
| 71 | 70 |
| 72 def setUp(self): | 71 def setUp(self): |
| 73 BaseTestCase.setUp(self) | 72 BaseTestCase.setUp(self) |
| 74 self.url = self.SvnUrl() | 73 self.url = self.SvnUrl() |
| 75 | 74 |
| 76 def testDir(self): | 75 def testDir(self): |
| 77 members = [ | 76 members = [ |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 # It'll to a checkout instead. | 129 # It'll to a checkout instead. |
| 131 gclient_scm.os.path.exists(gclient_scm.os.path.join(base_path, '.git') | 130 gclient_scm.os.path.exists(gclient_scm.os.path.join(base_path, '.git') |
| 132 ).AndReturn(False) | 131 ).AndReturn(False) |
| 133 # Checkout. | 132 # Checkout. |
| 134 gclient_scm.os.path.exists(base_path).AndReturn(False) | 133 gclient_scm.os.path.exists(base_path).AndReturn(False) |
| 135 files_list = self.mox.CreateMockAnything() | 134 files_list = self.mox.CreateMockAnything() |
| 136 gclient_scm.scm.SVN.RunAndGetFileList(options.verbose, | 135 gclient_scm.scm.SVN.RunAndGetFileList(options.verbose, |
| 137 ['checkout', self.url, base_path, | 136 ['checkout', self.url, base_path, |
| 138 '--force'], | 137 '--force'], |
| 139 cwd=self.root_dir, | 138 cwd=self.root_dir, |
| 140 file_list=files_list, | 139 file_list=files_list) |
| 141 stdout=options.stdout) | |
| 142 | 140 |
| 143 self.mox.ReplayAll() | 141 self.mox.ReplayAll() |
| 144 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, | 142 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, |
| 145 relpath=self.relpath) | 143 relpath=self.relpath) |
| 146 scm.revert(options, self.args, files_list) | 144 scm.revert(options, self.args, files_list) |
| 147 self.checkstdout( | 145 self.checkstdout( |
| 148 ('\n_____ %s is missing, synching instead\n' % self.relpath)) | 146 ('\n_____ %s is missing, synching instead\n' % self.relpath)) |
| 149 | 147 |
| 150 def testRevertNone(self): | 148 def testRevertNone(self): |
| 151 options = self.Options(verbose=True) | 149 options = self.Options(verbose=True) |
| 152 base_path = gclient_scm.os.path.join(self.root_dir, self.relpath) | 150 base_path = gclient_scm.os.path.join(self.root_dir, self.relpath) |
| 153 gclient_scm.os.path.isdir(base_path).AndReturn(True) | 151 gclient_scm.os.path.isdir(base_path).AndReturn(True) |
| 154 gclient_scm.scm.SVN.CaptureStatus(base_path).AndReturn([]) | 152 gclient_scm.scm.SVN.CaptureStatus(base_path).AndReturn([]) |
| 155 gclient_scm.scm.SVN.RunAndGetFileList(options.verbose, | 153 gclient_scm.scm.SVN.RunAndGetFileList(options.verbose, |
| 156 ['update', '--revision', 'BASE'], | 154 ['update', '--revision', 'BASE'], |
| 157 cwd=base_path, | 155 cwd=base_path, |
| 158 file_list=mox.IgnoreArg(), | 156 file_list=mox.IgnoreArg()) |
| 159 stdout=options.stdout) | |
| 160 | 157 |
| 161 self.mox.ReplayAll() | 158 self.mox.ReplayAll() |
| 162 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, | 159 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, |
| 163 relpath=self.relpath) | 160 relpath=self.relpath) |
| 164 file_list = [] | 161 file_list = [] |
| 165 scm.revert(options, self.args, file_list) | 162 scm.revert(options, self.args, file_list) |
| 166 | 163 |
| 167 def testRevert2Files(self): | 164 def testRevert2Files(self): |
| 168 options = self.Options(verbose=True) | 165 options = self.Options(verbose=True) |
| 169 base_path = gclient_scm.os.path.join(self.root_dir, self.relpath) | 166 base_path = gclient_scm.os.path.join(self.root_dir, self.relpath) |
| 170 gclient_scm.os.path.isdir(base_path).AndReturn(True) | 167 gclient_scm.os.path.isdir(base_path).AndReturn(True) |
| 171 items = [ | 168 items = [ |
| 172 ('M ', 'a'), | 169 ('M ', 'a'), |
| 173 ('A ', 'b'), | 170 ('A ', 'b'), |
| 174 ] | 171 ] |
| 175 file_path1 = gclient_scm.os.path.join(base_path, 'a') | 172 file_path1 = gclient_scm.os.path.join(base_path, 'a') |
| 176 file_path2 = gclient_scm.os.path.join(base_path, 'b') | 173 file_path2 = gclient_scm.os.path.join(base_path, 'b') |
| 177 gclient_scm.scm.SVN.CaptureStatus(base_path).AndReturn(items) | 174 gclient_scm.scm.SVN.CaptureStatus(base_path).AndReturn(items) |
| 178 gclient_scm.os.path.exists(file_path1).AndReturn(True) | 175 gclient_scm.os.path.exists(file_path1).AndReturn(True) |
| 179 gclient_scm.os.path.isfile(file_path1).AndReturn(True) | 176 gclient_scm.os.path.isfile(file_path1).AndReturn(True) |
| 180 gclient_scm.os.remove(file_path1) | 177 gclient_scm.os.remove(file_path1) |
| 181 gclient_scm.os.path.exists(file_path2).AndReturn(True) | 178 gclient_scm.os.path.exists(file_path2).AndReturn(True) |
| 182 gclient_scm.os.path.isfile(file_path2).AndReturn(True) | 179 gclient_scm.os.path.isfile(file_path2).AndReturn(True) |
| 183 gclient_scm.os.remove(file_path2) | 180 gclient_scm.os.remove(file_path2) |
| 184 gclient_scm.scm.SVN.RunAndGetFileList(options.verbose, | 181 gclient_scm.scm.SVN.RunAndGetFileList(options.verbose, |
| 185 ['update', '--revision', 'BASE'], | 182 ['update', '--revision', 'BASE'], |
| 186 cwd=base_path, | 183 cwd=base_path, |
| 187 file_list=mox.IgnoreArg(), | 184 file_list=mox.IgnoreArg()) |
| 188 stdout=options.stdout) | |
| 189 | 185 |
| 190 self.mox.ReplayAll() | 186 self.mox.ReplayAll() |
| 191 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, | 187 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, |
| 192 relpath=self.relpath) | 188 relpath=self.relpath) |
| 193 file_list = [] | 189 file_list = [] |
| 194 scm.revert(options, self.args, file_list) | 190 scm.revert(options, self.args, file_list) |
| 195 self.checkstdout( | 191 self.checkstdout( |
| 196 ('%s\n%s\n' % (gclient_scm.os.path.join(base_path, 'a'), | 192 ('%s\n%s\n' % (gclient_scm.os.path.join(base_path, 'a'), |
| 197 gclient_scm.os.path.join(base_path, 'b')))) | 193 gclient_scm.os.path.join(base_path, 'b')))) |
| 198 | 194 |
| 199 def testRevertDirectory(self): | 195 def testRevertDirectory(self): |
| 200 options = self.Options(verbose=True) | 196 options = self.Options(verbose=True) |
| 201 base_path = gclient_scm.os.path.join(self.root_dir, self.relpath) | 197 base_path = gclient_scm.os.path.join(self.root_dir, self.relpath) |
| 202 gclient_scm.os.path.isdir(base_path).AndReturn(True) | 198 gclient_scm.os.path.isdir(base_path).AndReturn(True) |
| 203 items = [ | 199 items = [ |
| 204 ('~ ', 'a'), | 200 ('~ ', 'a'), |
| 205 ] | 201 ] |
| 206 gclient_scm.scm.SVN.CaptureStatus(base_path).AndReturn(items) | 202 gclient_scm.scm.SVN.CaptureStatus(base_path).AndReturn(items) |
| 207 file_path = gclient_scm.os.path.join(base_path, 'a') | 203 file_path = gclient_scm.os.path.join(base_path, 'a') |
| 208 gclient_scm.os.path.exists(file_path).AndReturn(True) | 204 gclient_scm.os.path.exists(file_path).AndReturn(True) |
| 209 gclient_scm.os.path.isfile(file_path).AndReturn(False) | 205 gclient_scm.os.path.isfile(file_path).AndReturn(False) |
| 210 gclient_scm.os.path.islink(file_path).AndReturn(False) | 206 gclient_scm.os.path.islink(file_path).AndReturn(False) |
| 211 gclient_scm.os.path.isdir(file_path).AndReturn(True) | 207 gclient_scm.os.path.isdir(file_path).AndReturn(True) |
| 212 gclient_scm.gclient_utils.RemoveDirectory(file_path) | 208 gclient_scm.gclient_utils.RemoveDirectory(file_path) |
| 213 file_list1 = [] | 209 file_list1 = [] |
| 214 gclient_scm.scm.SVN.RunAndGetFileList(options.verbose, | 210 gclient_scm.scm.SVN.RunAndGetFileList(options.verbose, |
| 215 ['update', '--revision', 'BASE'], | 211 ['update', '--revision', 'BASE'], |
| 216 cwd=base_path, | 212 cwd=base_path, |
| 217 file_list=mox.IgnoreArg(), | 213 file_list=mox.IgnoreArg()) |
| 218 stdout=options.stdout) | |
| 219 | 214 |
| 220 self.mox.ReplayAll() | 215 self.mox.ReplayAll() |
| 221 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, | 216 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, |
| 222 relpath=self.relpath) | 217 relpath=self.relpath) |
| 223 file_list2 = [] | 218 file_list2 = [] |
| 224 scm.revert(options, self.args, file_list2) | 219 scm.revert(options, self.args, file_list2) |
| 225 self.checkstdout(('%s\n' % file_path)) | 220 self.checkstdout(('%s\n' % file_path)) |
| 226 | 221 |
| 227 def testStatus(self): | 222 def testStatus(self): |
| 228 options = self.Options(verbose=True) | 223 options = self.Options(verbose=True) |
| 229 base_path = gclient_scm.os.path.join(self.root_dir, self.relpath) | 224 base_path = gclient_scm.os.path.join(self.root_dir, self.relpath) |
| 230 gclient_scm.os.path.isdir(base_path).AndReturn(True) | 225 gclient_scm.os.path.isdir(base_path).AndReturn(True) |
| 231 gclient_scm.scm.SVN.RunAndGetFileList(options.verbose, | 226 gclient_scm.scm.SVN.RunAndGetFileList( |
| 232 ['status'] + self.args, | 227 options.verbose, ['status'] + self.args, |
| 233 cwd=base_path, file_list=[], | 228 cwd=base_path, file_list=[]).AndReturn(None) |
| 234 stdout=options.stdout).AndReturn(None) | |
| 235 | 229 |
| 236 self.mox.ReplayAll() | 230 self.mox.ReplayAll() |
| 237 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, | 231 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, |
| 238 relpath=self.relpath) | 232 relpath=self.relpath) |
| 239 file_list = [] | 233 file_list = [] |
| 240 self.assertEqual(scm.status(options, self.args, file_list), None) | 234 self.assertEqual(scm.status(options, self.args, file_list), None) |
| 241 | 235 |
| 242 # TODO(maruel): TEST REVISIONS!!! | 236 # TODO(maruel): TEST REVISIONS!!! |
| 243 # TODO(maruel): TEST RELOCATE!!! | 237 # TODO(maruel): TEST RELOCATE!!! |
| 244 def testUpdateCheckout(self): | 238 def testUpdateCheckout(self): |
| 245 options = self.Options(verbose=True) | 239 options = self.Options(verbose=True) |
| 246 base_path = gclient_scm.os.path.join(self.root_dir, self.relpath) | 240 base_path = gclient_scm.os.path.join(self.root_dir, self.relpath) |
| 247 file_info = gclient_scm.gclient_utils.PrintableObject() | 241 file_info = gclient_scm.gclient_utils.PrintableObject() |
| 248 file_info.root = 'blah' | 242 file_info.root = 'blah' |
| 249 file_info.url = self.url | 243 file_info.url = self.url |
| 250 file_info.uuid = 'ABC' | 244 file_info.uuid = 'ABC' |
| 251 file_info.revision = 42 | 245 file_info.revision = 42 |
| 252 gclient_scm.os.path.exists(gclient_scm.os.path.join(base_path, '.git') | 246 gclient_scm.os.path.exists(gclient_scm.os.path.join(base_path, '.git') |
| 253 ).AndReturn(False) | 247 ).AndReturn(False) |
| 254 # Checkout. | 248 # Checkout. |
| 255 gclient_scm.os.path.exists(base_path).AndReturn(False) | 249 gclient_scm.os.path.exists(base_path).AndReturn(False) |
| 256 files_list = self.mox.CreateMockAnything() | 250 files_list = self.mox.CreateMockAnything() |
| 257 gclient_scm.scm.SVN.Capture(['--version'] | 251 gclient_scm.scm.SVN.Capture(['--version'] |
| 258 ).AndReturn('svn, version 1.5.1 (r32289)') | 252 ).AndReturn('svn, version 1.5.1 (r32289)') |
| 259 gclient_scm.scm.SVN.RunAndGetFileList(options.verbose, | 253 gclient_scm.scm.SVN.RunAndGetFileList(options.verbose, |
| 260 ['checkout', self.url, base_path, | 254 ['checkout', self.url, base_path, |
| 261 '--force'], | 255 '--force'], |
| 262 cwd=self.root_dir, | 256 cwd=self.root_dir, |
| 263 file_list=files_list, | 257 file_list=files_list) |
| 264 stdout=options.stdout) | |
| 265 self.mox.ReplayAll() | 258 self.mox.ReplayAll() |
| 266 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, | 259 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, |
| 267 relpath=self.relpath) | 260 relpath=self.relpath) |
| 268 scm.update(options, (), files_list) | 261 scm.update(options, (), files_list) |
| 269 | 262 |
| 270 def testUpdateUpdate(self): | 263 def testUpdateUpdate(self): |
| 271 options = self.Options(verbose=True) | 264 options = self.Options(verbose=True) |
| 272 base_path = gclient_scm.os.path.join(self.root_dir, self.relpath) | 265 base_path = gclient_scm.os.path.join(self.root_dir, self.relpath) |
| 273 options.force = True | 266 options.force = True |
| 274 options.nohooks = False | 267 options.nohooks = False |
| (...skipping 19 matching lines...) Expand all Loading... |
| 294 additional_args = [] | 287 additional_args = [] |
| 295 if options.manually_grab_svn_rev: | 288 if options.manually_grab_svn_rev: |
| 296 additional_args = ['--revision', str(file_info['Revision'])] | 289 additional_args = ['--revision', str(file_info['Revision'])] |
| 297 gclient_scm.scm.SVN.Capture(['--version'] | 290 gclient_scm.scm.SVN.Capture(['--version'] |
| 298 ).AndReturn('svn, version 1.5.1 (r32289)') | 291 ).AndReturn('svn, version 1.5.1 (r32289)') |
| 299 additional_args.append('--force') | 292 additional_args.append('--force') |
| 300 files_list = [] | 293 files_list = [] |
| 301 gclient_scm.scm.SVN.RunAndGetFileList( | 294 gclient_scm.scm.SVN.RunAndGetFileList( |
| 302 options.verbose, | 295 options.verbose, |
| 303 ['update', base_path] + additional_args, | 296 ['update', base_path] + additional_args, |
| 304 cwd=self.root_dir, file_list=files_list, stdout=options.stdout) | 297 cwd=self.root_dir, file_list=files_list) |
| 305 | 298 |
| 306 self.mox.ReplayAll() | 299 self.mox.ReplayAll() |
| 307 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, | 300 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, |
| 308 relpath=self.relpath) | 301 relpath=self.relpath) |
| 309 scm.update(options, (), files_list) | 302 scm.update(options, (), files_list) |
| 310 | 303 |
| 311 def testUpdateSingleCheckout(self): | 304 def testUpdateSingleCheckout(self): |
| 312 options = self.Options(verbose=True) | 305 options = self.Options(verbose=True) |
| 313 base_path = gclient_scm.os.path.join(self.root_dir, self.relpath) | 306 base_path = gclient_scm.os.path.join(self.root_dir, self.relpath) |
| 314 file_info = { | 307 file_info = { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 326 ).AndReturn(False) | 319 ).AndReturn(False) |
| 327 | 320 |
| 328 # Verify no locked files. | 321 # Verify no locked files. |
| 329 gclient_scm.scm.SVN.CaptureStatus(gclient_scm.os.path.join(base_path, '.') | 322 gclient_scm.scm.SVN.CaptureStatus(gclient_scm.os.path.join(base_path, '.') |
| 330 ).AndReturn([]) | 323 ).AndReturn([]) |
| 331 | 324 |
| 332 # When checking out a single file, we issue an svn checkout and svn update. | 325 # When checking out a single file, we issue an svn checkout and svn update. |
| 333 files_list = self.mox.CreateMockAnything() | 326 files_list = self.mox.CreateMockAnything() |
| 334 gclient_scm.gclient_utils.CheckCallAndFilterAndHeader( | 327 gclient_scm.gclient_utils.CheckCallAndFilterAndHeader( |
| 335 ['svn', 'checkout', '--depth', 'empty', self.url, base_path], | 328 ['svn', 'checkout', '--depth', 'empty', self.url, base_path], |
| 336 always=True, cwd=self.root_dir, stdout=options.stdout) | 329 always=True, cwd=self.root_dir) |
| 337 gclient_scm.scm.SVN.RunAndGetFileList(options.verbose, ['update', 'DEPS'], | 330 gclient_scm.scm.SVN.RunAndGetFileList(options.verbose, ['update', 'DEPS'], |
| 338 cwd=base_path, file_list=files_list, stdout=options.stdout) | 331 cwd=base_path, file_list=files_list) |
| 339 | 332 |
| 340 # Now we fall back on scm.update(). | 333 # Now we fall back on scm.update(). |
| 341 gclient_scm.os.path.exists(gclient_scm.os.path.join(base_path, '.git') | 334 gclient_scm.os.path.exists(gclient_scm.os.path.join(base_path, '.git') |
| 342 ).AndReturn(False) | 335 ).AndReturn(False) |
| 343 gclient_scm.os.path.exists(base_path).AndReturn(True) | 336 gclient_scm.os.path.exists(base_path).AndReturn(True) |
| 344 gclient_scm.scm.SVN.CaptureInfo( | 337 gclient_scm.scm.SVN.CaptureInfo( |
| 345 gclient_scm.os.path.join(base_path, ".")).AndReturn(file_info) | 338 gclient_scm.os.path.join(base_path, ".")).AndReturn(file_info) |
| 346 gclient_scm.scm.SVN.CaptureInfo(file_info['URL']).AndReturn(file_info) | 339 gclient_scm.scm.SVN.CaptureInfo(file_info['URL']).AndReturn(file_info) |
| 347 | 340 |
| 348 self.mox.ReplayAll() | 341 self.mox.ReplayAll() |
| (...skipping 15 matching lines...) Expand all Loading... |
| 364 gclient_scm.scm.SVN.Capture(['--version'] | 357 gclient_scm.scm.SVN.Capture(['--version'] |
| 365 ).AndReturn('svn, version 1.4.4 (r25188)') | 358 ).AndReturn('svn, version 1.4.4 (r25188)') |
| 366 gclient_scm.os.path.exists(gclient_scm.os.path.join(base_path) | 359 gclient_scm.os.path.exists(gclient_scm.os.path.join(base_path) |
| 367 ).AndReturn(True) | 360 ).AndReturn(True) |
| 368 | 361 |
| 369 # When checking out a single file with svn 1.4, we use svn export | 362 # When checking out a single file with svn 1.4, we use svn export |
| 370 files_list = self.mox.CreateMockAnything() | 363 files_list = self.mox.CreateMockAnything() |
| 371 gclient_scm.gclient_utils.CheckCallAndFilterAndHeader( | 364 gclient_scm.gclient_utils.CheckCallAndFilterAndHeader( |
| 372 ['svn', 'export', gclient_scm.os.path.join(self.url, 'DEPS'), | 365 ['svn', 'export', gclient_scm.os.path.join(self.url, 'DEPS'), |
| 373 gclient_scm.os.path.join(base_path, 'DEPS')], | 366 gclient_scm.os.path.join(base_path, 'DEPS')], |
| 374 always=True, cwd=self.root_dir, stdout=options.stdout) | 367 always=True, cwd=self.root_dir) |
| 375 | 368 |
| 376 self.mox.ReplayAll() | 369 self.mox.ReplayAll() |
| 377 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, | 370 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, |
| 378 relpath=self.relpath) | 371 relpath=self.relpath) |
| 379 scm.updatesingle(options, ['DEPS'], files_list) | 372 scm.updatesingle(options, ['DEPS'], files_list) |
| 380 | 373 |
| 381 def testUpdateSingleCheckoutSVNUpgrade(self): | 374 def testUpdateSingleCheckoutSVNUpgrade(self): |
| 382 options = self.Options(verbose=True) | 375 options = self.Options(verbose=True) |
| 383 base_path = gclient_scm.os.path.join(self.root_dir, self.relpath) | 376 base_path = gclient_scm.os.path.join(self.root_dir, self.relpath) |
| 384 file_info = { | 377 file_info = { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 399 gclient_scm.os.remove(gclient_scm.os.path.join(base_path, 'DEPS')) | 392 gclient_scm.os.remove(gclient_scm.os.path.join(base_path, 'DEPS')) |
| 400 | 393 |
| 401 # Verify no locked files. | 394 # Verify no locked files. |
| 402 gclient_scm.scm.SVN.CaptureStatus(gclient_scm.os.path.join(base_path, '.') | 395 gclient_scm.scm.SVN.CaptureStatus(gclient_scm.os.path.join(base_path, '.') |
| 403 ).AndReturn([]) | 396 ).AndReturn([]) |
| 404 | 397 |
| 405 # When checking out a single file, we issue an svn checkout and svn update. | 398 # When checking out a single file, we issue an svn checkout and svn update. |
| 406 files_list = self.mox.CreateMockAnything() | 399 files_list = self.mox.CreateMockAnything() |
| 407 gclient_scm.gclient_utils.CheckCallAndFilterAndHeader( | 400 gclient_scm.gclient_utils.CheckCallAndFilterAndHeader( |
| 408 ['svn', 'checkout', '--depth', 'empty', self.url, base_path], | 401 ['svn', 'checkout', '--depth', 'empty', self.url, base_path], |
| 409 always=True, cwd=self.root_dir, stdout=options.stdout) | 402 always=True, cwd=self.root_dir) |
| 410 gclient_scm.scm.SVN.RunAndGetFileList(options.verbose, ['update', 'DEPS'], | 403 gclient_scm.scm.SVN.RunAndGetFileList(options.verbose, ['update', 'DEPS'], |
| 411 cwd=base_path, file_list=files_list, stdout=options.stdout) | 404 cwd=base_path, file_list=files_list) |
| 412 | 405 |
| 413 # Now we fall back on scm.update(). | 406 # Now we fall back on scm.update(). |
| 414 gclient_scm.os.path.exists(gclient_scm.os.path.join(base_path, '.git') | 407 gclient_scm.os.path.exists(gclient_scm.os.path.join(base_path, '.git') |
| 415 ).AndReturn(False) | 408 ).AndReturn(False) |
| 416 gclient_scm.os.path.exists(base_path).AndReturn(True) | 409 gclient_scm.os.path.exists(base_path).AndReturn(True) |
| 417 gclient_scm.scm.SVN.CaptureInfo( | 410 gclient_scm.scm.SVN.CaptureInfo( |
| 418 gclient_scm.os.path.join(base_path, ".")).AndReturn(file_info) | 411 gclient_scm.os.path.join(base_path, ".")).AndReturn(file_info) |
| 419 gclient_scm.scm.SVN.CaptureInfo(file_info['URL']).AndReturn(file_info) | 412 gclient_scm.scm.SVN.CaptureInfo(file_info['URL']).AndReturn(file_info) |
| 420 | 413 |
| 421 self.mox.ReplayAll() | 414 self.mox.ReplayAll() |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 """This class doesn't use pymox.""" | 470 """This class doesn't use pymox.""" |
| 478 class OptionsObject(object): | 471 class OptionsObject(object): |
| 479 def __init__(self, verbose=False, revision=None): | 472 def __init__(self, verbose=False, revision=None): |
| 480 self.verbose = verbose | 473 self.verbose = verbose |
| 481 self.revision = revision | 474 self.revision = revision |
| 482 self.manually_grab_svn_rev = True | 475 self.manually_grab_svn_rev = True |
| 483 self.deps_os = None | 476 self.deps_os = None |
| 484 self.force = False | 477 self.force = False |
| 485 self.reset = False | 478 self.reset = False |
| 486 self.nohooks = False | 479 self.nohooks = False |
| 487 self.stdout = gclient_scm.sys.stdout | |
| 488 | 480 |
| 489 sample_git_import = """blob | 481 sample_git_import = """blob |
| 490 mark :1 | 482 mark :1 |
| 491 data 6 | 483 data 6 |
| 492 Hello | 484 Hello |
| 493 | 485 |
| 494 blob | 486 blob |
| 495 mark :2 | 487 mark :2 |
| 496 data 4 | 488 data 4 |
| 497 Bye | 489 Bye |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 scm = gclient_scm.CreateSCM(url=self.url, root_dir=self.root_dir, | 825 scm = gclient_scm.CreateSCM(url=self.url, root_dir=self.root_dir, |
| 834 relpath=self.relpath) | 826 relpath=self.relpath) |
| 835 rev_info = scm.revinfo(options, (), None) | 827 rev_info = scm.revinfo(options, (), None) |
| 836 self.assertEquals(rev_info, '069c602044c5388d2d15c3f875b057c852003458') | 828 self.assertEquals(rev_info, '069c602044c5388d2d15c3f875b057c852003458') |
| 837 | 829 |
| 838 | 830 |
| 839 if __name__ == '__main__': | 831 if __name__ == '__main__': |
| 840 unittest.main() | 832 unittest.main() |
| 841 | 833 |
| 842 # vim: ts=2:sw=2:tw=80:et: | 834 # vim: ts=2:sw=2:tw=80:et: |
| OLD | NEW |