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 2 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
2 changes: 2 additions & 0 deletions cmd/dep/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,8 @@ 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.

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