summaryrefslogtreecommitdiff
path: root/morphlib/app.py
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-07-16 11:00:27 +0100
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-07-16 11:00:27 +0100
commit3015529556362c8bfb47096aacba83d33a49b586 (patch)
treed5b103e2f37fde509feeb7ea4594218210ab5da7 /morphlib/app.py
parente4b1273d3ce11408663876a939c290fb77699d81 (diff)
parent327ef5ad5c1a7e9f8f462ed5d63fd5de2630be03 (diff)
downloadmorph-3015529556362c8bfb47096aacba83d33a49b586.tar.gz
Merge remote branch 'remotes/origin/baserock/bugfix/S3595-morph-updates-gits-too-often-rebase'
Diffstat (limited to 'morphlib/app.py')
-rwxr-xr-xmorphlib/app.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/morphlib/app.py b/morphlib/app.py
index 374b90bb..fadb1c43 100755
--- a/morphlib/app.py
+++ b/morphlib/app.py
@@ -241,7 +241,7 @@ class BuildCommand(object):
repo_name = artifact.source.repo_name
if self.app.settings['no-git-update']:
self.app.status(msg='Not updating existing git repository '
- '%(repo_name)s'
+ '%(repo_name)s '
'because of no-git-update being set',
chatty=True,
repo_name=repo_name)
@@ -249,10 +249,19 @@ class BuildCommand(object):
return
if self.lrc.has_repo(repo_name):
- self.app.status(msg='Updating %(repo_name)s',
- repo_name=repo_name)
artifact.source.repo = self.lrc.get_repo(repo_name)
- artifact.source.repo.update()
+ try:
+ sha1 = artifact.source.sha1
+ artifact.source.repo.resolve_ref(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.cachedrepo.InvalidReferenceError:
+ self.app.status(msg='Updating %(repo_name)s',
+ repo_name=repo_name)
+ artifact.source.repo.update()
else:
self.app.status(msg='Cloning %(repo_name)s',
repo_name=repo_name)