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

Side by Side Diff: apply_issue.py

Issue 10918264: When a DEPS file is modified, run gclient sync. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Use BASE on Subversion Created 8 years, 3 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 | Annotate | Revision Log
« 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) 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
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())
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