| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 import ast | 5 import ast |
| 6 import collections | 6 import collections |
| 7 import contextlib | 7 import contextlib |
| 8 import copy | 8 import copy |
| 9 import functools | 9 import functools |
| 10 import itertools | 10 import itertools |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 self.path = path | 192 self.path = path |
| 193 | 193 |
| 194 def __str__(self): | 194 def __str__(self): |
| 195 return ('GitRepoSpec{project_id="%(project_id)s", repo="%(repo)s", ' | 195 return ('GitRepoSpec{project_id="%(project_id)s", repo="%(repo)s", ' |
| 196 'branch="%(branch)s", revision="%(revision)s", ' | 196 'branch="%(branch)s", revision="%(revision)s", ' |
| 197 'path="%(path)s"}' % self.__dict__) | 197 'path="%(path)s"}' % self.__dict__) |
| 198 | 198 |
| 199 def run_git(self, context, *args): | 199 def run_git(self, context, *args): |
| 200 cmd = [self._git] | 200 cmd = [self._git] |
| 201 if context is not None: | 201 if context is not None: |
| 202 cmd += ['--git-dir', os.path.join(self._dep_dir(context), '.git')] | 202 cmd += ['-C', self._dep_dir(context)] |
| 203 cmd += list(args) | 203 cmd += list(args) |
| 204 | 204 |
| 205 logging.info('Running: %s', cmd) | 205 logging.info('Running: %s', cmd) |
| 206 return subprocess.check_output(cmd) | 206 return subprocess.check_output(cmd) |
| 207 | 207 |
| 208 def checkout(self, context): | 208 def checkout(self, context): |
| 209 dep_dir = self._dep_dir(context) | 209 dep_dir = self._dep_dir(context) |
| 210 logging.info('Freshening repository %s', dep_dir) | 210 logging.info('Freshening repository %s', dep_dir) |
| 211 | 211 |
| 212 if not os.path.isdir(dep_dir): | 212 if not os.path.isdir(dep_dir): |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 >>> d = { 'x': 1, 'y': 2 } | 725 >>> d = { 'x': 1, 'y': 2 } |
| 726 >>> sorted(_updated(d, { 'y': 3, 'z': 4 }).items()) | 726 >>> sorted(_updated(d, { 'y': 3, 'z': 4 }).items()) |
| 727 [('x', 1), ('y', 3), ('z', 4)] | 727 [('x', 1), ('y', 3), ('z', 4)] |
| 728 >>> sorted(d.items()) | 728 >>> sorted(d.items()) |
| 729 [('x', 1), ('y', 2)] | 729 [('x', 1), ('y', 2)] |
| 730 """ | 730 """ |
| 731 | 731 |
| 732 d = copy.copy(d) | 732 d = copy.copy(d) |
| 733 d.update(updates) | 733 d.update(updates) |
| 734 return d | 734 return d |
| OLD | NEW |