path: root/scripts
diff options
authorPatrick Ohly <>2015-05-08 14:37:30 +0200
committerRichard Purdie <>2015-05-29 13:01:36 +0100
commite9ae2f8417d65eb3bce3f5811d3e017c3d0596b3 (patch)
tree9c7134dea7d9b29c0f10ccb8b8810a698858220a /scripts
parent12cc076832130f9b3a2658bc92458624d2924742 (diff)
combo-layer: improve merge commit handling
When the head of a branch is a merge commit, combo-layer did not record that commit as last_revision because it only considers applied patches, and the merge commit never gets applied. This causes problems when the merge commit leads to multiple patches and the commit id that gets recorded only reaches some of these patches. The next run then will try to re-apply the other patches. This special case is now detected and dealt with by bumping last_revision to the branch commit. The behavior where the head is a normal commit is intentionally not changed, because some users might prefer the traditional behavior. (From OE-Core rev: 701bcd52c208f22a9a6c48a11a35bcf1c4e413df) (From OE-Core rev: 1bc46199e569411150b050818ff17abc66f899f2) Signed-off-by: Patrick Ohly <> Signed-off-by: Richard Purdie <>
Diffstat (limited to 'scripts')
1 files changed, 24 insertions, 3 deletions
diff --git a/scripts/combo-layer b/scripts/combo-layer
index 5d61fb1..b0b7c28 100755
--- a/scripts/combo-layer
+++ b/scripts/combo-layer
@@ -731,6 +731,10 @@ def apply_patchlist(conf, repos):
if line:
+ ldir = conf.repos[name]['local_repo_dir']
+ branch = conf.repos[name].get('branch', "master")
+ branchrev = runcmd("git rev-parse %s" % branch, ldir).strip()
if patchlist:"Applying patches from %s..." % name)
linecount = len(patchlist)
@@ -758,11 +762,28 @@ def apply_patchlist(conf, repos):
prevrev = lastrev
i += 1
+ # Once all patches are applied, we should update
+ # last_revision to the branch head instead of the last
+ # applied patch. The two are not necessarily the same when
+ # the last commit is a merge commit or when the patches at
+ # the branch head were intentionally excluded.
+ #
+ # If we do not do that for a merge commit, the next
+ # combo-layer run will only exclude patches reachable from
+ # one of the merged branches and try to re-apply patches
+ # from other branches even though they were already
+ # copied.
+ #
+ # If patches were intentionally excluded, the next run will
+ # present them again instead of skipping over them. This
+ # may or may not be intended, so the code here is conservative
+ # and only addresses the "head is merge commit" case.
+ if lastrev != branchrev and \
+ len(runcmd("git show --pretty=format:%%P --no-patch %s" % branch, ldir).split()) > 1:
+ lastrev = branchrev
else:"No patches to apply from %s" % name)
- ldir = conf.repos[name]['local_repo_dir']
- branch = conf.repos[name].get('branch', "master")
- lastrev = runcmd("git rev-parse %s" % branch, ldir).strip()
+ lastrev = branchrev
if lastrev != repo['last_revision']:
conf.update(name, "last_revision", lastrev)
OpenPOWER on IntegriCloud