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

Side by Side Diff: roll_dep.py

Issue 1699333002: Fix regexp in roll_dep.py. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 4 years, 10 months 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.
96 # Fall back to reading the DEPS to figure out the original commit. 96 # Fall back to reading the DEPS to figure out the original commit.
97 for i in deps_content.splitlines(): 97 for i in deps_content.splitlines():
98 m = re.match(r'\s+"' + key + '": "([a-z0-9]{40})",', i) 98 m = re.match(r'\s+"' + key + '":.*"([a-z0-9]{40})",', i)
smut 2016/02/17 22:14:53 Does it actually need to be .*? Not \s+ or somethi
rohitrao (ping after 24h) 2016/02/17 22:43:02 The text in this region tends to be of the form: "
smut 2016/02/17 22:43:59 Fair.
99 if m: 99 if m:
100 head = m.group(1) 100 head = m.group(1)
101 break 101 break
102 else: 102 else:
103 raise Error('Expected to find commit %s for %s in DEPS' % (head, key)) 103 raise Error('Expected to find commit %s for %s in DEPS' % (head, key))
104 104
105 print('Found old revision %s' % head) 105 print('Found old revision %s' % head)
106 106
107 check_call(['git', 'fetch', 'origin', '--quiet'], cwd=full_dir) 107 check_call(['git', 'fetch', 'origin', '--quiet'], cwd=full_dir)
108 roll_to = check_output(['git', 'rev-parse', roll_to], cwd=full_dir).strip() 108 roll_to = check_output(['git', 'rev-parse', roll_to], cwd=full_dir).strip()
(...skipping 104 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