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

37 commits

Author SHA1 Message Date
Yuya Nishihara
904e9c5520 cli: add ui.log-word-wrap option
Unlike Mercurial, this isn't a template keyword/function, but a config knob.
Exposing graph_width to templater wouldn't be easy, and I don't think it's
better to handle terminal wrapping in template.

I'm not sure if patch content should be wrapped, so this option only applies
to the template output for now.

Closes #1043
2023-03-11 12:01:17 +09:00
Yuya Nishihara
5d184e6694 cli: in "show" template, indent description like Git does 2023-03-04 12:10:53 +09:00
Yuya Nishihara
66458a097e templater: require infix ++ operator to concatenate expressions
This eliminates ambiguous parsing between "func()" and "expr ()".

I chose "++" as template concatenation operator in case we want to add
bit-wise negate operator. It's also easier to find/replace than "~".
2023-03-01 16:39:23 +09:00
Yuya Nishihara
fd27d228ed templater: add concat(contents..) function, migrate default templates
Multi-line templates looked a bit ugly if I replaced all implicit concats
with ++ operations.
2023-03-01 16:39:23 +09:00
Yuya Nishihara
433623c138 cli: use separate(" ") to concatenate fields in default templates
Here we know each field will never be empty, but separate(" ", foo, bar)
looks slightly better than 'foo ++ " " ++ bar'. Implicit template concatenation
will be disabled soon.
2023-03-01 16:39:23 +09:00
Ilya Grigoriev
49fd177c47 templater: Allow separate styling for change and commit ids 2023-02-21 22:50:27 -08:00
Yuya Nishihara
4ec0bfb8f7 cli: rename op "head" color label to "current_operation"
FWIW, this change means a boolean "current_operation" keyword will be
highlighted even if it's false.
2023-02-21 00:24:58 +09:00
Yuya Nishihara
4f36367aee cli: rename "op-log" color label to "op_log"
Per discussion in #1289.
2023-02-21 00:24:58 +09:00
Yuya Nishihara
b5f1728ffb templater: migrate op log to template language
The outermost "op-log" label isn't moved to the default template. I think
it belongs to the command's formatter rather than the template.

Old bikeshedding items:
- "current_head", "is_head", or "is_head_op"
  => renamed to "current_operation"
- "templates.op-log" vs "templates.op_log" (the whole template is labeled
  as "op-log")
  => renamed to "op_log"
- "template-aliases.'format_operation_duration(time_range)'"
  => renamed to 'format_time_range(time_range)'
2023-02-20 18:20:41 +09:00
Yuya Nishihara
3c61e9239c config: remove ui.log-author-format in favor of template alias 2023-02-16 11:43:17 +09:00
Yuya Nishihara
6316ec7442 config: migrate log/show timestamp format away from config knob
Since oplog still relies on ui.relative-timestamps, this config key
isn't removed.
2023-02-16 11:43:17 +09:00
Yuya Nishihara
a00767bc0f config: remove ui.unique-prefixes/log-id-preferred-length in favor of alias 2023-02-16 11:43:17 +09:00
Yuya Nishihara
0abf9ce8cd cli: move default "show" template to alias
I'm not pretty sure if this is structurally good, but 'jj log -T show'
is useful.
2023-02-15 01:44:33 +09:00
Yuya Nishihara
605eb72883 config: rename [template] section to [templates], drop .graph suffix
This should be more consistent with the other tables.
2023-02-15 00:23:48 +09:00
Yuya Nishihara
9c6fa67b86 config: apply configured id style to commit_summary template
Thanks to 81af5f820b "repo: calculate shortest unique prefix separately for
commit/change", commit_id.shortest() now works even if the repo is MutableRepo.
2023-02-15 00:23:48 +09:00
Yuya Nishihara
bc7ca03da4 config: extract commit_summary template to config/templates.toml 2023-02-15 00:23:48 +09:00
Yuya Nishihara
32f4a81329 config: extract "show" template to config/templates.toml
Aside from [template] vs [templates], we might want a "show" template alias
so "jj log -Tshow" serves the role of "hg log -v".
2023-02-15 00:23:48 +09:00
Yuya Nishihara
a5a49c8c12 config: extract default log template to config/templates.toml 2023-02-15 00:23:48 +09:00
Yuya Nishihara
d0715a0935 cli: load [template-aliases] section and pass around aliases table 2023-02-14 10:06:28 +09:00
Yuya Nishihara
a1bfe33a08 cli: expand $left/$right parameters in merge-tools.<name>.edit-args
And set edit_args = ["$left", "$right"] by default.
2023-02-07 18:32:57 +09:00
Martin von Zweigbergk
24bc34a0e9 cli: make hints cyan instead of blue
It's hard to read dark blue on black, at least with iTerm2's default
color scheme. Cyan makes it much more readable. That's the color
`cargo` uses. We could also consider coloring only the "Hint:" part
like `cargo` does. For errors, `cargo` colors the "Error:" part red
and uses bold/bright white for select parts of the message.
2023-02-04 11:16:34 -08:00
Martin von Zweigbergk
18d4300895 formatter: rename underlined color config to underline
I keep calling it `underline` by mistake, so that probably means that
it's a more natural name for it. We haven't made a release of it yet,
so I didn't mention it in the changelog.

