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 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 # pulling/fetching, so it merges <ref> into the current branch without | 615 # pulling/fetching, so it merges <ref> into the current branch without |
616 # storing the remote branch anywhere locally. | 616 # storing the remote branch anywhere locally. |
617 remote_tracked_path = 'refs/remotes/%s/%s' % ( | 617 remote_tracked_path = 'refs/remotes/%s/%s' % ( |
618 self.remote, self.remote_branch) | 618 self.remote, self.remote_branch) |
619 self._check_call_git( | 619 self._check_call_git( |
620 ['pull', self.remote, | 620 ['pull', self.remote, |
621 '%s:%s' % (self.remote_branch, remote_tracked_path), | 621 '%s:%s' % (self.remote_branch, remote_tracked_path), |
622 '--quiet']) | 622 '--quiet']) |
623 | 623 |
624 def _get_head_commit_hash(self): | 624 def _get_head_commit_hash(self): |
625 """Gets the current revision from the local branch.""" | 625 """Gets the current revision (in unicode) from the local branch.""" |
626 return self._check_output_git(['rev-parse', 'HEAD']).strip() | 626 return unicode(self._check_output_git(['rev-parse', 'HEAD']).strip()) |
627 | 627 |
628 def apply_patch(self, patches, post_processors=None, verbose=False): | 628 def apply_patch(self, patches, post_processors=None, verbose=False): |
629 """Applies a patch on 'working_branch' and switches to it. | 629 """Applies a patch on 'working_branch' and switches to it. |
630 | 630 |
631 Also commits the changes on the local branch. | 631 Also commits the changes on the local branch. |
632 | 632 |
633 Ignores svn properties and raise an exception on unexpected ones. | 633 Ignores svn properties and raise an exception on unexpected ones. |
634 """ | 634 """ |
635 post_processors = post_processors or self.post_processors or [] | 635 post_processors = post_processors or self.post_processors or [] |
636 # It this throws, the checkout is corrupted. Maybe worth deleting it and | 636 # It this throws, the checkout is corrupted. Maybe worth deleting it and |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 def revisions(self, rev1, rev2): | 821 def revisions(self, rev1, rev2): |
822 return self.checkout.revisions(rev1, rev2) | 822 return self.checkout.revisions(rev1, rev2) |
823 | 823 |
824 @property | 824 @property |
825 def project_name(self): | 825 def project_name(self): |
826 return self.checkout.project_name | 826 return self.checkout.project_name |
827 | 827 |
828 @property | 828 @property |
829 def project_path(self): | 829 def project_path(self): |
830 return self.checkout.project_path | 830 return self.checkout.project_path |
OLD | NEW |