diff options
Diffstat (limited to 'scripts/lib/devtool/upgrade.py')
-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 | |||
192 | get_branch = [x.strip() for x in check_branch.splitlines()] | 192 | get_branch = [x.strip() for x in check_branch.splitlines()] |
193 | # Remove HEAD reference point and drop remote prefix | 193 | # Remove HEAD reference point and drop remote prefix |
194 | get_branch = [x.split('/', 1)[1] for x in get_branch if not x.startswith('origin/HEAD')] | 194 | get_branch = [x.split('/', 1)[1] for x in get_branch if not x.startswith('origin/HEAD')] |
195 | if 'master' in get_branch: | 195 | if len(get_branch) == 1: |
196 | # If it is master, we do not need to append 'branch=master' as this is default. | 196 | # If srcrev is on only ONE branch, then use that branch |
197 | # Even with the case where get_branch has multiple objects, if 'master' is one | ||
198 | # of them, we should default take from 'master' | ||
199 | srcbranch = '' | ||
200 | elif len(get_branch) == 1: | ||
201 | # If 'master' isn't in get_branch and get_branch contains only ONE object, then store result into 'srcbranch' | ||
202 | srcbranch = get_branch[0] | 197 | srcbranch = get_branch[0] |
198 | elif 'main' in get_branch: | ||
199 | # If srcrev is on multiple branches, then choose 'main' if it is one of them | ||
200 | srcbranch = 'main' | ||
201 | elif 'master' in get_branch: | ||
202 | # Otherwise choose 'master' if it is one of the branches | ||
203 | srcbranch = 'master' | ||
203 | else: | 204 | else: |
204 | # If get_branch contains more than one objects, then display error and exit. | 205 | # If get_branch contains more than one objects, then display error and exit. |
205 | mbrch = '\n ' + '\n '.join(get_branch) | 206 | mbrch = '\n ' + '\n '.join(get_branch) |