Fix how dep status print revision constraints

Before this fix revision constraints would be printed as an
Any constraint ("*") instead of as the revision itself.
This commit is contained in:
Christopher O'Toole 2017-12-01 13:48:57 -06:00
Родитель ef6a28f70b
Коммит dae0e9d6e9
2 изменённых файлов: 14 добавлений и 3 удалений

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

@ -486,12 +486,16 @@ 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 {
bs.Constraint = pp.Constraint
} else {
bs.Constraint = gps.Any()
for _, c := range cm[bs.ProjectRoot] {
bs.Constraint = c.Constraint.Intersect(bs.Constraint)
}
}
}
// Only if we have a non-rev and non-plain version do/can we display
// anything wrt the version's updateability.

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

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