summaryrefslogtreecommitdiff
path: root/morphlib/buildcommand.py
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2015-03-03 10:16:55 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2015-03-03 10:16:55 +0000
commita2645411b875a5faae17489c5b4bb11670b36259 (patch)
tree806737561f1a1c8c4cd7b1aeb83b48acc6f66d23 /morphlib/buildcommand.py
parentd296e539348a568ef4562bcbd3be5952b9355b26 (diff)
parent0855c357e74e6dd7aa7921d863e6144b89fc662b (diff)
downloadmorph-a2645411b875a5faae17489c5b4bb11670b36259.tar.gz
Merge branch 'sam/fewer-submodule-updates'
Reviewed-By: Javier Jardón <javier.jardon@codethink.co.uk> Reviewed-By: Richard Maw <richard.maw@codethink.co.uk>
Diffstat (limited to 'morphlib/buildcommand.py')
-rw-r--r--morphlib/buildcommand.py35
1 files changed, 2 insertions, 33 deletions
diff --git a/morphlib/buildcommand.py b/morphlib/buildcommand.py
index 0aa50a3b..8572450d 100644
--- a/morphlib/buildcommand.py
+++ b/morphlib/buildcommand.py
@@ -387,39 +387,8 @@ class BuildCommand(object):
'''Update the local git repository cache with the sources.'''
repo_name = source.repo_name
- if self.app.settings['no-git-update']:
- self.app.status(msg='Not updating existing git repository '
- '%(repo_name)s '
- 'because of no-git-update being set',
- chatty=True,
- repo_name=repo_name)
- source.repo = self.lrc.get_repo(repo_name)
- return
-
- if self.lrc.has_repo(repo_name):
- source.repo = self.lrc.get_repo(repo_name)
- try:
- sha1 = source.sha1
- source.repo.resolve_ref_to_commit(sha1)
- self.app.status(msg='Not updating git repository '
- '%(repo_name)s because it '
- 'already contains sha1 %(sha1)s',
- chatty=True, repo_name=repo_name,
- sha1=sha1)
- except morphlib.gitdir.InvalidRefError:
- self.app.status(msg='Updating %(repo_name)s',
- repo_name=repo_name)
- source.repo.update()
- else:
- self.app.status(msg='Cloning %(repo_name)s',
- repo_name=repo_name)
- source.repo = self.lrc.cache_repo(repo_name)
-
- # Update submodules.
- done = set()
- self.app.cache_repo_and_submodules(
- self.lrc, source.repo.url,
- source.sha1, done)
+ source.repo = self.lrc.get_updated_repo(repo_name, ref=source.sha1)
+ self.lrc.ensure_submodules(source.repo, source.sha1)
def cache_artifacts_locally(self, artifacts):
'''Get artifacts missing from local cache from remote cache.'''