OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 """Applies an issue from Rietveld. | 6 """Applies an issue from Rietveld. |
7 """ | 7 """ |
8 | 8 |
9 import getpass | 9 import getpass |
10 import logging | 10 import logging |
11 import optparse | 11 import optparse |
12 import os | 12 import os |
| 13 import subprocess |
13 import sys | 14 import sys |
14 import urllib2 | 15 import urllib2 |
15 | 16 |
16 import breakpad # pylint: disable=W0611 | 17 import breakpad # pylint: disable=W0611 |
17 | 18 |
18 import checkout | 19 import checkout |
19 import fix_encoding | 20 import fix_encoding |
| 21 import gclient_utils |
20 import rietveld | 22 import rietveld |
21 import scm | 23 import scm |
22 | 24 |
23 | 25 |
24 def main(): | 26 def main(): |
25 parser = optparse.OptionParser(description=sys.modules[__name__].__doc__) | 27 parser = optparse.OptionParser(description=sys.modules[__name__].__doc__) |
26 parser.add_option( | 28 parser.add_option( |
27 '-v', '--verbose', action='count', default=0, | 29 '-v', '--verbose', action='count', default=0, |
28 help='Prints debugging infos') | 30 help='Prints debugging infos') |
29 parser.add_option( | 31 parser.add_option( |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 # http://src.chromium.org/viewvc/chrome/trunk/tools/build/scripts/slave/ | 104 # http://src.chromium.org/viewvc/chrome/trunk/tools/build/scripts/slave/ |
103 # chromium_commands.py?view=markup | 105 # chromium_commands.py?view=markup |
104 open('.buildbot-patched', 'w').close() | 106 open('.buildbot-patched', 'w').close() |
105 | 107 |
106 # Apply the patch. | 108 # Apply the patch. |
107 try: | 109 try: |
108 scm_obj.apply_patch(patchset) | 110 scm_obj.apply_patch(patchset) |
109 except checkout.PatchApplicationFailed, e: | 111 except checkout.PatchApplicationFailed, e: |
110 print >> sys.stderr, str(e) | 112 print >> sys.stderr, str(e) |
111 return 1 | 113 return 1 |
| 114 |
| 115 if 'DEPS' in map(os.path.basename, patchset.filenames): |
| 116 gclient_root = gclient_utils.FindGclientRoot(options.root_dir) |
| 117 if gclient_root and scm_type: |
| 118 print( |
| 119 'A DEPS file was updated inside a gclient checkout, running gclient ' |
| 120 'sync.') |
| 121 base_rev = 'BASE' if scm_type == 'svn' else 'HEAD' |
| 122 return subprocess.call( |
| 123 ['gclient', 'sync', '--revision', base_rev], cwd=gclient_root) |
112 return 0 | 124 return 0 |
113 | 125 |
114 | 126 |
115 if __name__ == "__main__": | 127 if __name__ == "__main__": |
116 fix_encoding.fix_encoding() | 128 fix_encoding.fix_encoding() |
117 sys.exit(main()) | 129 sys.exit(main()) |
OLD | NEW |