Skip to content

Add support for reverse dependencies. #69

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

Merged
merged 3 commits into from
Nov 24, 2014
Merged

Conversation

huonw
Copy link
Member

@huonw huonw commented Nov 23, 2014

This adds an API endpoint .../:crate/reverse_dependencies and a web-page /crate/:crate/reverse_dependencies for displaying. It's modelled after the .../versions page, and is not currently linked from anywhere.

cratesio-revdep

Fixes #68.

let stmt = try!(conn.prepare("SELECT dependencies.*,
crates.name AS crate_name
FROM dependencies
LEFT JOIN versions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these left joins instead of inner joins? (I have not looked deeply at the schema so this may be a stupid question.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mindless copypaste. I've adjusted it now.

@alexcrichton
Copy link
Member

Looks great, thanks @huonw! Can you also add some tests for the endpoint? You should see some examples in src/test/krate.rs

import Ember from 'ember';

export default Ember.ObjectController.extend({
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can delete this whole file because its blank.

This /api/v1/crates/foo/reverse_dependencies gives the full dependency
information about each crate that depends on foo (i.e. crates with
`[dependencies] foo = "..."`).
This connects the web-app to the back-end API and allows it to display a
list of all the reverse dependencies of a crate as a
/reverse_dependencies subroute.

This uses the same format as the /versions route.
This includes making some changes to the test harness, e.g. allowing
dependencies to be added from multiple versions of the dependent crate.
@alexcrichton alexcrichton merged commit ea25ea8 into rust-lang:master Nov 24, 2014
@alexcrichton
Copy link
Member

Tidied up in e05572c

Added pagination in 01f1bf7 and 7aa1db0

Thanks @huonw!

@carols10cents
Copy link
Member

OMG awesome!!!! This is so cool :) ❤️ @huonw !!!

@huonw huonw deleted the rev-dep branch November 25, 2014 00:46
Turbo87 pushed a commit to Turbo87/crates.io that referenced this pull request Dec 7, 2022
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Turbo87 pushed a commit to Turbo87/crates.io that referenced this pull request Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: Reverse index of packages that depend on this package
4 participants