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

Commit

Permalink
Add runOld method to statusCommand
Browse files Browse the repository at this point in the history
Why?
To list the dependencies that are out-of-date by comparing
revesion of each lock projects to the solution one.
  • Loading branch information
Alireza Bashiri committed Nov 25, 2017
1 parent 13df556 commit 24afc01
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions cmd/dep/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package main

import (
"bytes"
"context"
"encoding/json"
"flag"
"fmt"
Expand Down Expand Up @@ -273,6 +274,36 @@ func (cmd *statusCommand) Run(ctx *dep.Ctx, args []string) error {
return nil
}

func (cmd *statusCommand) runOld(ctx *dep.Ctx, args []string, p *dep.Project, sm gps.SourceManager, params gps.SolveParameters) error {
solver, err := gps.Prepare(params, sm)
if err != nil {
return errors.Wrap(err, "fastpath solver prepare")
}

solution, err := solver.Solve(context.TODO())
if err != nil {
return errors.Wrap(err, "runOld")
}

var oldLockProjects []gps.LockedProject
lockProjects := p.Lock.Projects()
solutionProjects := solution.Projects()

for _, sp := range solutionProjects {
for _, lp := range lockProjects {
spr, _, _ := gps.VersionComponentStrings(sp.Version())
lpr, _, _ := gps.VersionComponentStrings(lp.Version())

if spr != lpr {
oldLockProjects = append(oldLockProjects, lp)
}
}
}

// TODO: Print output
return nil
}

type rawStatus struct {
ProjectRoot string
Constraint string
Expand Down

0 comments on commit 24afc01

Please sign in to comment.