OLD | NEW |
1 # coding=utf8 | 1 # coding=utf8 |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 """Manages a project checkout. | 5 """Manages a project checkout. |
6 | 6 |
7 Includes support for svn, git-svn and git. | 7 Includes support for svn, git-svn and git. |
8 """ | 8 """ |
9 | 9 |
10 import ConfigParser | 10 import ConfigParser |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 with open(filepath, 'wb') as f: | 669 with open(filepath, 'wb') as f: |
670 f.write(content) | 670 f.write(content) |
671 stdout.append('Added binary file %d bytes' % len(content)) | 671 stdout.append('Added binary file %d bytes' % len(content)) |
672 cmd = ['add', p.filename] | 672 cmd = ['add', p.filename] |
673 if verbose: | 673 if verbose: |
674 cmd.append('--verbose') | 674 cmd.append('--verbose') |
675 stdout.append(self._check_output_git(cmd)) | 675 stdout.append(self._check_output_git(cmd)) |
676 else: | 676 else: |
677 # No need to do anything special with p.is_new or if not | 677 # No need to do anything special with p.is_new or if not |
678 # p.diff_hunks. git apply manages all that already. | 678 # p.diff_hunks. git apply manages all that already. |
679 cmd = ['apply', '--index', '-p%s' % p.patchlevel] | 679 cmd = ['apply', '--index', '-3', '-p%s' % p.patchlevel] |
680 if verbose: | 680 if verbose: |
681 cmd.append('--verbose') | 681 cmd.append('--verbose') |
682 stdout.append(self._check_output_git(cmd, stdin=p.get(True))) | 682 stdout.append(self._check_output_git(cmd, stdin=p.get(True))) |
683 for key, value in p.svn_properties: | 683 for key, value in p.svn_properties: |
684 # Ignore some known auto-props flags through .subversion/config, | 684 # Ignore some known auto-props flags through .subversion/config, |
685 # bails out on the other ones. | 685 # bails out on the other ones. |
686 # TODO(maruel): Read ~/.subversion/config and detect the rules that | 686 # TODO(maruel): Read ~/.subversion/config and detect the rules that |
687 # applies here to figure out if the property will be correctly | 687 # applies here to figure out if the property will be correctly |
688 # handled. | 688 # handled. |
689 stdout.append('Property %s=%s' % (key, value)) | 689 stdout.append('Property %s=%s' % (key, value)) |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 def revisions(self, rev1, rev2): | 829 def revisions(self, rev1, rev2): |
830 return self.checkout.revisions(rev1, rev2) | 830 return self.checkout.revisions(rev1, rev2) |
831 | 831 |
832 @property | 832 @property |
833 def project_name(self): | 833 def project_name(self): |
834 return self.checkout.project_name | 834 return self.checkout.project_name |
835 | 835 |
836 @property | 836 @property |
837 def project_path(self): | 837 def project_path(self): |
838 return self.checkout.project_path | 838 return self.checkout.project_path |
OLD | NEW |