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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 given root. If no root directory is provided, the repository root will be | 144 given root. If no root directory is provided, the repository root will be |
145 used. | 145 used. |
146 """ | 146 """ |
147 previous_cwd = os.getcwd() | 147 previous_cwd = os.getcwd() |
148 if root is None: | 148 if root is None: |
149 os.chdir(gcl.GetRepositoryRoot()) | 149 os.chdir(gcl.GetRepositoryRoot()) |
150 else: | 150 else: |
151 os.chdir(root) | 151 os.chdir(root) |
152 | 152 |
153 # Directories will return None so filter them out. | 153 # Directories will return None so filter them out. |
154 diff = filter(None, [scm.SVN.Diff(f) for f in files]) | 154 diff = filter(None, [scm.SVN.DiffItem(f) for f in files]) |
155 os.chdir(previous_cwd) | 155 os.chdir(previous_cwd) |
156 return "".join(diff) | 156 return "".join(diff) |
157 | 157 |
158 def GetFileNames(self): | 158 def GetFileNames(self): |
159 """Return the list of files in the diff.""" | 159 """Return the list of files in the diff.""" |
160 return self.change_info.GetFileNames() | 160 return self.change_info.GetFileNames() |
161 | 161 |
162 def GetLocalRoot(self): | 162 def GetLocalRoot(self): |
163 """Return the path of the repository root.""" | 163 """Return the path of the repository root.""" |
164 return self.change_info.GetLocalRoot() | 164 return self.change_info.GetLocalRoot() |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 except (InvalidScript, NoTryServerAccess), e: | 564 except (InvalidScript, NoTryServerAccess), e: |
565 if swallow_exception: | 565 if swallow_exception: |
566 return 1 | 566 return 1 |
567 print e | 567 print e |
568 return 1 | 568 return 1 |
569 return 0 | 569 return 0 |
570 | 570 |
571 | 571 |
572 if __name__ == "__main__": | 572 if __name__ == "__main__": |
573 sys.exit(TryChange(None, None, False)) | 573 sys.exit(TryChange(None, None, False)) |
OLD | NEW |