summaryrefslogtreecommitdiff
path: root/morphlib/buildbranch.py
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2014-10-27 13:17:58 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2014-10-27 13:17:58 +0000
commit5e823a4f36f30c59a473f22f824dfd6f6c66c89f (patch)
tree4a0774f36f9034d8d3a1d7f4d010fad7a80f2cd8 /morphlib/buildbranch.py
parent1d6451363c92ec5466b01b5ba2fd327066343ab4 (diff)
parentc255fc68775fe4c5975155c2932b3ed6ee3625c1 (diff)
downloadmorph-5e823a4f36f30c59a473f22f824dfd6f6c66c89f.tar.gz
Merge branch 'sam/build-fix-2'
Reviewed-By: Richard Ipsum <richard.ipsum@codethink.co.uk> Reviewed-By: Richard Maw <richard.maw@codethink.co.uk> Reviewed-By: Daniel Silverstone <daniel.silverstone@codethink.co.uk>
Diffstat (limited to 'morphlib/buildbranch.py')
-rw-r--r--morphlib/buildbranch.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/morphlib/buildbranch.py b/morphlib/buildbranch.py
index 638350e3..cfc4a67f 100644
--- a/morphlib/buildbranch.py
+++ b/morphlib/buildbranch.py
@@ -254,6 +254,10 @@ class BuildBranch(object):
return self._sb.get_config('branch.name')
@property
+ def root_commit(self):
+ return self._root.resolve_ref_to_commit(self.root_ref)
+
+ @property
def root_local_repo_url(self):
return urlparse.urljoin('file://', self._root.dirname)
@@ -291,7 +295,13 @@ def pushed_build_branch(bb, loader, changes_need_pushing, name, email,
unpushed = any(bb.get_unpushed_branches())
if not changes_made and not unpushed:
- yield bb.root_repo_url, bb.root_ref
+ # We resolve the system branch ref to the commit SHA1 here, so that
+ # the build uses whatever commit the user's copy of the root repo
+ # considers the head of that branch to be. If we returned a named
+ # ref, we risk building what the remote considers the head of that
+ # branch to be instead, and we also trigger a needless update in
+ # the cached copy of the root repo.
+ yield bb.root_repo_url, bb.root_commit, bb.root_ref
return
def report_inject(gd):
@@ -318,6 +328,6 @@ def pushed_build_branch(bb, loader, changes_need_pushing, name, email,
remote=remote.get_push_url(), chatty=True)
bb.push_build_branches(push_cb=report_push)
- yield bb.root_repo_url, bb.root_build_ref
+ yield bb.root_repo_url, bb.root_build_ref, bb.root_build_ref
else:
- yield bb.root_local_repo_url, bb.root_build_ref
+ yield bb.root_local_repo_url, bb.root_build_ref, bb.root_build_ref