OLD | NEW |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # | 2 # |
3 # Copyright 2008 Google Inc. All Rights Reserved. | 3 # Copyright 2008 Google Inc. All Rights Reserved. |
4 # | 4 # |
5 # Licensed under the Apache License, Version 2.0 (the "License"); | 5 # Licensed under the Apache License, Version 2.0 (the "License"); |
6 # you may not use this file except in compliance with the License. | 6 # you may not use this file except in compliance with the License. |
7 # You may obtain a copy of the License at | 7 # You may obtain a copy of the License at |
8 # | 8 # |
9 # http://www.apache.org/licenses/LICENSE-2.0 | 9 # http://www.apache.org/licenses/LICENSE-2.0 |
10 # | 10 # |
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
781 if not os.path.exists(checkout_path): | 781 if not os.path.exists(checkout_path): |
782 # We need to checkout. | 782 # We need to checkout. |
783 command = ['checkout', url, checkout_path] | 783 command = ['checkout', url, checkout_path] |
784 if revision: | 784 if revision: |
785 command.extend(['--revision', str(revision)]) | 785 command.extend(['--revision', str(revision)]) |
786 RunSVNAndGetFileList(command, self._root_dir, file_list) | 786 RunSVNAndGetFileList(command, self._root_dir, file_list) |
787 return | 787 return |
788 | 788 |
789 # Get the existing scm url and the revision number of the current checkout. | 789 # Get the existing scm url and the revision number of the current checkout. |
790 from_info = CaptureSVNInfo(os.path.join(checkout_path, '.'), '.') | 790 from_info = CaptureSVNInfo(os.path.join(checkout_path, '.'), '.') |
791 if not from_info: | |
792 raise Error("Can't update/checkout %s if an unversioned directory is " | |
sgk
2009/05/15 05:18:29
Nit: I prefer %r in messages like this so the str
| |
793 "present. Delete the directory and try again." % | |
794 checkout_path) | |
791 | 795 |
792 if options.manually_grab_svn_rev: | 796 if options.manually_grab_svn_rev: |
793 # Retrieve the current HEAD version because svn is slow at null updates. | 797 # Retrieve the current HEAD version because svn is slow at null updates. |
794 if not revision: | 798 if not revision: |
795 from_info_live = CaptureSVNInfo(from_info['URL'], '.') | 799 from_info_live = CaptureSVNInfo(from_info['URL'], '.') |
796 revision = int(from_info_live['Revision']) | 800 revision = int(from_info_live['Revision']) |
797 rev_str = ' at %d' % revision | 801 rev_str = ' at %d' % revision |
798 | 802 |
799 if from_info['URL'] != components[0]: | 803 if from_info['URL'] != components[0]: |
800 to_info = CaptureSVNInfo(url, '.') | 804 to_info = CaptureSVNInfo(url, '.') |
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1721 | 1725 |
1722 if "__main__" == __name__: | 1726 if "__main__" == __name__: |
1723 try: | 1727 try: |
1724 result = Main(sys.argv) | 1728 result = Main(sys.argv) |
1725 except Error, e: | 1729 except Error, e: |
1726 print >> sys.stderr, "Error: %s" % str(e) | 1730 print >> sys.stderr, "Error: %s" % str(e) |
1727 result = 1 | 1731 result = 1 |
1728 sys.exit(result) | 1732 sys.exit(result) |
1729 | 1733 |
1730 # vim: ts=2:sw=2:tw=80:et: | 1734 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |