OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 """Client-side script to send a try job to the try server. It communicates to | 6 """Client-side script to send a try job to the try server. It communicates to |
7 the try server by either writting to a svn repository or by directly connecting | 7 the try server by either writting to a svn repository or by directly connecting |
8 to the server by HTTP. | 8 to the server by HTTP. |
9 """ | 9 """ |
10 | 10 |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
471 raise NoTryServerAccess("Could not guess version control system. " | 471 raise NoTryServerAccess("Could not guess version control system. " |
472 "Are you in a working copy directory?") | 472 "Are you in a working copy directory?") |
473 | 473 |
474 | 474 |
475 def GetMungedDiff(path_diff, diff): | 475 def GetMungedDiff(path_diff, diff): |
476 # Munge paths to match svn. | 476 # Munge paths to match svn. |
477 changed_files = [] | 477 changed_files = [] |
478 for i in range(len(diff)): | 478 for i in range(len(diff)): |
479 if diff[i].startswith('--- ') or diff[i].startswith('+++ '): | 479 if diff[i].startswith('--- ') or diff[i].startswith('+++ '): |
480 new_file = posixpath.join(path_diff, diff[i][4:]).replace('\\', '/') | 480 new_file = posixpath.join(path_diff, diff[i][4:]).replace('\\', '/') |
481 changed_files.append(('M', new_file.split('\t')[0])) | 481 if diff[i].startswith('--- '): |
M-A Ruel
2011/09/27 15:00:45
Maybe time to?
import patch
patchset = (call func
Alexei Svitkine (slow)
2011/09/27 15:05:13
Maybe next time. ;)
| |
482 file_path = new_file.split('\t')[0].strip() | |
483 if file_path.startswith('a/'): | |
484 file_path = file_path[2:] | |
485 changed_files.append(('M', file_path)) | |
482 diff[i] = diff[i][0:4] + new_file | 486 diff[i] = diff[i][0:4] + new_file |
483 return (diff, changed_files) | 487 return (diff, changed_files) |
484 | 488 |
485 | 489 |
486 def TryChange(argv, | 490 def TryChange(argv, |
487 change, | 491 change, |
488 file_list, | 492 file_list, |
489 swallow_exception, | 493 swallow_exception, |
490 prog=None, | 494 prog=None, |
491 extra_epilog=None): | 495 extra_epilog=None): |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
795 return 1 | 799 return 1 |
796 except (gclient_utils.Error, subprocess2.CalledProcessError), e: | 800 except (gclient_utils.Error, subprocess2.CalledProcessError), e: |
797 print >> sys.stderr, e | 801 print >> sys.stderr, e |
798 return 1 | 802 return 1 |
799 return 0 | 803 return 0 |
800 | 804 |
801 | 805 |
802 if __name__ == "__main__": | 806 if __name__ == "__main__": |
803 fix_encoding.fix_encoding() | 807 fix_encoding.fix_encoding() |
804 sys.exit(TryChange(None, None, [], False)) | 808 sys.exit(TryChange(None, None, [], False)) |
OLD | NEW |