diff options
Diffstat (limited to 'scripts/combo-layer')
| -rwxr-xr-x | scripts/combo-layer | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/scripts/combo-layer b/scripts/combo-layer index 5d61fb1c16..b0b7c28bea 100755 --- a/scripts/combo-layer +++ b/scripts/combo-layer | |||
| @@ -731,6 +731,10 @@ def apply_patchlist(conf, repos): | |||
| 731 | if line: | 731 | if line: |
| 732 | patchlist.append(line) | 732 | patchlist.append(line) |
| 733 | 733 | ||
| 734 | ldir = conf.repos[name]['local_repo_dir'] | ||
| 735 | branch = conf.repos[name].get('branch', "master") | ||
| 736 | branchrev = runcmd("git rev-parse %s" % branch, ldir).strip() | ||
| 737 | |||
| 734 | if patchlist: | 738 | if patchlist: |
| 735 | logger.info("Applying patches from %s..." % name) | 739 | logger.info("Applying patches from %s..." % name) |
| 736 | linecount = len(patchlist) | 740 | linecount = len(patchlist) |
| @@ -758,11 +762,28 @@ def apply_patchlist(conf, repos): | |||
| 758 | sys.exit(0) | 762 | sys.exit(0) |
| 759 | prevrev = lastrev | 763 | prevrev = lastrev |
| 760 | i += 1 | 764 | i += 1 |
| 765 | # Once all patches are applied, we should update | ||
| 766 | # last_revision to the branch head instead of the last | ||
| 767 | # applied patch. The two are not necessarily the same when | ||
| 768 | # the last commit is a merge commit or when the patches at | ||
| 769 | # the branch head were intentionally excluded. | ||
| 770 | # | ||
| 771 | # If we do not do that for a merge commit, the next | ||
| 772 | # combo-layer run will only exclude patches reachable from | ||
| 773 | # one of the merged branches and try to re-apply patches | ||
| 774 | # from other branches even though they were already | ||
| 775 | # copied. | ||
| 776 | # | ||
| 777 | # If patches were intentionally excluded, the next run will | ||
| 778 | # present them again instead of skipping over them. This | ||
| 779 | # may or may not be intended, so the code here is conservative | ||
| 780 | # and only addresses the "head is merge commit" case. | ||
| 781 | if lastrev != branchrev and \ | ||
| 782 | len(runcmd("git show --pretty=format:%%P --no-patch %s" % branch, ldir).split()) > 1: | ||
| 783 | lastrev = branchrev | ||
| 761 | else: | 784 | else: |
| 762 | logger.info("No patches to apply from %s" % name) | 785 | logger.info("No patches to apply from %s" % name) |
| 763 | ldir = conf.repos[name]['local_repo_dir'] | 786 | lastrev = branchrev |
| 764 | branch = conf.repos[name].get('branch', "master") | ||
| 765 | lastrev = runcmd("git rev-parse %s" % branch, ldir).strip() | ||
| 766 | 787 | ||
| 767 | if lastrev != repo['last_revision']: | 788 | if lastrev != repo['last_revision']: |
| 768 | conf.update(name, "last_revision", lastrev) | 789 | conf.update(name, "last_revision", lastrev) |
