Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

Commit 7ed3aa2

Browse files
committed
status: LATEST should be of the same type as VERSION
This change modifies the LATEST field in status from always being a revision to the same type as of the VERSION field. If VERSION is a semver version, the LATEST would have the latest semver version of the project constrained by the effective constraint. If VERSION is a branch version, the LATEST would have the latest revision of that branch.
1 parent 137e77d commit 7ed3aa2

File tree

6 files changed

+17
-11
lines changed

6 files changed

+17
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ IMPROVEMENTS:
2828
* Skip empty constraints during import ([#1414](https://github.com/golang/dep/pull/1349))
2929
* Handle errors when writing status output ([#1420](https://github.com/golang/dep/pull/1420))
3030
* Add constraint for locked projects in `status`. (#962)
31+
* Show LATEST and VERSION as the same type in status. (#1515)
3132

3233
# v0.3.2
3334

cmd/dep/status.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,12 @@ func runStatusAll(ctx *dep.Ctx, out outputter, p *dep.Project, sm gps.SourceMana
570570
// upgrade, the first version we encounter that
571571
// matches our constraint will be what we want.
572572
if c.Constraint.Matches(v) {
573-
bs.Latest = v.Revision()
573+
// Latest should be of the same type as the Version.
574+
if bs.Version.Type() == gps.IsSemver {
575+
bs.Latest = v
576+
} else {
577+
bs.Latest = v.Revision()
578+
}
574579
break
575580
}
576581
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[{"ProjectRoot":"github.com/sdboyer/deptest","Constraint":"^0.8.0","Version":"v0.8.0","Revision":"ff2948a2ac8f538c4ecd55962e919d1e13e74baf","Latest":"3f4c3bea144e112a69bbe5d8d01c1b09a544253f","PackageCount":1},{"ProjectRoot":"github.com/sdboyer/deptestdos","Constraint":"v2.0.0","Version":"v2.0.0","Revision":"5c607206be5decd28e6263ffffdcee067266015e","Latest":"5c607206be5decd28e6263ffffdcee067266015e","PackageCount":1}]
1+
[{"ProjectRoot":"github.com/sdboyer/deptest","Constraint":"^0.8.0","Version":"v0.8.0","Revision":"ff2948a2ac8f538c4ecd55962e919d1e13e74baf","Latest":"v0.8.1","PackageCount":1},{"ProjectRoot":"github.com/sdboyer/deptestdos","Constraint":"v2.0.0","Version":"v2.0.0","Revision":"5c607206be5decd28e6263ffffdcee067266015e","Latest":"v2.0.0","PackageCount":1}]
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
PROJECT CONSTRAINT VERSION REVISION LATEST PKGS USED
2-
github.com/sdboyer/deptest ^0.8.0 v0.8.0 ff2948a 3f4c3be 1
3-
github.com/sdboyer/deptestdos v2.0.0 v2.0.0 5c60720 5c60720 1
1+
PROJECT CONSTRAINT VERSION REVISION LATEST PKGS USED
2+
github.com/sdboyer/deptest ^0.8.0 v0.8.0 ff2948a v0.8.1 1
3+
github.com/sdboyer/deptestdos v2.0.0 v2.0.0 5c60720 v2.0.0 1
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
PROJECT CONSTRAINT VERSION REVISION LATEST PKGS USED
2-
github.com/sdboyer/deptest v0.8.1 (override) v0.8.1 3f4c3be 3f4c3be 1
3-
github.com/sdboyer/deptestdos v2.0.0 v2.0.0 5c60720 5c60720 1
1+
PROJECT CONSTRAINT VERSION REVISION LATEST PKGS USED
2+
github.com/sdboyer/deptest v0.8.1 (override) v0.8.1 3f4c3be v0.8.1 1
3+
github.com/sdboyer/deptestdos v2.0.0 v2.0.0 5c60720 v2.0.0 1
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
PROJECT CONSTRAINT VERSION REVISION LATEST PKGS USED
2-
github.com/sdboyer/deptest v1.0.0 v1.0.0 ff2948a ff2948a 1
3-
github.com/sdboyer/deptestdos a0196ba a0196ba 1
1+
PROJECT CONSTRAINT VERSION REVISION LATEST PKGS USED
2+
github.com/sdboyer/deptest v1.0.0 v1.0.0 ff2948a v1.0.0 1
3+
github.com/sdboyer/deptestdos a0196ba a0196ba 1

0 commit comments

Comments
 (0)