| 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 """Generate fake repositories for testing.""" | 6 """Generate fake repositories for testing.""" |
| 7 | 7 |
| 8 import logging | 8 import logging |
| 9 import os | 9 import os |
| 10 import re | 10 import re |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 deps = { | 230 deps = { |
| 231 'src/other': 'svn://%(host)s/svn/trunk/other', | 231 'src/other': 'svn://%(host)s/svn/trunk/other', |
| 232 'src/third_party/foo': '/trunk/third_party/foo@1', | 232 'src/third_party/foo': '/trunk/third_party/foo@1', |
| 233 } | 233 } |
| 234 # I think this is wrong to have the hooks run from the base of the gclient | 234 # I think this is wrong to have the hooks run from the base of the gclient |
| 235 # checkout. It's maybe a bit too late to change that behavior. | 235 # checkout. It's maybe a bit too late to change that behavior. |
| 236 hooks = [ | 236 hooks = [ |
| 237 { | 237 { |
| 238 'pattern': '.', | 238 'pattern': '.', |
| 239 'action': ['python', '-c', | 239 'action': ['python', '-c', |
| 240 'open(\\'src/hooked1\\', \\'w\\').write(\\'hooked1\\')'], | 240 'open(\\'src/svn_hooked1\\', \\'w\\').write(\\'svn_hooked1\\')'], |
| 241 }, | 241 }, |
| 242 { | 242 { |
| 243 # Should not be run. | 243 # Should not be run. |
| 244 'pattern': 'nonexistent', | 244 'pattern': 'nonexistent', |
| 245 'action': ['python', '-c', | 245 'action': ['python', '-c', |
| 246 'open(\\'src/hooked2\\', \\'w\\').write(\\'hooked2\\')'], | 246 'open(\\'src/svn_hooked2\\', \\'w\\').write(\\'svn_hooked2\\')'], |
| 247 }, | 247 }, |
| 248 ] | 248 ] |
| 249 """ % { 'host': '127.0.0.1' })) | 249 """ % { 'host': '127.0.0.1' })) |
| 250 | 250 |
| 251 def setUpGIT(self): | 251 def setUpGIT(self): |
| 252 """Creates git repositories and start the servers.""" | 252 """Creates git repositories and start the servers.""" |
| 253 assert not self.gitdaemon | 253 assert not self.gitdaemon |
| 254 rmtree(self.git_root) | 254 rmtree(self.git_root) |
| 255 for repo in ['repo_%d' % r for r in range(1, 5)]: | 255 for repo in ['repo_%d' % r for r in range(1, 5)]: |
| 256 check_call(['git', 'init', '-q', join(self.git_root, repo)]) | 256 check_call(['git', 'init', '-q', join(self.git_root, repo)]) |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 deps = { | 314 deps = { |
| 315 'src/repo2': 'git://%(host)s/git/repo_2@%(hash)s', | 315 'src/repo2': 'git://%(host)s/git/repo_2@%(hash)s', |
| 316 'src/repo2/repo_renamed': '/repo_3', | 316 'src/repo2/repo_renamed': '/repo_3', |
| 317 } | 317 } |
| 318 # I think this is wrong to have the hooks run from the base of the gclient | 318 # I think this is wrong to have the hooks run from the base of the gclient |
| 319 # checkout. It's maybe a bit too late to change that behavior. | 319 # checkout. It's maybe a bit too late to change that behavior. |
| 320 hooks = [ | 320 hooks = [ |
| 321 { | 321 { |
| 322 'pattern': '.', | 322 'pattern': '.', |
| 323 'action': ['python', '-c', | 323 'action': ['python', '-c', |
| 324 'open(\\'src/hooked1\\', \\'w\\').write(\\'hooked1\\')'], | 324 'open(\\'src/git_hooked1\\', \\'w\\').write(\\'git_hooked1\\')'], |
| 325 }, | 325 }, |
| 326 { | 326 { |
| 327 # Should not be run. | 327 # Should not be run. |
| 328 'pattern': 'nonexistent', | 328 'pattern': 'nonexistent', |
| 329 'action': ['python', '-c', | 329 'action': ['python', '-c', |
| 330 'open(\\'src/hooked2\\', \\'w\\').write(\\'hooked2\\')'], | 330 'open(\\'src/git_hooked2\\', \\'w\\').write(\\'git_hooked2\\')'], |
| 331 }, | 331 }, |
| 332 ] | 332 ] |
| 333 """ % { | 333 """ % { |
| 334 # TODO(maruel): http://crosbug.com/3591 We need to strip the hash.. duh. | 334 # TODO(maruel): http://crosbug.com/3591 We need to strip the hash.. duh. |
| 335 'host': '127.0.0.1', 'hash': self.git_hashes['repo_2'][0][0][:7] }, | 335 'host': '127.0.0.1', 'hash': self.git_hashes['repo_2'][0][0][:7] }, |
| 336 'origin': "git/repo_1@2\n" | 336 'origin': "git/repo_1@2\n" |
| 337 }) | 337 }) |
| 338 | 338 |
| 339 # Start the daemon. | 339 # Start the daemon. |
| 340 cmd = ['git', 'daemon', '--export-all', '--base-path=' + self.repos_dir] | 340 cmd = ['git', 'daemon', '--export-all', '--base-path=' + self.repos_dir] |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 sys.stdin.readline() | 384 sys.stdin.readline() |
| 385 except KeyboardInterrupt: | 385 except KeyboardInterrupt: |
| 386 fake.leak = True | 386 fake.leak = True |
| 387 finally: | 387 finally: |
| 388 fake.tearDown() | 388 fake.tearDown() |
| 389 return 0 | 389 return 0 |
| 390 | 390 |
| 391 | 391 |
| 392 if __name__ == '__main__': | 392 if __name__ == '__main__': |
| 393 sys.exit(main(sys.argv)) | 393 sys.exit(main(sys.argv)) |
| OLD | NEW |