Your one-stop-cake-shop for everything Freshly Baked has to offer

fix(jujutsu): correct back/fwd distances #97

merged
opened by a.starrysky.fyi targeting main from private/minion/push-vswksnnmszrk

previously, back(@, 1) == @. That feels very weird, so instead now back(@, 0) == @. Since as back(@, n) was used in the rangediff script, I also had to update that script to cope with this (it had the correct behavior already...)

We've had to do some interesting finagling to get this to happen, since as AFAICT there is no way to do maths in the revset language (so no way to add 1). Instead, we've done revision- to go back 1 already, so our argument operates on a revision already 1 in the past.

Of course, 0 isn't going to bring us forward again so we instead have to coalesce and return the current revision if we have no changes. Again the revset language gets in our way since as there isn't a way to tell if we have 0 as a quantity directly. Fortunately, for 0 we can make a set that is always guarenteed to have the whole repo as members if and only if our number was 0, and logically-and that with our current revision to conditionally return it.

We also replaced our heads call with ancestors(foo-) & ~ancestors(foo)

  • normally equivalent, but better if we've reached the end of our commits, for example if we do fwd(5) when in reality we only have 2 more commits ontop of us. Previously that would return the last commit, now it returns nothing

Finally, we've added some aliases to fwd(n) which default to using @ since as that seems to be a very common case.

0
by a.starrysky.fyi 0 comments
expand 1 commit
fix(jujutsu): correct back/fwd distances
expand 1 commit
fix(jujutsu): correct back/fwd distances
expand 1 commit
fix(jujutsu): correct back/fwd distances
expand 1 commit
fix(jujutsu): correct back/fwd distances
Labels

None yet.

requested-reviewers

None yet.

approved

None yet.

tested-working

None yet.

rejected

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:uuyqs6y3pwtbteet4swt5i5y/sh.tangled.repo.pull/3m3k5edt3fz22