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

Side by Side Diff: roll_dep.py

Issue 1445833003: Add an option to ignore a dirty tree to roll_dep.py (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
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 | Annotate | Revision Log
« 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 2015 The Chromium Authors. All rights reserved. 2 # Copyright 2015 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 """Rolls DEPS controlled dependency. 6 """Rolls DEPS controlled dependency.
7 7
8 Works only with git checkout and git dependencies. Currently this 8 Works only with git checkout and git dependencies. Currently this
9 script will always roll to the tip of to origin/master. 9 script will always roll to the tip of to origin/master.
10 """ 10 """
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 if upstream_url.endswith(( 60 if upstream_url.endswith((
61 '/angle/angle.git', 61 '/angle/angle.git',
62 '/catapult-project/catapult.git', 62 '/catapult-project/catapult.git',
63 '/v8/v8.git')): 63 '/v8/v8.git')):
64 return False 64 return False
65 if 'webrtc' in upstream_url: 65 if 'webrtc' in upstream_url:
66 return False 66 return False
67 return True 67 return True
68 68
69 69
70 def roll(root, deps_dir, roll_to, key, reviewers, bug, no_log, log_limit): 70 def roll(root, deps_dir, roll_to, key, reviewers, bug, no_log, log_limit,
71 ignore_dirty_tree=False):
M-A Ruel 2015/11/14 01:54:20 Remove the default value
71 deps = os.path.join(root, 'DEPS') 72 deps = os.path.join(root, 'DEPS')
72 try: 73 try:
73 with open(deps, 'rb') as f: 74 with open(deps, 'rb') as f:
74 deps_content = f.read() 75 deps_content = f.read()
75 except (IOError, OSError): 76 except (IOError, OSError):
76 raise Error('Ensure the script is run in the directory ' 77 raise Error('Ensure the script is run in the directory '
77 'containing DEPS file.') 78 'containing DEPS file.')
78 79
79 if not is_pristine(root): 80 if not ignore_dirty_tree and not is_pristine(root):
80 raise Error('Ensure %s is clean first.' % root) 81 raise Error('Ensure %s is clean first.' % root)
81 82
82 full_dir = os.path.normpath(os.path.join(os.path.dirname(root), deps_dir)) 83 full_dir = os.path.normpath(os.path.join(os.path.dirname(root), deps_dir))
83 if not os.path.isdir(full_dir): 84 if not os.path.isdir(full_dir):
84 raise Error('Directory not found: %s' % deps_dir) 85 raise Error('Directory not found: %s' % deps_dir)
85 head = check_output(['git', 'rev-parse', 'HEAD'], cwd=full_dir).strip() 86 head = check_output(['git', 'rev-parse', 'HEAD'], cwd=full_dir).strip()
86 87
87 if not head in deps_content: 88 if not head in deps_content:
88 print('Warning: %s is not checked out at the expected revision in DEPS' % 89 print('Warning: %s is not checked out at the expected revision in DEPS' %
89 deps_dir) 90 deps_dir)
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 print('You forgot to pass -r, make sure to insert a R=foo@example.com line') 164 print('You forgot to pass -r, make sure to insert a R=foo@example.com line')
164 print('to the commit description before emailing.') 165 print('to the commit description before emailing.')
165 print('') 166 print('')
166 print('Run:') 167 print('Run:')
167 print(' git cl upload --send-mail') 168 print(' git cl upload --send-mail')
168 169
169 170
170 def main(): 171 def main():
171 parser = argparse.ArgumentParser(description=__doc__) 172 parser = argparse.ArgumentParser(description=__doc__)
172 parser.add_argument( 173 parser.add_argument(
174 '--ignore-dirty-tree', action='store_true',
175 help='Roll anyways, even if there is a diff.')
176 parser.add_argument(
173 '-r', '--reviewer', 177 '-r', '--reviewer',
174 help='To specify multiple reviewers, use comma separated list, e.g. ' 178 help='To specify multiple reviewers, use comma separated list, e.g. '
175 '-r joe,jane,john. Defaults to @chromium.org') 179 '-r joe,jane,john. Defaults to @chromium.org')
176 parser.add_argument('-b', '--bug', help='Associate a bug number to the roll') 180 parser.add_argument('-b', '--bug', help='Associate a bug number to the roll')
177 parser.add_argument( 181 parser.add_argument(
178 '--no-log', action='store_true', 182 '--no-log', action='store_true',
179 help='Do not include the short log in the commit message') 183 help='Do not include the short log in the commit message')
180 parser.add_argument( 184 parser.add_argument(
181 '--log-limit', type=int, default=100, 185 '--log-limit', type=int, default=100,
182 help='Trim log after N commits (default: %(default)s)') 186 help='Trim log after N commits (default: %(default)s)')
(...skipping 14 matching lines...) Expand all
197 201
198 try: 202 try:
199 roll( 203 roll(
200 os.getcwd(), 204 os.getcwd(),
201 args.dep_path, 205 args.dep_path,
202 args.roll_to, 206 args.roll_to,
203 args.key, 207 args.key,
204 reviewers, 208 reviewers,
205 args.bug, 209 args.bug,
206 args.no_log, 210 args.no_log,
207 args.log_limit) 211 args.log_limit,
212 args.ignore_dirty_tree)
208 213
209 except Error as e: 214 except Error as e:
210 sys.stderr.write('error: %s\n' % e) 215 sys.stderr.write('error: %s\n' % e)
211 return 1 216 return 1
212 217
213 return 0 218 return 0
214 219
215 220
216 if __name__ == '__main__': 221 if __name__ == '__main__':
217 sys.exit(main()) 222 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