| 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 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 # Throw away all uncommitted changes in the existing checkout. | 587 # Throw away all uncommitted changes in the existing checkout. |
| 588 self._check_call_git(['checkout', self.remote_branch]) | 588 self._check_call_git(['checkout', self.remote_branch]) |
| 589 self._check_call_git( | 589 self._check_call_git( |
| 590 ['reset', '--hard', '--quiet', | 590 ['reset', '--hard', '--quiet', |
| 591 '%s/%s' % (self.remote, self.remote_branch)]) | 591 '%s/%s' % (self.remote, self.remote_branch)]) |
| 592 | 592 |
| 593 if revision: | 593 if revision: |
| 594 try: | 594 try: |
| 595 # Look if the commit hash already exist. If so, we can skip a | 595 # Look if the commit hash already exist. If so, we can skip a |
| 596 # 'git fetch' call. | 596 # 'git fetch' call. |
| 597 revision = self._check_output_git(['rev-parse', revision]) | 597 revision = self._check_output_git(['rev-parse', revision]).rstrip() |
| 598 except subprocess.CalledProcessError: | 598 except subprocess.CalledProcessError: |
| 599 self._check_call_git( | 599 self._check_call_git( |
| 600 ['fetch', self.remote, self.remote_branch, '--quiet']) | 600 ['fetch', self.remote, self.remote_branch, '--quiet']) |
| 601 revision = self._check_output_git(['rev-parse', revision]) | 601 revision = self._check_output_git(['rev-parse', revision]).rstrip() |
| 602 self._check_call_git(['checkout', '--force', '--quiet', revision]) | 602 self._check_call_git(['checkout', '--force', '--quiet', revision]) |
| 603 else: | 603 else: |
| 604 branches, active = self._branches() | 604 branches, active = self._branches() |
| 605 if active != self.master_branch: | 605 if active != self.master_branch: |
| 606 self._check_call_git( | 606 self._check_call_git( |
| 607 ['checkout', '--force', '--quiet', self.master_branch]) | 607 ['checkout', '--force', '--quiet', self.master_branch]) |
| 608 self._sync_remote_branch() | 608 self._sync_remote_branch() |
| 609 | 609 |
| 610 if self.working_branch in branches: | 610 if self.working_branch in branches: |
| 611 self._call_git(['branch', '-D', self.working_branch]) | 611 self._call_git(['branch', '-D', self.working_branch]) |
| (...skipping 217 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 |