| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 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 """Client-side script to send a try job to the try server. It communicates to | 5 """Client-side script to send a try job to the try server. It communicates to |
| 6 the try server by either writting to a svn repository or by directly connecting | 6 the try server by either writting to a svn repository or by directly connecting |
| 7 to the server by HTTP. | 7 to the server by HTTP. |
| 8 """ | 8 """ |
| 9 | 9 |
| 10 | 10 |
| 11 import datetime | 11 import datetime |
| 12 import getpass | 12 import getpass |
| 13 import logging | 13 import logging |
| 14 import optparse | 14 import optparse |
| 15 import os | 15 import os |
| 16 import shutil | 16 import shutil |
| 17 import sys | 17 import sys |
| 18 import tempfile | 18 import tempfile |
| 19 import traceback | 19 import traceback |
| 20 import urllib | 20 import urllib |
| 21 | 21 |
| 22 import gcl | 22 import gcl |
| 23 import gclient |
| 23 | 24 |
| 24 __version__ = '1.1' | 25 __version__ = '1.1' |
| 25 | 26 |
| 26 | 27 |
| 27 # Constants | 28 # Constants |
| 28 HELP_STRING = "Sorry, Tryserver is not available." | 29 HELP_STRING = "Sorry, Tryserver is not available." |
| 29 SCRIPT_PATH = os.path.join('tools', 'tryserver', 'tryserver.py') | 30 SCRIPT_PATH = os.path.join('tools', 'tryserver', 'tryserver.py') |
| 30 USAGE = r"""%prog [options] | 31 USAGE = r"""%prog [options] |
| 31 | 32 |
| 32 Client-side script to send a try job to the try server. It communicates to | 33 Client-side script to send a try job to the try server. It communicates to |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 previous_cwd = os.getcwd() | 126 previous_cwd = os.getcwd() |
| 126 if root is None: | 127 if root is None: |
| 127 os.chdir(gcl.GetRepositoryRoot()) | 128 os.chdir(gcl.GetRepositoryRoot()) |
| 128 else: | 129 else: |
| 129 os.chdir(root) | 130 os.chdir(root) |
| 130 | 131 |
| 131 diff = [] | 132 diff = [] |
| 132 for file in files: | 133 for file in files: |
| 133 # Use svn info output instead of os.path.isdir because the latter fails | 134 # Use svn info output instead of os.path.isdir because the latter fails |
| 134 # when the file is deleted. | 135 # when the file is deleted. |
| 135 if gcl.GetSVNFileInfo(file).get("Node Kind") == "directory": | 136 if gclient.CaptureSVNInfo(file).get("Node Kind") in ("dir", "directory"): |
| 136 continue | 137 continue |
| 137 # If the user specified a custom diff command in their svn config file, | 138 # If the user specified a custom diff command in their svn config file, |
| 138 # then it'll be used when we do svn diff, which we don't want to happen | 139 # then it'll be used when we do svn diff, which we don't want to happen |
| 139 # since we want the unified diff. Using --diff-cmd=diff doesn't always | 140 # since we want the unified diff. Using --diff-cmd=diff doesn't always |
| 140 # work, since they can have another diff executable in their path that | 141 # work, since they can have another diff executable in their path that |
| 141 # gives different line endings. So we use a bogus temp directory as the | 142 # gives different line endings. So we use a bogus temp directory as the |
| 142 # config directory, which gets around these problems. | 143 # config directory, which gets around these problems. |
| 143 if sys.platform.startswith("win"): | 144 if sys.platform.startswith("win"): |
| 144 parent_dir = tempfile.gettempdir() | 145 parent_dir = tempfile.gettempdir() |
| 145 else: | 146 else: |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 if patch_name == 'Unnamed': | 497 if patch_name == 'Unnamed': |
| 497 print "Note: use --name NAME to change the try's name." | 498 print "Note: use --name NAME to change the try's name." |
| 498 except (InvalidScript, NoTryServerAccess), e: | 499 except (InvalidScript, NoTryServerAccess), e: |
| 499 if swallow_exception: | 500 if swallow_exception: |
| 500 return | 501 return |
| 501 print e | 502 print e |
| 502 | 503 |
| 503 | 504 |
| 504 if __name__ == "__main__": | 505 if __name__ == "__main__": |
| 505 TryChange(None, None, False) | 506 TryChange(None, None, False) |
| OLD | NEW |