| 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 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 class NoTryServerAccess(Exception): | 60 class NoTryServerAccess(Exception): |
| 61 def __str__(self): | 61 def __str__(self): |
| 62 return self.args[0] + '\n' + HELP_STRING | 62 return self.args[0] + '\n' + HELP_STRING |
| 63 | 63 |
| 64 | 64 |
| 65 def PathDifference(root, subpath): | 65 def PathDifference(root, subpath): |
| 66 """Returns the difference subpath minus root.""" | 66 """Returns the difference subpath minus root.""" |
| 67 if subpath.find(root) != 0: | 67 if subpath.find(root) != 0: |
| 68 return None | 68 return None |
| 69 # The + 1 is for the trailing / or \. | 69 # If the root does not have a trailing \ or /, we add it so the returned path |
| 70 return subpath[len(root) + len(os.sep):] | 70 # starts immediately after the seperator regardless of whether it is provided. |
| 71 if not root.endswith(os.sep): |
| 72 root += os.sep |
| 73 return subpath[len(root):] |
| 71 | 74 |
| 72 | 75 |
| 73 def GetSourceRoot(): | 76 def GetSourceRoot(): |
| 74 """Returns the absolute directory one level up from the repository root.""" | 77 """Returns the absolute directory one level up from the repository root.""" |
| 75 return os.path.abspath(os.path.join(gcl.GetRepositoryRoot(), '..')) | 78 return os.path.abspath(os.path.join(gcl.GetRepositoryRoot(), '..')) |
| 76 | 79 |
| 77 | 80 |
| 78 def ExecuteTryServerScript(): | 81 def ExecuteTryServerScript(): |
| 79 """Locates the tryserver script, executes it and returns its dictionary. | 82 """Locates the tryserver script, executes it and returns its dictionary. |
| 80 | 83 |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 if patch_name == 'Unnamed': | 501 if patch_name == 'Unnamed': |
| 499 print "Note: use --name NAME to change the try's name." | 502 print "Note: use --name NAME to change the try's name." |
| 500 except (InvalidScript, NoTryServerAccess), e: | 503 except (InvalidScript, NoTryServerAccess), e: |
| 501 if swallow_exception: | 504 if swallow_exception: |
| 502 return | 505 return |
| 503 print e | 506 print e |
| 504 | 507 |
| 505 | 508 |
| 506 if __name__ == "__main__": | 509 if __name__ == "__main__": |
| 507 TryChange(None, None, False) | 510 TryChange(None, None, False) |
| OLD | NEW |