Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Side by Side Diff: gclient-new-workdir.py

Issue 1462553002: Fix gclient-new-workdir.py (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698