diff options
author | Alexander Kanavin <alex.kanavin@gmail.com> | 2022-02-21 10:28:12 +0100 |
---|---|---|
committer | Anuj Mittal <anuj.mittal@intel.com> | 2022-03-07 10:48:35 +0800 |
commit | e2f27f05018a7f7882166b1b82ffd4b443ca9dc0 (patch) | |
tree | e42d02f097e502d51de81ce98d2c88a04d9a198c /scripts | |
parent | 6bec1320e20c4e996ec068c99be2e4273b2df899 (diff) | |
download | openembedded-core-e2f27f05018a7f7882166b1b82ffd4b443ca9dc0.tar.gz |
devtool: explicitly set main or master branches in upgrades when available
In particular this resolves devtool's inability to pick a branch
when the same tagged commit is avaiable in main and in a release maintenance
branch.
Thanks to Peter Kjellerstedt for the suggestion.
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit bcb21ee2760a2c76039412a56c6cda43fbf96fd0)
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/devtool/upgrade.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py index 826a3f955f..0357ec07bf 100644 --- a/scripts/lib/devtool/upgrade.py +++ b/scripts/lib/devtool/upgrade.py @@ -192,14 +192,15 @@ def _extract_new_source(newpv, srctree, no_patch, srcrev, srcbranch, branch, kee get_branch = [x.strip() for x in check_branch.splitlines()] # Remove HEAD reference point and drop remote prefix get_branch = [x.split('/', 1)[1] for x in get_branch if not x.startswith('origin/HEAD')] - if 'master' in get_branch: - # If it is master, we do not need to append 'branch=master' as this is default. - # Even with the case where get_branch has multiple objects, if 'master' is one - # of them, we should default take from 'master' - srcbranch = '' - elif len(get_branch) == 1: - # If 'master' isn't in get_branch and get_branch contains only ONE object, then store result into 'srcbranch' + if len(get_branch) == 1: + # If srcrev is on only ONE branch, then use that branch srcbranch = get_branch[0] + elif 'main' in get_branch: + # If srcrev is on multiple branches, then choose 'main' if it is one of them + srcbranch = 'main' + elif 'master' in get_branch: + # Otherwise choose 'master' if it is one of the branches + srcbranch = 'master' else: # If get_branch contains more than one objects, then display error and exit. mbrch = '\n ' + '\n '.join(get_branch) |