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

Commit e14bc3d

Browse files
committed
Compare old and new lock projects and diff
1 parent a926781 commit e14bc3d

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

cmd/dep/root_analyzer.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package main
66

77
import (
88
"context"
9+
"fmt"
910
"io/ioutil"
1011
"log"
1112

@@ -167,9 +168,19 @@ func (a *rootAnalyzer) DeriveManifestAndLock(dir string, pr gps.ProjectRoot) (gp
167168
func (a *rootAnalyzer) FinalizeRootManifestAndLock(m *dep.Manifest, l *dep.Lock, ol dep.Lock) {
168169
// Iterate through the new projects in solved lock and add them to manifest
169170
// if they are direct deps and log feedback for all the new projects.
170-
for _, y := range l.Projects() {
171+
sl := gps.SortedLockedProjects(l.Projects())
172+
sol := gps.SortedLockedProjects(ol.Projects())
173+
for i, y := range sl {
171174
var f *fb.ConstraintFeedback
172175
pr := y.Ident().ProjectRoot
176+
if i < len(sol) {
177+
op := sol[i]
178+
if same := y.Ident().Eq(op.Ident()); same {
179+
if diff := gps.DiffProjects(y, op); diff != nil {
180+
fmt.Printf("Some changes: \nImported: %v\nRevised: %v\nDiff: %v\n", y, op, diff)
181+
}
182+
}
183+
}
173184
// New constraints: in new lock and dir dep but not in manifest
174185
if _, ok := a.directDeps[string(pr)]; ok {
175186
if _, ok := m.Constraints[pr]; !ok {

0 commit comments

Comments
 (0)