| 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 atexit | 8 import atexit |
| 9 import errno | 9 import errno |
| 10 import logging | 10 import logging |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 elif status[0] == '!': | 162 elif status[0] == '!': |
| 163 to_remove.append(filepath) | 163 to_remove.append(filepath) |
| 164 if to_add: | 164 if to_add: |
| 165 check_call(['svn', 'add', '--no-auto-props', '-q'] + to_add, cwd=repo) | 165 check_call(['svn', 'add', '--no-auto-props', '-q'] + to_add, cwd=repo) |
| 166 if to_remove: | 166 if to_remove: |
| 167 check_call(['svn', 'remove', '-q'] + to_remove, cwd=repo) | 167 check_call(['svn', 'remove', '-q'] + to_remove, cwd=repo) |
| 168 proc = Popen(['svn', 'commit', repo, '-m', 'foo', '--non-interactive', | 168 proc = Popen(['svn', 'commit', repo, '-m', 'foo', '--non-interactive', |
| 169 '--no-auth-cache', '--username', 'user1', '--password', 'foo'], | 169 '--no-auth-cache', '--username', 'user1', '--password', 'foo'], |
| 170 cwd=repo) | 170 cwd=repo) |
| 171 out, err = proc.communicate() | 171 out, err = proc.communicate() |
| 172 match = re.search(r'revision (\d+).', out) | 172 last_line = out.splitlines()[-1] |
| 173 match = re.search(r'(\d+)', out) |
| 173 if not match: | 174 if not match: |
| 174 raise Exception('Commit failed', out, err, proc.returncode) | 175 raise Exception('Commit failed', out, err, proc.returncode) |
| 175 rev = match.group(1) | 176 rev = match.group(1) |
| 176 st = Popen(['svn', 'status'], cwd=repo).communicate()[0] | 177 st = Popen(['svn', 'status'], cwd=repo).communicate()[0] |
| 177 assert len(st) == 0, st | 178 assert len(st) == 0, st |
| 178 logging.debug('At revision %s' % rev) | 179 logging.debug('At revision %s' % rev) |
| 179 return rev | 180 return rev |
| 180 | 181 |
| 181 | 182 |
| 182 def commit_git(repo): | 183 def commit_git(repo): |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 | 634 |
| 634 | 635 |
| 635 # Kind of hack. | 636 # Kind of hack. |
| 636 if '-l' in sys.argv: | 637 if '-l' in sys.argv: |
| 637 FakeRepos.SHOULD_LEAK = True | 638 FakeRepos.SHOULD_LEAK = True |
| 638 sys.argv.remove('-l') | 639 sys.argv.remove('-l') |
| 639 | 640 |
| 640 | 641 |
| 641 if __name__ == '__main__': | 642 if __name__ == '__main__': |
| 642 sys.exit(main(sys.argv)) | 643 sys.exit(main(sys.argv)) |
| OLD | NEW |