Skip to content
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

Implement freezing and thawing of pins #78

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

andir
Copy link
Owner

@andir andir commented May 11, 2024

This allows freezing a pin to ensure that it isn't changed by issuing a blanked npins update.

Should fix #62

Copy link
Contributor

@eclairevoyant eclairevoyant left a comment

Choose a reason for hiding this comment

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

Seems to work as expected. Thanks for looking into this!

@andir andir marked this pull request as ready for review May 12, 2024 08:54
Copy link
Collaborator

@piegamesde piegamesde left a comment

Choose a reason for hiding this comment

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

Looking good, only some nits (and "thaw" as name)

@piegamesde
Copy link
Collaborator

Now that I actually think of it, what is the workflow of manually updating frozen pins? Unfreezing them just for that purpose seems a bit unwieldy.

@andir
Copy link
Owner Author

andir commented May 15, 2024

Now that I actually think of it, what is the workflow of manually updating frozen pins? Unfreezing them just for that purpose seems a bit unwieldy.

Perhaps an extra argument to the update command?

This allows freezing a pin to ensure that it isn't changed by issuing
a blanked `npins update`.

Co-authored-by: piegames <[email protected]>
Copy link
Contributor

@Coca162 Coca162 left a comment

Choose a reason for hiding this comment

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

Doesn't look like it breaks anything on the updating side 👍

Comment on lines 721 to 729
let (mut style, status) = if opts.names.is_empty() || valid_names.contains(name) {
(ContentStyle::new().grey(), "queued")
if pin.is_frozen() && !opts.update_frozen {
(ContentStyle::new().dark_grey(), "frozen")
} else {
(ContentStyle::new().grey(), "queued")
}
} else {
(ContentStyle::new().dark_grey(), "ignored")
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Would probably nicer turned into a match now:

let (mut style, status) = match (
    opts.names.is_empty() || valid_names.contains(name),
    pin.is_frozen() && !opts.update_frozen,
) {
    (true, false) => (ContentStyle::new().grey(), "queued"),
    (true, true) => (ContentStyle::new().dark_grey(), "frozen"),
    (false, _) => (ContentStyle::new().dark_grey(), "ignored"),
};

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.

Pinning specific commits in a GH repo
5 participants