OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2006-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 # Tool to quickly revert a change. | 6 # Tool to quickly revert a change. |
7 | 7 |
8 import exceptions | 8 import exceptions |
9 import optparse | 9 import optparse |
10 import os | 10 import os |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 | 209 |
210 description = "Reverting %s." % revisions_string | 210 description = "Reverting %s." % revisions_string |
211 if message: | 211 if message: |
212 description += "\n\n" | 212 description += "\n\n" |
213 description += message | 213 description += message |
214 # Don't use gcl.Change() since it prompts the user for infos. | 214 # Don't use gcl.Change() since it prompts the user for infos. |
215 change_info = gcl.ChangeInfo(name=changename, issue='', | 215 change_info = gcl.ChangeInfo(name=changename, issue='', |
216 description=description, files=files_status) | 216 description=description, files=files_status) |
217 change_info.Save() | 217 change_info.Save() |
218 | 218 |
219 upload_args = ['-r', ",".join(reviewers)] | 219 upload_args = ['--no_presubmit', '-r', ",".join(reviewers)] |
220 if send_email: | 220 if send_email: |
221 upload_args.append('--send_mail') | 221 upload_args.append('--send_mail') |
222 if commit: | 222 if commit: |
223 upload_args.append('--no_try') | 223 upload_args.append('--no_try') |
224 gcl.UploadCL(change_info, upload_args) | 224 gcl.UploadCL(change_info, upload_args) |
225 | 225 |
226 retcode = 0 | 226 retcode = 0 |
227 if commit: | 227 if commit: |
228 gcl.Commit(change_info, ['--force']) | 228 gcl.Commit(change_info, ['--no_presubmit', '--force']) |
229 # TODO(maruel): gclient sync (to leave the local checkout in an usable | 229 # TODO(maruel): gclient sync (to leave the local checkout in an usable |
230 # state) | 230 # state) |
231 retcode = gclient.Main(["gclient.py", "sync"]) | 231 retcode = gclient.Main(["gclient.py", "sync"]) |
232 return retcode | 232 return retcode |
233 | 233 |
234 | 234 |
235 def Main(argv): | 235 def Main(argv): |
236 usage = ( | 236 usage = ( |
237 """%prog [options] [revision numbers to revert] | 237 """%prog [options] [revision numbers to revert] |
238 Revert a set of revisions, send the review to Rietveld, sends a review email | 238 Revert a set of revisions, send the review to Rietveld, sends a review email |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 print "".join(e.args) | 275 print "".join(e.args) |
276 print "You can use the --force flag to revert the files." | 276 print "You can use the --force flag to revert the files." |
277 except OutsideOfCheckout, e: | 277 except OutsideOfCheckout, e: |
278 print "Your repository doesn't contain ", str(e) | 278 print "Your repository doesn't contain ", str(e) |
279 | 279 |
280 return retcode | 280 return retcode |
281 | 281 |
282 | 282 |
283 if __name__ == "__main__": | 283 if __name__ == "__main__": |
284 sys.exit(Main(sys.argv)) | 284 sys.exit(Main(sys.argv)) |
OLD | NEW |