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

Fix how dep status print revision constraints #1421

Merged
merged 3 commits into from
Dec 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cmd/dep/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,9 @@ func runStatusAll(ctx *dep.Ctx, out outputter, p *dep.Project, sm gps.SourceMana
if pp, has := p.Manifest.Ovr[proj.Ident().ProjectRoot]; has && pp.Constraint != nil {
bs.hasOverride = true
bs.Constraint = pp.Constraint
} else if pp, has := p.Manifest.Constraints[proj.Ident().ProjectRoot]; has && pp.Constraint != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment above this block talks about checking in Override. Since with this we check Constraints separately, let's add a comment about that too.

// If the manifest has a constraint then set that as the constraint.
bs.Constraint = pp.Constraint
} else {
bs.Constraint = gps.Any()
for _, c := range cm[bs.ProjectRoot] {
Expand Down
7 changes: 7 additions & 0 deletions cmd/dep/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,13 @@ func TestBasicStatusGetConsolidatedConstraint(t *testing.T) {
},
wantConstraint: "1.2.1 (override)",
},
{
name: "BasicStatus with Revision Constraint",
basicStatus: BasicStatus{
Constraint: gps.Revision("ddeb6f5d27091ff291b16232e99076a64fb375b8"),
},
wantConstraint: "ddeb6f5",
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this. But we need an integration test to test the actual change in result from this PR, because the runStatusAll() is not run by any of the unit tests. You can refer https://github.com/golang/dep/blob/master/cmd/dep/testdata/harness_tests/README.md to learn how to write and run the integration tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I'll work on the integration test

}

for _, tc := range testCases {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[[constraint]]
name = "github.com/sdboyer/deptestdos"
revision = "a0196baa11ea047dd65037287451d36b861b00ea"

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[[constraint]]
name = "github.com/sdboyer/deptestdos"
revision = "a0196baa11ea047dd65037287451d36b861b00ea"
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (
_ "github.com/sdboyer/deptestdos"
)

func main() {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
PROJECT CONSTRAINT VERSION REVISION LATEST PKGS USED
github.com/sdboyer/deptest v1.0.0 v1.0.0 ff2948a ff2948a 1
github.com/sdboyer/deptestdos a0196ba a0196ba 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"commands": [
["ensure"],
["status"]
],
"error-expected": "",
"vendor-final": [
"github.com/sdboyer/deptest",
"github.com/sdboyer/deptestdos"
]
}