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

Side by Side Diff: roll_dep.py

Issue 1507623003: Clarify error messages in roll_dep.py (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 5 years 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 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 ignore_dirty_tree=False): 71 ignore_dirty_tree=False):
72 deps = os.path.join(root, 'DEPS') 72 deps = os.path.join(root, 'DEPS')
73 try: 73 try:
74 with open(deps, 'rb') as f: 74 with open(deps, 'rb') as f:
75 deps_content = f.read() 75 deps_content = f.read()
76 except (IOError, OSError): 76 except (IOError, OSError):
77 raise Error('Ensure the script is run in the directory ' 77 raise Error('Ensure the script is run in the directory '
78 'containing DEPS file.') 78 'containing DEPS file.')
79 79
80 if not ignore_dirty_tree and not is_pristine(root): 80 if not ignore_dirty_tree and not is_pristine(root):
81 raise Error('Ensure %s is clean first.' % root) 81 raise Error('Ensure %s is clean first (no non-merged commits).' % root)
82 82
83 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))
84 if not os.path.isdir(full_dir): 84 if not os.path.isdir(full_dir):
85 raise Error('Directory not found: %s' % deps_dir) 85 raise Error('Directory not found: %s (%s)' % (deps_dir, full_dir))
86 head = check_output(['git', 'rev-parse', 'HEAD'], cwd=full_dir).strip() 86 head = check_output(['git', 'rev-parse', 'HEAD'], cwd=full_dir).strip()
87 87
88 if not head in deps_content: 88 if not head in deps_content:
89 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' %
90 deps_dir) 90 deps_dir)
91 if key is None: 91 if key is None:
92 print("Warning: no key specified. Using '%s'." % deps_dir) 92 print("Warning: no key specified. Using '%s'." % deps_dir)
93 key = deps_dir 93 key = deps_dir
94 94
95 # It happens if the user checked out a branch in the dependency by himself. 95 # It happens if the user checked out a branch in the dependency by himself.
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 213
214 except Error as e: 214 except Error as e:
215 sys.stderr.write('error: %s\n' % e) 215 sys.stderr.write('error: %s\n' % e)
216 return 1 216 return 1
217 217
218 return 0 218 return 0
219 219
220 220
221 if __name__ == '__main__': 221 if __name__ == '__main__':
222 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