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

15 commits

Author SHA1 Message Date
Yuya Nishihara
e3c85d6ecc revset: convert root symbol to function
The idea is that we can fully eliminate special symbols that would otherwise
shadow user branches, tags, or change ID prefixes.

Closes #2095
2023-09-04 10:36:30 +09:00
Yuya Nishihara
1c7d2b9a96 cli: make diff stat calculate path length based on unicode width 2023-09-02 08:21:33 +09:00
Yuya Nishihara
643b2d4974 cli: include both ascii and non-ascii file names in diff stat test
ASCII file names can be used as reference widths.
2023-09-02 08:21:33 +09:00
Martin von Zweigbergk
b18c97aa12 cli: trim path in diff stat if it's long, to give room for stat
If the path is too long to fit on the screen, this patch makes it so
we elide the first part of it. It goes a bit further and trims it down
to ~70% of the screen, giving some room for the stat. This seems
somewhat similar to what Git does.
2023-08-31 16:26:43 -07:00
Martin von Zweigbergk
497f4a952c cli: fix indentation of two insta snapshots
`insta` ignores leading indentation (as long as it's consistent within
the snapshot), but when a test case fails and you let `cargo insta`
update it, it's going to use a specific indentation. There were a few
tests that didn't match that indentation, which could lead to
surprising diffs if the tests fail at some point.
2023-08-31 16:26:43 -07:00
Martin von Zweigbergk
5ecc95a245 cli: make diff stat determine path length in chars, not bytes 2023-08-31 16:26:43 -07:00
Martin von Zweigbergk
0493e2b50e cli: use non-ascii chars in diff stat test
This shows that there's too much padding because we pad based on
number of bytes.

I had to reduce the path names for the file names not to get too long
for my file system.
2023-08-31 16:26:43 -07:00
Martin von Zweigbergk
4377c08f83 cli: don't crash diffstat on very narrow terminals
We can still crash on terminals that are less than 4 characters wide
(maybe it doesn't matter if we do because the user can't tell the
crash report from a diffstat in such a terminal?). This patch fixes
the crash.
2023-08-31 16:26:43 -07:00
Martin von Zweigbergk
5ce4ed45de cli: allow diff stat bar to be one character longer
I think the `+ 1` here came from an old iteration of this feature
where there was a single space before each line.
2023-08-31 16:26:43 -07:00
Martin von Zweigbergk
939528122d cli: fix crash on diff stat with long path name
We would run into a panic due to "attempt to subtract with overflow"
if the path was long. This patch fixes that and adds tests showing the
current behavior when there are long paths and/or large diffs.
2023-08-31 16:26:43 -07:00
Oscar Bonilla
5bd726f77d Add jj diffs --stat option 2023-08-19 23:49:16 -07:00
Anton Bulakh
dc6e1d7dee cli: hide irrelevant information about root commit in default log templates
I've extracted the `builtin_log_root` template for users to customize the
default templates without fully overriding them, for example I would remove
the change_id/commit_id for myself - and we discussed in Discord that leaving
those makes sense for the user to be reminded/teached that the root commit has
a change id made from z's.
2023-08-15 18:54:59 +03:00
Martin von Zweigbergk
00d2d2d4fc cli: indicate empty files in default diff format
Empty files can be confusing in diff output. For example:


```
Added regular file file1:
Added regular file file2:
        1: foo
```

This commit adds an "(empty)" placeholder instead. Since it's not
colored, and doesn't have line numbers, it will hopefully not be
mistaken for a file with the contents "(empty)".
2023-08-13 01:51:43 +00:00
Yuya Nishihara
4c9c923258 cli: show warning if external diff generator exited with non-zero status 2023-08-11 13:47:13 +09:00
Martin von Zweigbergk
0075174308 tests: move tests/ under cli/ so they're run again
Thanks to @ilyagr for noticing that they should be moved.
2023-08-05 06:18:59 +00:00
Renamed from tests/test_diff_command.rs (Browse further)