OLD | NEW |
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Gclient-specific SCM-specific operations.""" | 5 """Gclient-specific SCM-specific operations.""" |
6 | 6 |
7 import logging | 7 import logging |
8 import os | 8 import os |
9 import posixpath | 9 import posixpath |
10 import re | 10 import re |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 | 658 |
659 def _GetCurrentBranch(self): | 659 def _GetCurrentBranch(self): |
660 # Returns name of current branch or None for detached HEAD | 660 # Returns name of current branch or None for detached HEAD |
661 branch = self._Capture(['rev-parse', '--abbrev-ref=strict', 'HEAD']) | 661 branch = self._Capture(['rev-parse', '--abbrev-ref=strict', 'HEAD']) |
662 if branch == 'HEAD': | 662 if branch == 'HEAD': |
663 return None | 663 return None |
664 return branch | 664 return branch |
665 | 665 |
666 def _Capture(self, args): | 666 def _Capture(self, args): |
667 return subprocess2.check_output( | 667 return subprocess2.check_output( |
668 ['git'] + args, cwd=self.checkout_path).strip() | 668 ['git'] + args, |
| 669 stderr=subprocess2.PIPE, |
| 670 cwd=self.checkout_path).strip() |
669 | 671 |
670 def _Run(self, args, options, **kwargs): | 672 def _Run(self, args, options, **kwargs): |
671 kwargs.setdefault('cwd', self.checkout_path) | 673 kwargs.setdefault('cwd', self.checkout_path) |
672 gclient_utils.CheckCallAndFilterAndHeader(['git'] + args, | 674 gclient_utils.CheckCallAndFilterAndHeader(['git'] + args, |
673 always=options.verbose, **kwargs) | 675 always=options.verbose, **kwargs) |
674 | 676 |
675 | 677 |
676 class SVNWrapper(SCMWrapper): | 678 class SVNWrapper(SCMWrapper): |
677 """ Wrapper for SVN """ | 679 """ Wrapper for SVN """ |
678 | 680 |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
938 | 940 |
939 This method returns a new list to be used as a command.""" | 941 This method returns a new list to be used as a command.""" |
940 new_command = command[:] | 942 new_command = command[:] |
941 if revision: | 943 if revision: |
942 new_command.extend(['--revision', str(revision).strip()]) | 944 new_command.extend(['--revision', str(revision).strip()]) |
943 # --force was added to 'svn update' in svn 1.5. | 945 # --force was added to 'svn update' in svn 1.5. |
944 if ((options.force or options.manually_grab_svn_rev) and | 946 if ((options.force or options.manually_grab_svn_rev) and |
945 scm.SVN.AssertVersion("1.5")[0]): | 947 scm.SVN.AssertVersion("1.5")[0]): |
946 new_command.append('--force') | 948 new_command.append('--force') |
947 return new_command | 949 return new_command |
OLD | NEW |