ccollins476ad commented on a change in pull request #340: newt upgrade: Fix
Repo Commit Checkout
URL: https://github.com/apache/mynewt-newt/pull/340#discussion_r334289766
##########
File path: newt/install/install.go
##########
@@ -647,17 +647,29 @@ func (inst *Installer) calcVersionMap(candidates
[]*repo.Repo) (
}
// If project.yml specified any specific git commits, ensure we get
them.
+ rg := dg.Reverse()
for name, ver := range vm {
- reqs := inst.reqs[name]
- if len(reqs) > 0 {
- keep, err := inst.shouldKeepCommit(name,
reqs[0].Ver.Commit)
- if err != nil {
- return nil, err
- }
- if keep {
- ver.Commit = reqs[0].Ver.Commit
+ for _, node := range rg[name] {
+ if len(node.VerReqs) > 0 {
+ // look at all elements of VerReqs array
+ for _, vreq := range node.VerReqs {
+ if vreq.Ver.Commit != "" {
+ keep, err :=
inst.shouldKeepCommit(name, vreq.Ver.Commit)
+ if err != nil {
+ return nil, err
+ }
+ if keep {
+ if ver.Commit == "" {
+ ver.Commit =
vreq.Ver.Commit
+ } else {
+ return nil,
util.FmtNewtError("multiple commits %s and %s",
Review comment:
It would probably be good to include the repo name in the error message
(`name`).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services