-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Print information about update
d packages
#1931
Conversation
Rats, CI fails. I'll have to patch all the tests for the new blurbs. |
if removed.len() == 1 && added.len() == 1 { | ||
try!(print_change("Updating", format!("{} v{} -> v{}", | ||
removed[0].name(), | ||
removed[0].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.
Another part of package ids is the source it comes from (e.g. foo
from crates.io is different than foo
from github). In addition to indicating the source, updates of git repositories probably want to print out the SHA that was updated to instead of the revision as that's the "precise" notion there. You should be able to access this through the precise
field of the SourceId
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.
Alright, that shouldn't be hard. How would you like the SourceId
displayed in the Git and the non-Git cases?
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.
Falling back to the normal Display
implementation should be good enough
Thanks for picking this up @thirtythreeforty, looking good! We do also modify the lockfile in the case that the manifest was modified and then Also, to ensure that this scales well, could you try running this over Servo? If you check out servo and run |
Here's the output from Servo:
|
The
The lack of source on the second line is still a bit confusing, but I suppose it's easy enough to figure out that it's from the crate registry. |
Yeah we've got a pretty strong convention of not printing the registry URL for registry packages, so I think it'll quickly become common knowledge that "no source" means "crates.io". Also, thanks for generating that! Did it take an overly long time to generate or was it nice and speedy? (make sure you're using a |
Initially it took a while to download and it did a ton of work (looked like it was compiling something?) when it was updating git repos, but subsequent runs are pretty quick and don't heat up the processor at all. Generating the list of changes takes no time at all, as far as I can tell.
|
Perfect, sounds good to me! |
OK, that commit should address your feedback. (I knew The tests should all still fail because the test cases need to be rewritten to account for the extra info. I'll do that and squash everything once you and I are happy with the main implementation. Here's the new result for Servo:
Note the |
if removed.len() == 1 && added.len() == 1 { | ||
if removed[0].source_id().is_git() { | ||
try!(print_change("Updating", format!("{} #{} -> #{}", | ||
removed[0].name(), |
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 may want to just be removed[0]
as that'll print out the git source this came from as well.
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.
Doing that makes the update line look like this:
Updating offscreen_gl_context v0.1.0 (https://github.com/ecoal95/rust-offscreen-rendering-context#9efc32eb) -> #9704865b
Which I don't think is better, personally.
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.
Hm yeah it can get long sometimes, but I think it's better than not printing it because there's real contextual information (e.g. foo
from a git repo is different than foo
from crates.io is different than foo
from a path source)
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.
Very well, I see your point.
Ok, looks good to me, thanks @thirtythreeforty! There's some failing tests but with those fixed and a squash I think this is good to go |
Thanks for the review! Just squashed with all the tests fixed. |
Compare #1621. Like that pull request, this one solves #984. I have rewritten most of @pyfisch's logic to account for @alexcrichton's comments. Specifically, this code will correctly handle adding/removing multiple versions of one package, as well as several packages with different sources, but the same name. The output looks like this: ``` [georgev@desertvoice cargo]$ cargo update Updating registry `https://github.com/rust-lang/crates.io-index` Updating libc v0.1.8 -> v0.1.10 Updating memchr v0.1.3 -> v0.1.5 Updating num v0.1.26 -> v0.1.27 Updating rand v0.3.9 -> v0.3.10 Updating rustc-serialize v0.3.15 -> v0.3.16 ``` Comments welcome. r? @alexcrichton
☀️ Test successful - cargo-linux-32, cargo-linux-64, cargo-mac-32, cargo-mac-64, cargo-win-gnu-32, cargo-win-gnu-64, cargo-win-msvc-32, cargo-win-msvc-64 |
Glad to help! |
Compare #1621. Like that pull request, this one solves #984.
I have rewritten most of @pyfisch's logic to account for @alexcrichton's comments. Specifically, this code will correctly handle adding/removing multiple versions of one package, as well as several packages with different sources, but the same name.
The output looks like this:
Comments welcome.
r? @alexcrichton