OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 from __future__ import print_function | 7 from __future__ import print_function |
8 | 8 |
9 import errno | 9 import errno |
10 import logging | 10 import logging |
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 'refs': [] | 778 'refs': [] |
779 } | 779 } |
780 # TODO(hinoka): This currently just fails because lkcr/lkgr are branches | 780 # TODO(hinoka): This currently just fails because lkcr/lkgr are branches |
781 # not tags. This also adds 20 seconds to every bot_update | 781 # not tags. This also adds 20 seconds to every bot_update |
782 # run, so I'm commenting this out until lkcr/lkgr become | 782 # run, so I'm commenting this out until lkcr/lkgr become |
783 # tags. (2014/4/24) | 783 # tags. (2014/4/24) |
784 # if url == CHROMIUM_SRC_URL or url + '.git' == CHROMIUM_SRC_URL: | 784 # if url == CHROMIUM_SRC_URL or url + '.git' == CHROMIUM_SRC_URL: |
785 # mirror_kwargs['refs'].extend(['refs/tags/lkgr', 'refs/tags/lkcr']) | 785 # mirror_kwargs['refs'].extend(['refs/tags/lkgr', 'refs/tags/lkcr']) |
786 if hasattr(options, 'with_branch_heads') and options.with_branch_heads: | 786 if hasattr(options, 'with_branch_heads') and options.with_branch_heads: |
787 mirror_kwargs['refs'].append('refs/branch-heads/*') | 787 mirror_kwargs['refs'].append('refs/branch-heads/*') |
| 788 if hasattr(options, 'with_tags') and options.with_tags: |
| 789 mirror_kwargs['refs'].append('refs/tags/*') |
788 return git_cache.Mirror(url, **mirror_kwargs) | 790 return git_cache.Mirror(url, **mirror_kwargs) |
789 | 791 |
790 @staticmethod | 792 @staticmethod |
791 def _UpdateMirror(mirror, options): | 793 def _UpdateMirror(mirror, options): |
792 """Update a git mirror by fetching the latest commits from the remote.""" | 794 """Update a git mirror by fetching the latest commits from the remote.""" |
793 if options.shallow: | 795 if options.shallow: |
794 # HACK(hinoka): These repositories should be super shallow. | 796 # HACK(hinoka): These repositories should be super shallow. |
795 if 'flash' in mirror.url: | 797 if 'flash' in mirror.url: |
796 depth = 10 | 798 depth = 10 |
797 else: | 799 else: |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 if options.verbose: | 1070 if options.verbose: |
1069 fetch_cmd.append('--verbose') | 1071 fetch_cmd.append('--verbose') |
1070 elif quiet: | 1072 elif quiet: |
1071 fetch_cmd.append('--quiet') | 1073 fetch_cmd.append('--quiet') |
1072 self._Run(fetch_cmd, options, show_header=options.verbose, retry=True) | 1074 self._Run(fetch_cmd, options, show_header=options.verbose, retry=True) |
1073 | 1075 |
1074 # Return the revision that was fetched; this will be stored in 'FETCH_HEAD' | 1076 # Return the revision that was fetched; this will be stored in 'FETCH_HEAD' |
1075 return self._Capture(['rev-parse', '--verify', 'FETCH_HEAD']) | 1077 return self._Capture(['rev-parse', '--verify', 'FETCH_HEAD']) |
1076 | 1078 |
1077 def _UpdateBranchHeads(self, options, fetch=False): | 1079 def _UpdateBranchHeads(self, options, fetch=False): |
1078 """Adds, and optionally fetches, "branch-heads" refspecs if requested.""" | 1080 """Adds, and optionally fetches, "branch-heads" and "tags" refspecs |
| 1081 if requested.""" |
| 1082 need_fetch = fetch |
1079 if hasattr(options, 'with_branch_heads') and options.with_branch_heads: | 1083 if hasattr(options, 'with_branch_heads') and options.with_branch_heads: |
1080 config_cmd = ['config', 'remote.%s.fetch' % self.remote, | 1084 config_cmd = ['config', 'remote.%s.fetch' % self.remote, |
1081 '+refs/branch-heads/*:refs/remotes/branch-heads/*', | 1085 '+refs/branch-heads/*:refs/remotes/branch-heads/*', |
1082 '^\\+refs/branch-heads/\\*:.*$'] | 1086 '^\\+refs/branch-heads/\\*:.*$'] |
1083 self._Run(config_cmd, options) | 1087 self._Run(config_cmd, options) |
1084 if fetch: | 1088 need_fetch = True |
1085 self._Fetch(options) | 1089 if hasattr(options, 'with_tags') and options.with_tags: |
| 1090 config_cmd = ['config', 'remote.%s.fetch' % self.remote, |
| 1091 '+refs/tags/*:refs/tags/*', |
| 1092 '^\\+refs/tags/\\*:.*$'] |
| 1093 self._Run(config_cmd, options) |
| 1094 need_fetch = True |
| 1095 if fetch and need_fetch: |
| 1096 self._Fetch(options) |
1086 | 1097 |
1087 def _Run(self, args, options, show_header=True, **kwargs): | 1098 def _Run(self, args, options, show_header=True, **kwargs): |
1088 # Disable 'unused options' warning | pylint: disable=W0613 | 1099 # Disable 'unused options' warning | pylint: disable=W0613 |
1089 cwd = kwargs.setdefault('cwd', self.checkout_path) | 1100 cwd = kwargs.setdefault('cwd', self.checkout_path) |
1090 kwargs.setdefault('stdout', self.out_fh) | 1101 kwargs.setdefault('stdout', self.out_fh) |
1091 kwargs['filter_fn'] = self.filter | 1102 kwargs['filter_fn'] = self.filter |
1092 kwargs.setdefault('print_stdout', False) | 1103 kwargs.setdefault('print_stdout', False) |
1093 env = scm.GIT.ApplyEnvVars(kwargs) | 1104 env = scm.GIT.ApplyEnvVars(kwargs) |
1094 cmd = ['git'] + args | 1105 cmd = ['git'] + args |
1095 if show_header: | 1106 if show_header: |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1560 new_command.append('--force') | 1571 new_command.append('--force') |
1561 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1572 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1562 new_command.extend(('--accept', 'theirs-conflict')) | 1573 new_command.extend(('--accept', 'theirs-conflict')) |
1563 elif options.manually_grab_svn_rev: | 1574 elif options.manually_grab_svn_rev: |
1564 new_command.append('--force') | 1575 new_command.append('--force') |
1565 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1576 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1566 new_command.extend(('--accept', 'postpone')) | 1577 new_command.extend(('--accept', 'postpone')) |
1567 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1578 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1568 new_command.extend(('--accept', 'postpone')) | 1579 new_command.extend(('--accept', 'postpone')) |
1569 return new_command | 1580 return new_command |
OLD | NEW |