-
Notifications
You must be signed in to change notification settings - Fork 1k
[WIP] Add runOld
method to statusCommand
#1402
[WIP] Add runOld
method to statusCommand
#1402
Conversation
Why? To list the dependencies that are out-of-date by comparing revesion of each lock projects to the solution one.
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
@googlebot I signed it! |
CLAs look good, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks to be in the right direction.
Let's call it from cmd.Run
and see the result.
Also, we need an integration test for this, similar to those in cmd/dep/testdata/harness_tests/status
.
cmd/dep/status.go
Outdated
@@ -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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we want to check update for all the projects, set params.ChangeAll = true
before preparing a solver.
cmd/dep/status.go
Outdated
} | ||
} | ||
|
||
// TODO: Print output |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can print to ctx.Out
for now. Maybe we would like to use some outputter
later.
ctx.Out.Println("print some text to stdout")
cmd/dep/status.go
Outdated
|
||
for _, sp := range solutionProjects { | ||
for _, lp := range lockProjects { | ||
spr, _, _ := gps.VersionComponentStrings(sp.Version()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be moved out to the outer loop to reduce the number of times we calculate this.
How? By looping just through solution projects and use its index to access both each lock project and solution project.
Why? Because it's not available in Run method and to follow runStatusAll initialize a gps.SolveParameters of inside the method itself.
Why? To be able to do `dep status --old`
@azbshiri ping! need help with the tests or anything? |
@darkowlzz yeah I got stuck with functional test and I've been busy. It'd be great if you could help me out. |
Alright, first you should complete the implementation. The existing code looks incomplete. There's Once that is ready, integration tests can be easily written against the output from the above implementation, like other tests in Hope that makes sense. If you think you won't have time to work on it, it's fine, just leave a note and we will take care of it 🙂 |
yeah, I don't think I'd have time to work on this. |
@azbshiri thanks, it's alright 🙂 @zkry you might be interested in this. |
@darkowlzz Yeah, I am interested 🙂. Been looking for opportunities to contribute lately. I'll take a look at this. |
I made a new PR here #1553 so I can work from my fork. |
Closing this with #1553 merged. |
What does this do / why do we need it?
To list the dependencies that are out-of-date by comparing
revesion of each lock projects to the solution one.
What should your reviewer look out for in this PR?
Comparing revision of each project logic
Do you need help or clarification on anything?
How can I write a test for this case?
Which issue(s) does this PR fix?
fixes #1383