From d730e6f0856e2f4afbe9258966c29547b3a84b36 Mon Sep 17 00:00:00 2001 From: Austin Seipp Date: Tue, 10 Sep 2024 14:29:51 -0500 Subject: [PATCH] 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 --- CHANGELOG.md | 5 +++++ cli/src/config/revsets.toml | 3 +++ docs/revsets.md | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fb2f58e0..221e611fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 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 panic when parsing invalid conflict markers of a particular form. diff --git a/cli/src/config/revsets.toml b/cli/src/config/revsets.toml index 253e16778..5aeebe12e 100644 --- a/cli/src/config/revsets.toml +++ b/cli/src/config/revsets.toml @@ -22,3 +22,6 @@ latest( 'immutable_heads()' = 'builtin_immutable_heads()' 'immutable()' = '::(immutable_heads() | root())' 'mutable()' = '~immutable()' + +# NOTE: for Windows users, who don't want to type `@ all the time +'at' = '@' diff --git a/docs/revsets.md b/docs/revsets.md index 8eab38eee..8bb67f853 100644 --- a/docs/revsets.md +++ b/docs/revsets.md @@ -19,6 +19,10 @@ ID or a Git ref pointing to them). ## Symbols 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 `@` to refer to the working-copy commit in another workspace. Use `@` to refer to a remote-tracking branch.