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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 127 |
128 if blames: | 128 if blames: |
129 print "Blaming %s\n" % ",".join(blames) | 129 print "Blaming %s\n" % ",".join(blames) |
130 if reviewers != blames: | 130 if reviewers != blames: |
131 print "Emailing %s\n" % ",".join(reviewers) | 131 print "Emailing %s\n" % ",".join(reviewers) |
132 print "These files were modified in %s:" % revisions_string | 132 print "These files were modified in %s:" % revisions_string |
133 print "\n".join(files) | 133 print "\n".join(files) |
134 print "" | 134 print "" |
135 | 135 |
136 # Make sure these files are unmodified with svn status. | 136 # Make sure these files are unmodified with svn status. |
137 status = gcl.RunShell(["svn", "status"] + files) | 137 status = gcl.GetSVNStatus(files) |
138 if status: | 138 if status: |
139 if force: | 139 if force: |
140 # TODO(maruel): Use the tool to correctly revert '?' files. | 140 # TODO(maruel): Use the tool to correctly revert '?' files. |
141 gcl.RunShell(["svn", "revert"] + files) | 141 gcl.RunShell(["svn", "revert"] + files) |
142 else: | 142 else: |
143 raise ModifiedFile(status) | 143 raise ModifiedFile(status) |
144 # svn up on each of these files | 144 # svn up on each of these files |
145 gcl.RunShell(["svn", "up"] + files) | 145 gcl.RunShell(["svn", "up"] + files) |
146 | 146 |
147 files_status = {} | 147 files_status = {} |
(...skipping 127 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 |