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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 139 |
140 if blames: | 140 if blames: |
141 print "Blaming %s\n" % ",".join(blames) | 141 print "Blaming %s\n" % ",".join(blames) |
142 if reviewers != blames: | 142 if reviewers != blames: |
143 print "Emailing %s\n" % ",".join(reviewers) | 143 print "Emailing %s\n" % ",".join(reviewers) |
144 print "These files were modified in %s:" % revisions_string | 144 print "These files were modified in %s:" % revisions_string |
145 print "\n".join(files) | 145 print "\n".join(files) |
146 print "" | 146 print "" |
147 | 147 |
148 # Make sure these files are unmodified with svn status. | 148 # Make sure these files are unmodified with svn status. |
149 status = gclient_scm.CaptureSVNStatus(files) | 149 status = gclient_scm.scm.SVN.CaptureStatus(files) |
150 if status: | 150 if status: |
151 if force: | 151 if force: |
152 # TODO(maruel): Use the tool to correctly revert '?' files. | 152 # TODO(maruel): Use the tool to correctly revert '?' files. |
153 gcl.RunShell(["svn", "revert"] + files) | 153 gcl.RunShell(["svn", "revert"] + files) |
154 else: | 154 else: |
155 raise ModifiedFile(status) | 155 raise ModifiedFile(status) |
156 # svn up on each of these files | 156 # svn up on each of these files |
157 gcl.RunShell(["svn", "up"] + files) | 157 gcl.RunShell(["svn", "up"] + files) |
158 | 158 |
159 files_status = {} | 159 files_status = {} |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 print "".join(e.args) | 291 print "".join(e.args) |
292 print "You can use the --force flag to revert the files." | 292 print "You can use the --force flag to revert the files." |
293 except OutsideOfCheckout, e: | 293 except OutsideOfCheckout, e: |
294 print "Your repository doesn't contain ", str(e) | 294 print "Your repository doesn't contain ", str(e) |
295 | 295 |
296 return retcode | 296 return retcode |
297 | 297 |
298 | 298 |
299 if __name__ == "__main__": | 299 if __name__ == "__main__": |
300 sys.exit(Main(sys.argv)) | 300 sys.exit(Main(sys.argv)) |
OLD | NEW |