| 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 subprocess |
| 14 import sys | 14 import sys |
| 15 import urllib2 | 15 import urllib2 |
| 16 | 16 |
| 17 import breakpad # pylint: disable=W0611 | 17 import breakpad # pylint: disable=W0611 |
| 18 | 18 |
| 19 import checkout | 19 import checkout |
| 20 import fix_encoding | 20 import fix_encoding |
| 21 import gclient_utils | 21 import gclient_utils |
| 22 import rietveld | 22 import rietveld |
| 23 import scm | 23 import scm |
| 24 | 24 |
| 25 BASE_DIR = os.path.dirname(os.path.abspath(__file__)) |
| 26 |
| 25 | 27 |
| 26 def main(): | 28 def main(): |
| 27 parser = optparse.OptionParser(description=sys.modules[__name__].__doc__) | 29 parser = optparse.OptionParser(description=sys.modules[__name__].__doc__) |
| 28 parser.add_option( | 30 parser.add_option( |
| 29 '-v', '--verbose', action='count', default=0, | 31 '-v', '--verbose', action='count', default=0, |
| 30 help='Prints debugging infos') | 32 help='Prints debugging infos') |
| 31 parser.add_option( | 33 parser.add_option( |
| 32 '-e', | 34 '-e', |
| 33 '--email', | 35 '--email', |
| 34 help='IGNORED: Kept for compatibility.') | 36 help='IGNORED: Kept for compatibility.') |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 print >> sys.stderr, str(e) | 114 print >> sys.stderr, str(e) |
| 113 return 1 | 115 return 1 |
| 114 | 116 |
| 115 if 'DEPS' in map(os.path.basename, patchset.filenames): | 117 if 'DEPS' in map(os.path.basename, patchset.filenames): |
| 116 gclient_root = gclient_utils.FindGclientRoot(options.root_dir) | 118 gclient_root = gclient_utils.FindGclientRoot(options.root_dir) |
| 117 if gclient_root and scm_type: | 119 if gclient_root and scm_type: |
| 118 print( | 120 print( |
| 119 'A DEPS file was updated inside a gclient checkout, running gclient ' | 121 'A DEPS file was updated inside a gclient checkout, running gclient ' |
| 120 'sync.') | 122 'sync.') |
| 121 base_rev = 'BASE' if scm_type == 'svn' else 'HEAD' | 123 base_rev = 'BASE' if scm_type == 'svn' else 'HEAD' |
| 124 gclient_path = os.path.join(BASE_DIR, 'gclient') |
| 125 if sys.platform == 'win32': |
| 126 gclient_path += '.bat' |
| 122 return subprocess.call( | 127 return subprocess.call( |
| 123 ['gclient', 'sync', '--revision', base_rev], cwd=gclient_root) | 128 [gclient_path, 'sync', '--revision', base_rev], cwd=gclient_root) |
| 124 return 0 | 129 return 0 |
| 125 | 130 |
| 126 | 131 |
| 127 if __name__ == "__main__": | 132 if __name__ == "__main__": |
| 128 fix_encoding.fix_encoding() | 133 fix_encoding.fix_encoding() |
| 129 sys.exit(main()) | 134 sys.exit(main()) |
| OLD | NEW |