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

Side by Side Diff: build/util/lastchange.py

Issue 119211: Grab the correct element from the match group of the git regex. (Closed)
Patch Set: Created 11 years, 6 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 (c) 2009 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2009 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 """ 6 """
7 lastchange.py -- Chromium revision fetching utility. 7 lastchange.py -- Chromium revision fetching utility.
8 """ 8 """
9 9
10 import optparse 10 import optparse
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 stdout=subprocess.PIPE, 47 stdout=subprocess.PIPE,
48 stderr=subprocess.PIPE) 48 stderr=subprocess.PIPE)
49 except OSError: 49 except OSError:
50 # 'git' is apparently either not installed or not executable. 50 # 'git' is apparently either not installed or not executable.
51 return None 51 return None
52 id = None 52 id = None
53 if p: 53 if p:
54 git_re = re.compile('^\s*git-svn-id:\s+(\S+)@(\d+)', re.M) 54 git_re = re.compile('^\s*git-svn-id:\s+(\S+)@(\d+)', re.M)
55 m = git_re.search(p.stdout.read()) 55 m = git_re.search(p.stdout.read())
56 if m: 56 if m:
57 id = m.group(1) 57 id = m.group(2)
58 return id 58 return id
59 59
60 60
61 def fetch_change(): 61 def fetch_change():
62 """ 62 """
63 Returns the last change, from some appropriate revision control system. 63 Returns the last change, from some appropriate revision control system.
64 """ 64 """
65 change = svn_fetch_revision() 65 change = svn_fetch_revision()
66 if not change and sys.platform in ('linux2',): 66 if not change and sys.platform in ('linux2',):
67 change = git_fetch_id() 67 change = git_fetch_id()
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 if out_file: 112 if out_file:
113 write_if_changed(out_file, contents) 113 write_if_changed(out_file, contents)
114 else: 114 else:
115 sys.stdout.write(contents) 115 sys.stdout.write(contents)
116 116
117 return 0 117 return 0
118 118
119 119
120 if __name__ == '__main__': 120 if __name__ == '__main__':
121 sys.exit(main()) 121 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