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

[Feature]: A reliable way to check if a package needs an update. #429

Open
1 task done
sdwolfz opened this issue Feb 23, 2025 · 2 comments
Open
1 task done

[Feature]: A reliable way to check if a package needs an update. #429

sdwolfz opened this issue Feb 23, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@sdwolfz
Copy link

sdwolfz commented Feb 23, 2025

Feature Description

I'm building a backup / restore functionality that's basically:

  • create a .tar.zstd of the elpaca directory
  • fetch all heads with elpaca-fetch-all
  • look in the elpaca-logs for "#update-log" to see if there are any updates
  • if no updates then delete the created backup
  • if any updates then merge them with elpaca-merge-all and kill-emacs to start fresh

What I'd like is a more robust way of checking if updates are needed. Basically I propose an elpaca-check-for-updates (or similar named) that uses git rev-parse HEAD and git ls-remote origin -h refs/heads/<<branch-name-here>> to check for updates without actually fetching them.

This way, the backup step would be:

  • check for updates
  • if any: backup and pull
  • if none then noop

Confirmation

  • The feature I'm proposing does not already exist in Elpaca
@sdwolfz sdwolfz added the enhancement New feature or request label Feb 23, 2025
@progfolio
Copy link
Owner

I'm building a backup / restore functionality

Cool! I suggest implementing something like that as a separate package which integrates with Elpaca.

What I'd like is a more robust way of checking if updates are needed. Basically
I propose an elpaca-check-for-updates (or similar named) that uses git rev-parse HEAD and git ls-remote origin -h refs/heads/<<branch-name-here>> to
check for updates without actually fetching them.

That should cover the simple case of users who do not modify any packages.
For users who do, it would be necessary to check if the current worktree is clean and also if the remote HEAD is an ancestor of the user's work. Straight.el has some work in that direction in straigth-vc-git--local-branch which may be of use.

@sdwolfz
Copy link
Author

sdwolfz commented Feb 26, 2025

Cool! I suggest implementing something like that as a separate package which integrates with Elpaca.

Yes, I'm implementing that as a separate package, the purpose: build just enough functionality to be able to pitch elpaca as the package management solution for Spacemacs (no promises though).

https://gitlab.com/sdwolfz/experimacs/-/blob/master/core/experimacs-package-management.el?ref_type=heads

That should cover the simple case of users who do not modify any packages.

elapca-check-for-updates and elpaca-updates-mergeable as separate functions then?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants