OLD | NEW |
1 # Copyright 2016 The LUCI Authors. All rights reserved. | 1 # Copyright 2016 The LUCI Authors. All rights reserved. |
2 # Use of this source code is governed under the Apache License, Version 2.0 | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
3 # that can be found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
4 | 4 |
5 import calendar | 5 import calendar |
6 import httplib | 6 import httplib |
7 import json | 7 import json |
8 import logging | 8 import logging |
9 import os | 9 import os |
10 import re | 10 import re |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 ] + list(args) | 251 ] + list(args) |
252 | 252 |
253 try: | 253 try: |
254 return self._execute(*cmd) | 254 return self._execute(*cmd) |
255 except subprocess42.CalledProcessError as e: | 255 except subprocess42.CalledProcessError as e: |
256 subcommand = (args[0]) if args else ('') | 256 subcommand = (args[0]) if args else ('') |
257 raise GitError('Git "%s" failed: %s' % (subcommand, e.message,)) | 257 raise GitError('Git "%s" failed: %s' % (subcommand, e.message,)) |
258 | 258 |
259 def _execute(self, *args): | 259 def _execute(self, *args): |
260 """Runs a raw command. Separate so it's easily mockable.""" | 260 """Runs a raw command. Separate so it's easily mockable.""" |
261 LOGGER.debug('Running: %s', args) | 261 LOGGER.info('Running: %s', args) |
262 return subprocess42.check_output(args) | 262 return subprocess42.check_output(args) |
263 | 263 |
264 def _ensure_local_repo_exists(self): | 264 def _ensure_local_repo_exists(self): |
265 """Ensures that self.checkout_dir is a valid git repository. Safe to call | 265 """Ensures that self.checkout_dir is a valid git repository. Safe to call |
266 multiple times. If this is sucessful, the GitBackend will not try to | 266 multiple times. If this is sucessful, the GitBackend will not try to |
267 re-initialize the checkout_dir again. | 267 re-initialize the checkout_dir again. |
268 | 268 |
269 Raises GitError if it detected that checkout_dir is likely not a valid git | 269 Raises GitError if it detected that checkout_dir is likely not a valid git |
270 repo. | 270 repo. |
271 """ | 271 """ |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 ).text.decode('base64') | 570 ).text.decode('base64') |
571 spec = json_format.Parse( | 571 spec = json_format.Parse( |
572 recipes_cfg_text, package_pb2.Package(), ignore_unknown_fields=True) | 572 recipes_cfg_text, package_pb2.Package(), ignore_unknown_fields=True) |
573 | 573 |
574 return CommitMetadata( | 574 return CommitMetadata( |
575 revision, | 575 revision, |
576 rev_json.author_email, | 576 rev_json.author_email, |
577 rev_json.commit_timestamp, | 577 rev_json.commit_timestamp, |
578 rev_json.message_lines, | 578 rev_json.message_lines, |
579 spec) | 579 spec) |
OLD | NEW |