git-branchless icon indicating copy to clipboard operation
git-branchless copied to clipboard

Add a 'pushed(x)' built-in function to revsets

Open mfulbright opened this issue 1 year ago • 1 comments

I would find a function that filters for commits that have been pushed to a remote repository useful in revsets.

Proposed function description: pushed(x): all commits in x that have been pushed to a remote repo

Example usages: Lint all commits in the current stack that haven't been pushed yet (commits that have been pushed shouldn't be modified!): `$ git test fix --exec 'cargo fmt --all' 'stack() - pushed(stack())'

Print all new commits that will be pushed with 'git push': $ git_push_check() { echo "New commits that will be pushed:" && git query "master..$1 - pushed(master..$1)" ; }

mfulbright avatar Jun 02 '24 23:06 mfulbright

It might actually be easier or more composeable to define pushed(), which evaluates to all commits reachable from a remote ref. (The implementation treats commit ranges symbolically and has separate evaluate vs contains code paths, so it can be made efficient in many cases.)

arxanas avatar Oct 09 '24 15:10 arxanas