I didn't update all variables to also use `underline`, because I felt
that `underlined` was usually more natural there, plus crossterm calls
it `Attribute::Underlined`.
2023-01-31 08:14:27 -08:00
Ilya Grigoriev
adfae11e11 jj log: ui.unique-prefixes="styled" option to show prefixes in color
The tail of the id is shown in grey. For divergent commits, it looks better
to show the tail in red, so the prefix is underlined.

https://user-images.githubusercontent.com/4123047/213904951-caccef87-3636-45b1-b503-86a4271f0cc8.png
2023-01-30 22:48:38 -08:00
Martin von Zweigbergk
5ec5f4bb5f config: rename [alias] to [aliases], still supporting old name
The name of the [alias] section is inconsistent with other
table-valued sections ([revset-aliases], [colors], [merge-tools]), so
let's rename it. For comparison, `Cargo.toml` also uses plural names
(e.g. `[dependencies]`).
2023-01-26 18:15:23 -08:00
Yuya Nishihara
337246ea51 cli: error out if alias/revset-aliases section isn't of map type
I considered adding .optional() helper to lift Result to Result<Option<_>>,
but it's much simpler to expect all config sections (and maybe all keys?)
are defined by default.

The error message is a bit cryptic, but it should be improved by the following
PR if accepted.

https://github.com/mehcode/config-rs/pull/413
2023-01-24 15:06:12 +09:00
Yuya Nishihara
3b09635f46 cli: rename config/git.toml to misc.toml to add some more random stuff
I could add a file per section, but each file would just contain one or two
lines.
2023-01-24 15:06:12 +09:00
Samuel Tardieu
2832d7c739 config: allow configuration of git remotes for fetch and push operations
The `git.fetch` and `git.push` keys can be used in the configuration file
for the default to use in `jj git fetch` and `jj git push` operations.

By defaut, "origin" is used in both cases.
2023-01-17 19:04:11 +01:00
Ilya Grigoriev
24ccd80a5c Fix issues with bright color themes
Fixes https://github.com/martinvonz/jj/issues/528 by changing bright yellow
to yellow.

Also, stop using `white` or `bright white` which are hardly visible on bright
themes.

Before (actually before the parent commit):

https://user-images.githubusercontent.com/4123047/212564102-f6e98635-9bde-4392-8b69-5571fdb1303a.png

After:

https://user-images.githubusercontent.com/4123047/212562387-b89a412e-8689-4bdd-9b25-3f5df1a7d31f.png
2023-01-15 22:00:53 -08:00
Ilya Grigoriev
e9e2853ad5 Change (empty) marker from yellow to green
Follows up on  2ccee5456. Not a major change, looks a little more orthogonal
and clear.
2023-01-15 22:00:53 -08:00
Samuel Tardieu
3d870068c2 log: add (empty) in front of an empty commit description 2023-01-14 16:00:42 +01:00
Martin von Zweigbergk
2a9c37a693 formatter: remove hack for making bright colors bold
We can now configure the working-copy commit and the head operation to
use bold font, so we no longer need the hack to make bright colors
bold.
2023-01-13 21:47:50 -08:00
Ilya Grigoriev
8093bc0614 jj log: Replace divergent label with ?? and red color
This follows up on a [discussion] in a previous PR #941.

[discussion]: https://github.com/martinvonz/jj/pull/941#issuecomment-1363551162

Screenshot: https://user-images.githubusercontent.com/4123047/209286340-bb83df2d-4020-4608-9755-d965477799c3.png
2023-01-09 22:44:45 -08:00
Martin von Zweigbergk
0a29ef841f colors: simplify now that we have auto-labeling of methods 2023-01-08 23:01:53 -08:00
Ilya Grigoriev
fc9795e902 jj resolve --list: make output colorful
The description is usually in yellow, which looks nice and neutral. If the
conflict has more than 2 sides or has special files, that's marked in red.
2023-01-07 15:29:19 -08:00
Martin von Zweigbergk
5cb3807b26 colors: move defaults from source to file 2022-12-24 07:07:37 -08:00
Martin von Zweigbergk
462f696e4e config: add a README to explain that the config files are not installed 2022-12-24 07:07:37 -08:00
Martin von Zweigbergk
b22a6db7e7 config: move default merge-tool config into config/ directory
I'm about to add more default configs, so it will be good to collect
them in one directory.
2022-12-24 07:07:37 -08:00