ok/jj
1
0
Fork 0
forked from mirrors/jj

config: introduce default at = @ revset alias

When using Windows, `@` is a bit of an annoyance to type in the terminal due
to Windows Terminal escape rules, so you actually have to write it with a
backtick in front. It's annoying to remember this and not possible to configure
a different behavior, as far as I can see.

However, there is a smart trick you can do to make this a lot easier: just alias
`@` to the name `at` and be happy. Because:

- It's short: sweet and easy to read, and requires no backticks.
- It's unambiguous: `a` is from commit alphabet, but `t` is from the change alphabet
- It can be typed without a huge loss in efficiency (and one hand, assuming QWERTY).

I believe it was Stephen Jennings who came up with this trick first in Discord,
and I have it in my aliases, but I run into it every time I try to use JJ on a
fresh Windows VM to test stuff. Let's make life a little easier for everyone and
just ship this by default.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
This commit is contained in:
Austin Seipp 2024-09-10 14:29:51 -05:00
parent 69edc7f2df
commit d730e6f085
3 changed files with 12 additions and 0 deletions

View file

@ -36,6 +36,11 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
(inherit from parent; default), `full` (full working copy), or `empty` (the (inherit from parent; default), `full` (full working copy), or `empty` (the
empty working copy). empty working copy).
* A revset alias named `at` is now provided, which functions identically to the
working-copy symbol `@`. This symbol cannot conflict with any Change or Commit
ID, and may be used in places where `@` may require escaping, like the Windows
terminal.
### Fixed bugs ### Fixed bugs
* Fixed panic when parsing invalid conflict markers of a particular form. * Fixed panic when parsing invalid conflict markers of a particular form.

View file

@ -22,3 +22,6 @@ latest(
'immutable_heads()' = 'builtin_immutable_heads()' 'immutable_heads()' = 'builtin_immutable_heads()'
'immutable()' = '::(immutable_heads() | root())' 'immutable()' = '::(immutable_heads() | root())'
'mutable()' = '~immutable()' 'mutable()' = '~immutable()'
# NOTE: for Windows users, who don't want to type `@ all the time
'at' = '@'

View file

@ -19,6 +19,10 @@ ID or a Git ref pointing to them).
## Symbols ## Symbols
The `@` expression refers to the working copy commit in the current workspace. The `@` expression refers to the working copy commit in the current workspace.
In places where the `@` symbol needs to be escaped, such as inside a Windows
terminal, you may use the name `at` instead, which is identical to `@` and
requires no quoting.
Use `<workspace name>@` to refer to the working-copy commit in another Use `<workspace name>@` to refer to the working-copy commit in another
workspace. Use `<name>@<remote>` to refer to a remote-tracking branch. workspace. Use `<name>@<remote>` to refer to a remote-tracking branch.