Skip to content

Merge cargo-upgrade into cargo #685

Open

Description

@epage

A scratchpad for rust-lang/cargo#12425

Merge plan

Open questions

  • How do we represent "fail if manifest will change" and "upgrade using lock file"
    • Currently "fail if manifest will change" is --locked and "upgrade using lock file" is --to-lockfile
    • Alt: if you squint --locked could also mean "upgrade using lock file"
    • Prompt the user for each upgrade by default but also accept --choice <none|locked|latest>

Activity

  1. epage commented on Mar 31, 2022

    @epage
    CollaboratorAuthor

    Bugs

    Requests

    Uncertain

  2. epage commented on Mar 31, 2022

    @epage
    CollaboratorAuthor

    Prior art

  3. epage commented on Mar 31, 2022

    @epage
    CollaboratorAuthor

    Current design

    cargo-upgrade 0.8.0
    Upgrade dependencies as specified in the local manifest file (i.e. Cargo.toml)
    
    USAGE:
        cargo upgrade [OPTIONS] [DEPENDENCY]...
    
    ARGS:
        <DEPENDENCY>...    Crates to be upgraded
    
    OPTIONS:
            --all                     [deprecated in favor of `--workspace`]
            --allow-prerelease        Include prerelease versions when fetching from crates.io (e.g. 0.6.0-alpha')
            --dry-run                 Print changes to be made without making them
            --exclude <EXCLUDE>       Crates to exclude and not upgrade
        -h, --help                    Print help information
            --manifest-path <PATH>    Path to the manifest to upgrade
            --offline                 Run without accessing the network
        -p, --package <PKGID>         Package id of the crate to add this dependency to
            --skip-compatible         Only update a dependency if the new version is semver incompatible
            --to-lockfile             Upgrade all packages to the version in the lockfile
        -V, --version                 Print version information
            --workspace               Upgrade all packages in the workspace
        -Z <FLAG>                     Unstable (nightly-only) flags [possible values: preserve-precision]
    
    This command differs from `cargo update`, which updates the dependency versions recorded in the local lock file (Cargo.lock).
    
    If `<dependency>`(s) are provided, only the specified dependencies will be upgraded. The version to upgrade to for each can be specified with e.g.
    `[email protected]` or `serde@>=0.9,<2.0`.
    
    Dev, build, and all target dependencies will also be upgraded. Only dependencies from crates.io are supported. Git/path dependencies will be
    ignored.
    
    All packages in the workspace will be upgraded if the `--workspace` flag is supplied. The `--workspace` flag may be supplied in the presence of a
    virtual manifest.
    
    If the '--to-lockfile' flag is supplied, all dependencies will be upgraded to the currently locked version as recorded in the Cargo.lock file. This
    flag requires that the Cargo.lock file is up-to-date. If the lock file is missing, or it needs to be updated, cargo-upgrade will exit with an
    error. If the '--to-lockfile' flag is supplied then the network won't be accessed.
    
  4. epage commented on Mar 31, 2022

    @epage
    CollaboratorAuthor

    --manfest-path and --package working like normal but --exclude being an opt-out for when no DEPENDENCY is specified and we select all, is odd.

  5. epage commented on Mar 31, 2022

    @epage
    CollaboratorAuthor

    Another open question is if we should somehow integrate this into cargo update or if it should remain a distinct command. I was hoping some prior art would help clarify some decisions here but not really.

  6. epage commented on Jul 14, 2022

    @epage
    CollaboratorAuthor

    I split out the main UX question to #737

  7. TCROC commented on Aug 13, 2023

    @TCROC

    Any update on this issue @epage ? I would love to see this merged into the cargo update command. Or at least into the official cargo distribution.

  8. epage commented on Aug 13, 2023

    @epage
    CollaboratorAuthor

    A design for a subset of the functuionality being merged into cargo update has been FCPed: rust-lang/cargo#12425

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions