If devtool add is run on a git URL and a revision is specified that is not on master, and branch= isn't already in the URL, then get the correct branch and add it to the URL. If the revision isn't on a branch, and it's not already there, add nobranch=1 to the URL.
Paul, certain repository has same source revision on multiple branches. How do we handle this kind of situation? It is not possible for devtool to get the correct branch in this situation. So, do we print out the branch that having the source revision and error out?
That's a good point. If the revision is on multiple branches, and we've already checked that one of them isn't master, then yes I don't think we have much choice but to error out telling the user they need to select one.
Submitted fix to mailing list. http://lists.openembedded.org/pipermail/openembedded-core/2017-July/139574.html
Patches are now staging at mut branch. Moving this to M3 as it has already overdue for M2.
v2 patch series fixed comment from Chris: http://lists.openembedded.org/pipermail/openembedded-core/2017-August/140860.html
OE-Core rev: ecca596b75cfda2f798a0bdde75f4f774e23a95b
Verification logs: a) Checkout to origin/master branch to get the fixes. b) Scenario1: When Revision is not on master- Perform devtool add bbexample-custom 'https://github.com/epyeoh/bbexample.git;rev=f26a5d9e53524edc72b9f476a628c35eb82e497b' c) Verify that the correct branch is added to the SRC_URI: SRC_URI = "git://github.com/epyeoh/bbexample.git;protocol=https;branch=dev1" d) Scenario2: If the revision is on multiple branches, and none of them is master: Perform devtool add bbexample 'https://github.com/epyeoh/bbexample.git;rev=a1e995ea27eb2e800cee1fc7b37672116aee2305' e) Verify the error for multiple branch of same revision: ERROR: Revision a1e995ea27eb2e800cee1fc7b37672116aee2305 was found on multiple branches: dev2 dev3 Please provide the correct branch with -B/--srcbranch ERROR: Command 'script -e -q -c "recipetool --color=always create --devtool -o /tmp/devtoolvnmzcrd_ 'https://github.com/epyeoh/bbexample.git;rev=a1e995ea27eb2e800cee1fc7b37672116aee2305' -x /workdir/build/workspace/sources/devtoolsrcqsb05ogk -N bbexample" /dev/null' failed f) Scenario3: If the revision is on multiple branch and branch is specified: Perform devtool add bbexample 'https://github.com/epyeoh/bbexample.git;rev=a1e995ea27eb2e800cee1fc7b37672116aee2305;branch=dev3' g) Verify that the correct branch is added to the SRC_URI: SRC_URI = "git://github.com/epyeoh/bbexample.git;branch=dev3;protocol=https" h) Scenario4: If the revision is on multiple branch and one of them is master: Perform devtool add bbexample 'https://github.com/shashwatpandey221091/bbexample.git;rev=60cca6f8fe6b74a9fa2f670fcb885be2d3f9bcb9' i) Verify that devtool should create the recipe without error and expected SRC_URI is : SRC_URI = “https://github.com/repo.git” without “branch=“: SRC_URI = "git://github.com/shashwatpandey221091/bbexample.git;protocol=https"