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

Commit f31d439

Browse files
authored
Merge pull request #1421 from otoolec/status-revision-constraint
Fix how dep status print revision constraints
2 parents 3a59b68 + b5e1024 commit f31d439

File tree

9 files changed

+82
-0
lines changed

9 files changed

+82
-0
lines changed

cmd/dep/status.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,9 @@ func runStatusAll(ctx *dep.Ctx, out outputter, p *dep.Project, sm gps.SourceMana
500500
if pp, has := p.Manifest.Ovr[proj.Ident().ProjectRoot]; has && pp.Constraint != nil {
501501
bs.hasOverride = true
502502
bs.Constraint = pp.Constraint
503+
} else if pp, has := p.Manifest.Constraints[proj.Ident().ProjectRoot]; has && pp.Constraint != nil {
504+
// If the manifest has a constraint then set that as the constraint.
505+
bs.Constraint = pp.Constraint
503506
} else {
504507
bs.Constraint = gps.Any()
505508
for _, c := range cm[bs.ProjectRoot] {

cmd/dep/status_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,13 @@ func TestBasicStatusGetConsolidatedConstraint(t *testing.T) {
187187
},
188188
wantConstraint: "1.2.1 (override)",
189189
},
190+
{
191+
name: "BasicStatus with Revision Constraint",
192+
basicStatus: BasicStatus{
193+
Constraint: gps.Revision("ddeb6f5d27091ff291b16232e99076a64fb375b8"),
194+
},
195+
wantConstraint: "ddeb6f5",
196+
},
190197
}
191198

192199
for _, tc := range testCases {

cmd/dep/testdata/harness_tests/status/revision_constraint/final/Gopkg.lock

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[[constraint]]
2+
name = "github.com/sdboyer/deptestdos"
3+
revision = "a0196baa11ea047dd65037287451d36b861b00ea"

cmd/dep/testdata/harness_tests/status/revision_constraint/initial/Gopkg.lock

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[[constraint]]
2+
name = "github.com/sdboyer/deptestdos"
3+
revision = "a0196baa11ea047dd65037287451d36b861b00ea"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright 2016 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
package main
6+
7+
import (
8+
_ "github.com/sdboyer/deptestdos"
9+
)
10+
11+
func main() {
12+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +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
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"commands": [
3+
["ensure"],
4+
["status"]
5+
],
6+
"error-expected": "",
7+
"vendor-final": [
8+
"github.com/sdboyer/deptest",
9+
"github.com/sdboyer/deptestdos"
10+
]
11+
}

0 commit comments

Comments
 (0)