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

Side by Side Diff: apply_issue.py

Issue 17644004: Add --no-commit option to apply_issue for use with git on the bots. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 7 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) 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
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 parser.add_option( 58 parser.add_option(
59 '-r', 59 '-r',
60 '--root_dir', 60 '--root_dir',
61 default=os.getcwd(), 61 default=os.getcwd(),
62 help='Root directory to apply the patch') 62 help='Root directory to apply the patch')
63 parser.add_option( 63 parser.add_option(
64 '-s', 64 '-s',
65 '--server', 65 '--server',
66 default='http://codereview.chromium.org', 66 default='http://codereview.chromium.org',
67 help='Rietveld server') 67 help='Rietveld server')
68 parser.add_option('--no-commit', action='store_true',
69 help='Do not try to commit patch to SCM (git only)')
68 options, args = parser.parse_args() 70 options, args = parser.parse_args()
69 logging.basicConfig( 71 logging.basicConfig(
70 format='%(levelname)5s %(module)11s(%(lineno)4d): %(message)s', 72 format='%(levelname)5s %(module)11s(%(lineno)4d): %(message)s',
71 level=[logging.WARNING, logging.INFO, logging.DEBUG][ 73 level=[logging.WARNING, logging.INFO, logging.DEBUG][
72 min(2, options.verbose)]) 74 min(2, options.verbose)])
73 if args: 75 if args:
74 parser.error('Extra argument(s) "%s" not understood' % ' '.join(args)) 76 parser.error('Extra argument(s) "%s" not understood' % ' '.join(args))
75 if not options.issue: 77 if not options.issue:
76 parser.error('Require --issue') 78 parser.error('Require --issue')
77 options.server = options.server.rstrip('/') 79 options.server = options.server.rstrip('/')
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 print( 132 print(
131 'Failed to fetch the patch for issue %d, patchset %d.\n' 133 'Failed to fetch the patch for issue %d, patchset %d.\n'
132 'Try visiting %s/%d') % ( 134 'Try visiting %s/%d') % (
133 options.issue, options.patchset, 135 options.issue, options.patchset,
134 options.server, options.issue) 136 options.server, options.issue)
135 return 1 137 return 1
136 for patch in patchset.patches: 138 for patch in patchset.patches:
137 print(patch) 139 print(patch)
138 full_dir = os.path.abspath(options.root_dir) 140 full_dir = os.path.abspath(options.root_dir)
139 scm_type = scm.determine_scm(full_dir) 141 scm_type = scm.determine_scm(full_dir)
140 if scm_type == 'svn': 142 if options.no_commit or scm_type is None:
143 scm_obj = checkout.RawCheckout(full_dir, None, None)
144 elif scm_type == 'svn':
141 scm_obj = checkout.SvnCheckout(full_dir, None, None, None, None) 145 scm_obj = checkout.SvnCheckout(full_dir, None, None, None, None)
142 elif scm_type == 'git': 146 elif scm_type == 'git':
143 scm_obj = checkout.GitCheckoutBase(full_dir, None, None) 147 scm_obj = checkout.GitCheckoutBase(full_dir, None, None)
144 elif scm_type == None:
145 scm_obj = checkout.RawCheckout(full_dir, None, None)
146 else: 148 else:
147 parser.error('Couldn\'t determine the scm') 149 parser.error('Couldn\'t determine the scm')
148 150
149 # TODO(maruel): HACK, remove me. 151 # TODO(maruel): HACK, remove me.
150 # When run a build slave, make sure buildbot knows that the checkout was 152 # When run a build slave, make sure buildbot knows that the checkout was
151 # modified. 153 # modified.
152 if options.root_dir == 'src' and getpass.getuser() == 'chrome-bot': 154 if options.root_dir == 'src' and getpass.getuser() == 'chrome-bot':
153 # See sourcedirIsPatched() in: 155 # See sourcedirIsPatched() in:
154 # http://src.chromium.org/viewvc/chrome/trunk/tools/build/scripts/slave/ 156 # http://src.chromium.org/viewvc/chrome/trunk/tools/build/scripts/slave/
155 # chromium_commands.py?view=markup 157 # chromium_commands.py?view=markup
(...skipping 25 matching lines...) Expand all
181 '--nohooks', 183 '--nohooks',
182 '--delete_unversioned_trees', 184 '--delete_unversioned_trees',
183 ], 185 ],
184 cwd=gclient_root) 186 cwd=gclient_root)
185 return 0 187 return 0
186 188
187 189
188 if __name__ == "__main__": 190 if __name__ == "__main__":
189 fix_encoding.fix_encoding() 191 fix_encoding.fix_encoding()
190 sys.exit(main()) 192 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