Closed ilyagr closed 1 month ago
xyz@a5b
is another option, but then we'd probably need to replace the use of @
for branch@remote
syntax.
If we choose @
for the operator, we'd probably also want to remove it from the allowed characters in an identifier: https://github.com/martinvonz/jj/blob/92f9fe5a1b12035e52866fd8abcae60b9e86bea9/lib/src/revset.pest#L15-L19
But since we use @
for the working-copy commit, that's doesn't seem like a good idea :) So never mind, #
seems much better
I also don't particularly like #
, but I haven't thought of a better option.
One ambiguity is whether @#abc6
should be the commit that was current at abc6
or the commit with the same change id as @ at abc6
. I would probably want the former, but that would require exceptional treatment for revsets that include @
.
Update On Discord, Martin suggested that the revset be expanded by first loading operation abc6
and then computing @
in that context. That would solve this problem.
This would also be quite useful for branches.
So expr#op
will be the operator to evaluate expr
within the environment at op
. If we can't find a better operator character, we can try with a function syntax first.
A related FR would be a "universal reflog", a way to see or use the "previous value" of something like "main@origin" as something like "main@origin#1". This would ignore any past operations that didn't change the value of "main@origin". (Of course, we'd need a different symbol or syntax if main@origin#1
treats 1 as an operation id. Or, perhaps we could use one of ^%
for op id. %
makes the most sense to me at the moment, not sure why).
I think filtering by revset could already be implemented as an option to jj op log
(similarly to filtering by file for jj log
), but that's a separate feature and would be more awkward to use.
It would be nice to have something like
xyz#a5b
to represent the commit that the changexyz
was at operationa5b
. So, one could dojj log --at-op a5b
and follow that up withjj restore --from xyz#a5b
.