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

177 commits

Author SHA1 Message Date
Ilya Grigoriev
863f1760f9 log template: make root commit green instead of bright green
Bright green really pops on my screen, and I don't think there is a reason
for the root commit to be attention-grabbing.

This follows up on https://github.com/martinvonz/jj/pull/2084.
2023-08-16 17:26:36 -07:00
Yuya Nishihara
81f1ae38b3 revset: add literal:"string" pattern syntax
The syntax is slightly different from Mercurial. In Mercurial, a pattern must
be quoted like "<kind>:<needle>". In JJ, <kind> is a separate parsing node, and
it must not appear in a quoted string. This allows us to report unknown prefix
as an error.

There's another subtle behavior difference. In Mercurial, branch(unknown) is
an error, whereas our branches(literal:unknown) is resolved to an empty set.
I think erroring out doesn't make sense for JJ since branches() by default
performs substring matching, so its behavior is more like a filter.

The parser abuses DAG range syntax for now. It can be rewritten once we remove
the deprecated x:y range syntax.
2023-08-17 07:42:12 +09:00
Benjamin Brittain
313670d3c2 Fixed missing quote in "jj config set" help 2023-08-16 14:57:48 -04:00
Martin von Zweigbergk
873634a80e cli: when splitting change without description, skip it on second part
One use case for `jj split` is when creating a new commit from some of
the changes in the working copy. If there's no description on the
working-copy commit in that case, it seems better to not ask the user
to provide one when they're splitting the commit either.
2023-08-15 10:12:12 -07:00
Vamsi Avula
088cc787b8 cli: respect ui.default-description in split as well
#2062 missed this. Partially addresses #1354.
2023-08-15 21:25:50 +05:30
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
Yuya Nishihara
6286cde543 index: import commits in chronological order
This basically means that heads in a filtered graph appear in reverse
chronological order. Before, "jj log -r 'tags()'" in linux-stable repo would
look randomly sorted once you ran "jj debug reindex" in it.

With this change, indexing is more like breadth-first search, and BFS is
known to be bad at rendering nice graph (because branches run in parallel.)
However, we have a post process to group topological branches, so we don't
have this problem. For serialization formats like Mercurial's revlog iirc,
BFS leads to bad compression ratio, but our index isn't that kind of data.

Reindexing gets slightly slower, but I think this is negligible.

  (in Git repository)
  % hyperfine --warmup 3 --runs 10 "jj debug reindex --ignore-working-copy"
  (original)
  Time (mean ± σ):      1.521 s ±  0.027 s    [User: 1.307 s, System: 0.211 s]
  Range (min … max):    1.486 s …  1.573 s    10 runs
  (new)
  Time (mean ± σ):      1.568 s ±  0.027 s    [User: 1.368 s, System: 0.197 s]
  Range (min … max):    1.531 s …  1.625 s    10 runs

Another idea is to sort heads chronologically and run DFS-based topological
sorting. It's ad-hoc, but worked surprisingly well for my local repositories.
For repositories with lots of long-running branches, this commit will provide
more predictable result than DFS-based one.
2023-08-15 15:03:45 +09:00
Martin von Zweigbergk
f1b817e8ca cleanup: fix warnings from nightly clippy 2023-08-14 22:11:56 -07:00
Martin von Zweigbergk
a80259c7d3 cli: say that jj chmod errors out if there are any non-file sides
`jj chmod` won't operate on conflicts involving non-files on the
positive sides. However, the error message says "None of the sides of
the conflict are files", which is not correct.
2023-08-14 18:15:34 -07:00
Martin von Zweigbergk
af145e8ea5 cli: include hint when push is not fast-forward 2023-08-14 07:31:13 -07:00
Vamsi Avula
bc57754c58 cli: add support for setting default description
That is, jj will use ui.default_description as a starting point when
user is about to describe an empty change.

I think it might be confusing to do this with -m / --stdin (violates
WYSIWYG), so I'm only doing this when jj invokes an editor.

Also, this could evolve into a proper template in the future instead of
just plain text, to allow inheriting from parent change(s), for example.

Partially addresses #1354.
2023-08-13 23:59:15 +05:30
Vamsi Avula
b8cc6fc3c8 cli: trim the description from editor before using it
We anyway trim the newlines eventually and this just does that eagerly
so we output the "correct" description back to stdout (on describe for
example, we'd now print the first non empty line).
2023-08-13 15:47:16 +05:30
Zachary Dremann
062f7a252b cli: Allow repeated -m options for multi-paragraph descriptions
Emulates git's behavior:
https://www.git-scm.com/docs/git-commit#Documentation/git-commit.txt--mltmsggt
2023-08-13 05:06:35 -04: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
d57237af5d cli: on "git clone --colocate", set up .git/info/exclude to ignore .jj dir 2023-08-13 06:56:44 +09:00
Yuya Nishihara
8b5ff20874 cli: discard "unborn" default branch before checking out fetched head
AFAIK, we can't make HEAD detached in an empty Git repository, so we need
to temporarily switch to the new default branch before checking out.

Fixes #2047
2023-08-13 06:44:50 +09:00
Ben Saunders
e563d60e64 Update docs and errors to use XDG config path 2023-08-11 13:21:44 -07:00
Yuya Nishihara
4c9c923258 cli: show warning if external diff generator exited with non-zero status 2023-08-11 13:47:13 +09:00
Ilya Grigoriev
6fa8a25839 cli templates: include branches in short commit description
They are shown next to the change and commit id, since they are other names the
commit can be referred by. 

The description is separated from the branches by a ` | ` when there are
branches, so that one can tell the branches from the description without color.

The result looks like this: ![image](https://github.com/martinvonz/jj/assets/4123047/a38aff7b-2b47-49e6-8461-c42e8eb535a4)
2023-08-10 20:58:40 -07:00
Yuya Nishihara
17b45d642f cli: add "--limit N" option to log-like commands
Copied from Mercurial. This isn't a revset predicate since our revset is
conceptually unordered.
2023-08-11 10:40:40 +09:00
Yuya Nishihara
b2101d15c8 cli: detect .git symlink as a colocated workspace
Maybe we could load GitBackend without resolving .git symlink, but that would
introduce more subtle bugs. Instead, we calculate the expected Git workdir path
from the canonical ".git" path.

Fixes #2011
2023-08-10 14:53:54 +09:00
Yuya Nishihara
97b6eb2684 cli: clean up .git directory if "jj git clone --colocate" failed 2023-08-10 07:18:06 +09:00
Yuya Nishihara
6625e91a4b cli: send "Failed to clean up" message to stderr 2023-08-10 07:18:06 +09:00
Yuya Nishihara
d039008db8 cli: add tests for failed "jj git clone"
Perhaps, the message "(os error 39)" isn't portable, but I don't care since
it will be fixed by later patch.
2023-08-10 07:18:06 +09:00
Ilya Grigoriev
a9e5e97025 test_git_push: Test git.push-branch-prefix config 2023-08-07 19:10:10 -07:00
Ilya Grigoriev
add867cfae test_git_push: use -c instead of --change occasionally 2023-08-07 19:10:10 -07: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