OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 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 # Usage: | 6 # Usage: |
7 # gclient-new-workdir.py <repository> <new_workdir> [<branch>] | 7 # gclient-new-workdir.py <repository> <new_workdir> [<branch>] |
8 # | 8 # |
9 | 9 |
10 import os | 10 import os |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 os.makedirs(new_workdir) | 69 os.makedirs(new_workdir) |
70 os.symlink(gclient, os.path.join(new_workdir, '.gclient')) | 70 os.symlink(gclient, os.path.join(new_workdir, '.gclient')) |
71 | 71 |
72 for root, dirs, _ in os.walk(repository): | 72 for root, dirs, _ in os.walk(repository): |
73 if '.git' in dirs: | 73 if '.git' in dirs: |
74 workdir = root.replace(repository, new_workdir, 1) | 74 workdir = root.replace(repository, new_workdir, 1) |
75 print('Creating: %s' % workdir) | 75 print('Creating: %s' % workdir) |
76 git_common.make_workdir(os.path.join(root, '.git'), | 76 git_common.make_workdir(os.path.join(root, '.git'), |
77 os.path.join(workdir, '.git')) | 77 os.path.join(workdir, '.git')) |
78 subprocess.check_call(['git', 'checkout', '-f'], | 78 subprocess.check_call(['git', 'checkout', '-f'], cwd=workdir) |
79 cwd=new_workdir.rstrip('.git')) | |
80 | 79 |
81 | 80 |
82 if __name__ == '__main__': | 81 if __name__ == '__main__': |
83 sys.exit(main()) | 82 sys.exit(main()) |
OLD | NEW |