`jj log | head` consistently prints "Error: Broken pipe" for me. I
don't know how the output gets printed after the pipe has been closed,
but neither `git` nor `hg` prints an error, so I think we shouldn't
either.
Thanks to 81af5f820b "repo: calculate shortest unique prefix separately for
commit/change", commit_id.shortest() now works even if the repo is MutableRepo.
No more format!() template expressions.
We might want a separate namespace for configurable "default" aliases, but
let's start with a simple approach. Even if we had [default-templates]
section, it would be practically the same as [template-aliases] so long as
'default-templates.f()' appears as 'f()' in template.
Even though we don't know the details yet, we know that we want to
make the index pluggable like the commit and opstore
backends. Defining a trait for it should be a good step. We can refine
the trait later.
We have made some changes to CLI output that had not made it into the
tutorial. It's time to update it, especially with the new change id
rendering. Since I'm updating it now, and since it's a bit of work to
do so, I decided to use GitHub's Hello-World repo instead of jj's own
repo as our example.
By separating the value spaces change ids and commit ids, we can
simplify lookup of a prefix. For example, if we know that a prefix is
for a change id, we don't have to try to find matching commit ids. I
think it might also help new users more quickly understand that change
ids are not commit ids.
This commit is a step towards that separation. It allows resolving
change ids by using hex digits from the back of the alphabet instead
of 0-f, so 'z'='0', 'y'='1', etc, and 'k'='f'. Thanks to @ilyagr for
the idea. The regular hex digits are still allowed.
Since type/name checking is made after alias substitution, we need to preserve
the original context to generate a readable error message.
We could instead attach a stack of (alias_id, span) to ExpressionNode, but
the extra AliasExpanded node helps to capture downstream error by a single
.map_err() call.
This is basically a copy of revset::RevsetAliasesMap. We could extract a
common table struct, but that wouldn't be worth the effort since the core
alias substitution logic can't be easily abstracted.
I'll add an alias table there. Since this function borrows self, it can't
always be used in between mutable operations. For log-like commands, this
should just work fine.
This prepares for template aliases support #1190. Unlike revset, template
expressions can be of various types, whereas alias substitution will process
untyped nodes. That's one reason that ExpressionNode is closer to parsed tree
than evaluatable Property structs. Another reason is that it's uneasy to split
name/type checking into "parsing" and "building property function" stages.
We could do alias expansion at once while building Property functions, but
that would make testing harder because Property isn't Debug + PartialEq.
I'm going to split 'parse() -> Expression' functions into 'parse() -> AST'
and 'build(AST) -> Expression'. The duplicated functions will be baseline of
new 'parse() -> AST' functions.
Without a pager configured (in `ui.pager` or `$PAGER`), running
`LC_CTYPE=foo jj log` would replace the Unicode characters in our
(Sapling's) "curved" graph style by escapes, like this:
```
@ 1d4ae2372dd2 martinvonz@google.com 2023-02-11 14:56:00.000 -08:00 a8eac1f9efe8
<E2><94><82> (no description set)
```
This fixes that by including the `LESSCHARSET=utf-8` environment
variable in our default `ui.pager` value.
We would like our default pager of `less -FRX` to also get passed
`LESSCHARSET=utf-8`. I don't like having defaults that the user can't
specify themselves, so this commits provides users with a way to pass
environment variables to their configured pager (or editor, or merge
tool, ...).
I didn't document this feature and I didn't add it to the config
schema because it seems it's going to be so rarely useful to users.