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 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 if verbose: | 675 if verbose: |
676 cmd.append('--verbose') | 676 cmd.append('--verbose') |
677 stdout.append(self._check_output_git(cmd)) | 677 stdout.append(self._check_output_git(cmd)) |
678 else: | 678 else: |
679 # No need to do anything special with p.is_new or if not | 679 # No need to do anything special with p.is_new or if not |
680 # p.diff_hunks. git apply manages all that already. | 680 # p.diff_hunks. git apply manages all that already. |
681 cmd = ['apply', '--index', '-p%s' % p.patchlevel] | 681 cmd = ['apply', '--index', '-p%s' % p.patchlevel] |
682 if verbose: | 682 if verbose: |
683 cmd.append('--verbose') | 683 cmd.append('--verbose') |
684 stdout.append(self._check_output_git(cmd, stdin=p.get(True))) | 684 stdout.append(self._check_output_git(cmd, stdin=p.get(True))) |
685 for name, value in p.svn_properties: | 685 for key, value in p.svn_properties: |
686 # Ignore some known auto-props flags through .subversion/config, | 686 # Ignore some known auto-props flags through .subversion/config, |
687 # bails out on the other ones. | 687 # bails out on the other ones. |
688 # TODO(maruel): Read ~/.subversion/config and detect the rules that | 688 # TODO(maruel): Read ~/.subversion/config and detect the rules that |
689 # applies here to figure out if the property will be correctly | 689 # applies here to figure out if the property will be correctly |
690 # handled. | 690 # handled. |
691 stdout.append('Property %s=%s' % (name, value)) | 691 stdout.append('Property %s=%s' % (key, value)) |
692 if not name in ( | 692 if not key in ( |
693 'svn:eol-style', 'svn:executable', 'svn:mime-type'): | 693 'svn:eol-style', 'svn:executable', 'svn:mime-type'): |
694 raise patch.UnsupportedPatchFormat( | 694 raise patch.UnsupportedPatchFormat( |
695 p.filename, | 695 p.filename, |
696 'Cannot apply svn property %s to file %s.' % ( | 696 'Cannot apply svn property %s to file %s.' % ( |
697 name, p.filename)) | 697 key, p.filename)) |
698 for post in post_processors: | 698 for post in post_processors: |
699 post(self, p) | 699 post(self, p) |
700 if verbose: | 700 if verbose: |
701 print p.filename | 701 print p.filename |
702 print align_stdout(stdout) | 702 print align_stdout(stdout) |
703 except OSError, e: | 703 except OSError, e: |
704 raise PatchApplicationFailed(p, '%s%s' % (align_stdout(stdout), e)) | 704 raise PatchApplicationFailed(p, '%s%s' % (align_stdout(stdout), e)) |
705 except subprocess.CalledProcessError, e: | 705 except subprocess.CalledProcessError, e: |
706 raise PatchApplicationFailed( | 706 raise PatchApplicationFailed( |
707 p, | 707 p, |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 def revisions(self, rev1, rev2): | 837 def revisions(self, rev1, rev2): |
838 return self.checkout.revisions(rev1, rev2) | 838 return self.checkout.revisions(rev1, rev2) |
839 | 839 |
840 @property | 840 @property |
841 def project_name(self): | 841 def project_name(self): |
842 return self.checkout.project_name | 842 return self.checkout.project_name |
843 | 843 |
844 @property | 844 @property |
845 def project_path(self): | 845 def project_path(self): |
846 return self.checkout.project_path | 846 return self.checkout.project_path |
OLD | NEW |