You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 9, 2020. It is now read-only.
Interpret strings as branches > semver constraints
When a user supplied string in an imported config file, or specified to
dep ensure, can be interpreted multiple ways, prefer the branch over a
semver constraint.
In #710, glide.yaml specified v2 for https://github.com/go-mgo/mgo.
When we assume that is a semver constraint, solve fails because the
hinted revision in the lock (a commit on the v2 branch) doesn't satisfy
the assumed constraint of ^2.0.0.
The new preferred match order for the user string is:
* revision
* branch
* semver constraint
* tag
I am giving preference of a semver constraint over a tag so that a bare
version, 1.0.0, is interpreted more loosely with an implied caret,
^1.0.0, instead of the stricter exact match.
// Warn about the problem, it is not enough to warrant failing
226
-
warn:=errors.Wrapf(err, "Unable to lookup the version represented by %s in %s(%s). Falling back to locking the revision only.", revision, pi.ProjectRoot, pi.Source)
funclookupVersionForRevision(rev gps.Revision, pi gps.ProjectIdentifier, sm gps.SourceManager) (gps.Version, error) {
149
+
// lookupVersionForLockedProject figures out the appropriate version for a locked
150
+
// project based on the locked revision and the constraint from the manifest.
151
+
// First try matching the revision to a version, then try the constraint from the
152
+
// manifest, then finally the revision.
153
+
funclookupVersionForLockedProject(pi gps.ProjectIdentifier, c gps.Constraint, rev gps.Revision, sm gps.SourceManager) (version gps.Version, warningerror) {
150
154
// Find the version that goes with this revision, if any
151
155
versions, err:=sm.ListVersions(pi)
152
156
iferr!=nil {
153
-
returnnil, errors.Wrapf(err, "Unable to list versions for %s(%s)", pi.ProjectRoot, pi.Source)
157
+
warning=errors.Wrapf(err, "Unable to lookup the version represented by %s in %s(%s). Falling back to locking the revision only.", rev, pi.ProjectRoot, pi.Source)
158
+
return
154
159
}
155
160
156
161
gps.SortPairedForUpgrade(versions) // Sort versions in asc order
157
162
for_, v:=rangeversions {
158
163
ifv.Underlying() ==rev {
159
-
returnv, nil
164
+
version=v
165
+
return
160
166
}
161
167
}
162
168
163
-
returnrev, nil
169
+
// Use the version from the manifest as long as it wasn't a range
0 commit comments