Merge pull request #1421 from otoolec/status-revision-constraint

Fix how dep status print revision constraints
This commit is contained in:
Sunny 2017-12-13 23:52:56 +05:30 коммит произвёл GitHub
Родитель 3a59b68597 b5e10242b4
Коммит f31d439b6c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
9 изменённых файлов: 82 добавлений и 0 удалений

Просмотреть файл

@ -500,6 +500,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 {
// 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] {

Просмотреть файл

@ -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",
},
}
for _, tc := range testCases {

20
cmd/dep/testdata/harness_tests/status/revision_constraint/final/Gopkg.lock сгенерированный поставляемый Normal file
Просмотреть файл

@ -0,0 +1,20 @@
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
name = "github.com/sdboyer/deptest"
packages = ["."]
revision = "ff2948a2ac8f538c4ecd55962e919d1e13e74baf"
version = "v1.0.0"
[[projects]]
name = "github.com/sdboyer/deptestdos"
packages = ["."]
revision = "a0196baa11ea047dd65037287451d36b861b00ea"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "a64abd431f23d6fbc8d83aef311d33ab12b3a6c74a46c271e89c2542c98bbb9a"
solver-name = "gps-cdcl"
solver-version = 1

Просмотреть файл

@ -0,0 +1,3 @@
[[constraint]]
name = "github.com/sdboyer/deptestdos"
revision = "a0196baa11ea047dd65037287451d36b861b00ea"

20
cmd/dep/testdata/harness_tests/status/revision_constraint/initial/Gopkg.lock сгенерированный поставляемый Normal file
Просмотреть файл

@ -0,0 +1,20 @@
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
name = "github.com/sdboyer/deptest"
packages = ["."]
revision = "ff2948a2ac8f538c4ecd55962e919d1e13e74baf"
version = "v1.0.0"
[[projects]]
name = "github.com/sdboyer/deptestdos"
packages = ["."]
revision = "a0196baa11ea047dd65037287451d36b861b00ea"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "a64abd431f23d6fbc8d83aef311d33ab12b3a6c74a46c271e89c2542c98bbb9a"
solver-name = "gps-cdcl"
solver-version = 1

Просмотреть файл

@ -0,0 +1,3 @@
[[constraint]]
name = "github.com/sdboyer/deptestdos"
revision = "a0196baa11ea047dd65037287451d36b861b00ea"

Просмотреть файл

@ -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() {
}

Просмотреть файл

@ -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

Просмотреть файл

@ -0,0 +1,11 @@
{
"commands": [
["ensure"],
["status"]
],
"error-expected": "",
"vendor-final": [
"github.com/sdboyer/deptest",
"github.com/sdboyer/deptestdos"
]
}