Commit graph

71 commits

Author SHA1 Message Date
hi-rustin
ea5ade3426 cargo check check [dependencies] order without considering the dotted item
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-01-22 22:55:07 +08:00
Weihang Lo
c51c6bb6ac
chore: reflect to clap updates 2023-01-14 09:23:39 +00:00
Philpax
249683b456
fix(tests): update to match add change 2022-12-15 09:34:23 +01:00
hi-rustin
6b24d5c761 Rename infer_package to infer_package_for_git_source
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-10-10 22:19:32 +08:00
hi-rustin
6ae292100b Update cargo add test
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-10-07 19:00:14 +08:00
Ed Page
96948f7a24 refactor(cli): Upgrade to clap v4 2022-09-28 13:32:14 -05:00
Emil Gardström
1cc21b65d1
make unknown features on cargo add more discoverable 2022-09-21 08:07:16 +02:00
Ed Page
be257b8b25 fix(add): Remove redundant version in build metadata cases 2022-09-12 09:51:38 -05:00
Ed Page
7ce2b7d42a fix(add): Limit 'Features as of vX.Y.Z' to when relevant
This will only show the messaeg if we didn't already show a version req
with full precision specified ... mostly.  We'll also skip it if its a
local or git dependency but we never show the version in those cases
because it doesn't matter.

The `precise_version` logic came from cargo-upgrade.
2022-09-12 09:46:22 -05:00
Ed Page
73906aeaf8 fix(add): Clarify which version the features are added for
This gives a hint to users that we might not be showing the feature list
for the latest version but the earliest version.

Also when using a workspace dependency or re-using an existing
dependency, this is a good reminder of what the version requirement is
that was selected.

However, when the user or add (the common case) selected a full
precision requirement, this is redundant.

I'm also mixed on whether the meta version should show up.

Fixes #11073
2022-09-12 09:39:47 -05:00
Ed Page
5789c12e45 fix(add): Update the lock file
This is done in the command, rather than in the op,
- To consistently construct the `Workspace`
- It is more composable as an API

A downside is we update the git dependencies a second time.

We are not rolling back on error.
- For some errors, the user might want to debug what went wrong
- Rollback adds its own complications and risks, including since its
  non-atomic

Fixes #10901
2022-07-26 14:59:07 -05:00
Ed Page
323c7bc306 test(add): Make test data valid
Resolving the manifests will fail due to inconsistencies.  This
addresses those.
2022-07-25 11:06:12 -05:00
Ed Page
b5c4a765ef fix(add): Respect --locked
This is prep for #10901 to avoid the most common failure case for the
lock file.  We are assuming if the users action caused a change in the
manifes, then it will cause a change in the lock file.  This isn't
entirely true but close enough and I think these semantics can make
sense.
2022-07-25 09:52:00 -05:00
Scott Schafer
2c810afda9 Stabilize workspace inheritance 2022-07-23 09:36:49 -05:00
Scott Schafer
c239e407e7 add a reason to masquerade_as_nightly_cargo so it is searchable 2022-07-15 21:32:23 -05:00
Ed Page
b78f91831e test(add): Ensure comments are preserved
A comment on killercup/cargo-edit#15 had me worried that `cargo add` was
deleting comments now.  It appears that isn't the case for inline
tables.

Standard tables however do delete comments.  The work to make sure they
don't conflicts with another need.  When changing the source, we delete
the old source fields and append the new which can cause some formatting
to be carried over unnecessarily.

For example, what would normally look like
```toml
cargo-list-test-fixture-dependency = { optional = true, path = "../dependency", version = "0.0.0" }
```
When fixed to preserve comments with my naive solution looks like
```toml
cargo-list-test-fixture-dependency = { optional = true , path = "../dependency", version = "0.0.0" }
```
Note that `optional = true` used to be last, so space separating it and
`}` was kept, now separating it and `,`.

More work will be needed to get this into an ideal state but we can at
least have confidence with inline tables for now.
2022-07-13 13:38:10 -05:00
Ed Page
18f7dfe0f5 fix(add): Don't panic with --offline
For some reason, I defined my own `--offline` flag and it didn't get
updated with the global `--offline` flag, so it started failing.

Fixes #10814
2022-07-02 23:04:00 -05:00
Ed Page
cbd4edb266 refactor(test): Clarify asserts are for UI
In writing the contrib documentation for functional vs ui tests, I
realized that as we work to make snapbox work for the functional tests,
we'll need distinct `Assert` objects since we'll want to elide a lot
more content in functional tests.  I'm making room for this by
qualifying the existing asserts as being for "ui".
2022-06-21 14:59:54 -05:00
Ed Page
6f475f090e chore: Upgrade to clap 3.2 2022-06-13 10:02:23 -05:00
Scott Schafer
92fbc4e344 move all snapshot/cargo_add/ tests to testsuite/cargo_add/ 2022-05-06 20:51:29 -05:00
Scott Schafer
ea312988fb move a snapshot/add/ test into testsuite/cargo_add directory 2022-05-06 10:31:58 -05:00