Commit graph

16 commits

Author SHA1 Message Date
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
Ilya Grigoriev
d591b6776d cli templates: include change id and more in short commit description
Include change id as well as (empty) and (conflict) markers in short commit
description.

Unlike `jj log`,

* (conflict) is put in parentheses to distinguish it from the commit
description  when the output is not colored.

* the change id is placed right before the commit id to put it into a
predicteble place, even if the short commit description takes up more than one
line. The commit id can be important for commit descriptions in commands like
`abandon`.
2023-08-02 12:14:04 -07:00
Ilya Grigoriev
e667824ad9 cli templates: change default short id length from 12 to 8
This makes including the change id into the short
commit description in the following commit look less
noisy.
2023-08-02 12:14:04 -07:00
Martin von Zweigbergk
c183b94aef cli: warn when using : revset operator 2023-07-28 22:30:40 -07:00
Yuya Nishihara
b3ae7e7657 revset_graph: preserve original parents order
It seemed awkward if merged PR is sometimes rendered as a first branch.
Instead of sorting edges in index order, let's build a HashSet only when
deduplication is needed.
2023-07-29 05:36:09 +09:00
Yuya Nishihara
a382e96168 revset_graph: place new heads as close to fork point as possible
The idea is simple. New heads are ignored until the node dependency resolution
stuck. Then, only the first head that will unblock the visit will be queued.

Closes #242
2023-07-25 01:45:37 +09:00
Yuya Nishihara
fb33620f9e revset_graph: group commits topologically
The original idea was similar to Mercurial's "topo" sorting, but it was bad
at handling merge-heavy history. In order to render merges of topic branches
nicely, we need to prioritize branches at merge point, not at fork point.
OTOH, we do also want to place unmerged branches as close to the fork point
as possible. This commit implements the former requirement, and the latter
will be addressed by the next commit.

I think this is similar to Git's sorting logic described in the following blog
post. In our case, the in-degree walk can be dumb since topological order is
guaranteed by the index. We keep HashSet<CommitId> instead of an in-degree
integer value, which will be used in the next commit to resolve new heads as
late as possible.

https://github.blog/2022-08-30-gits-database-internals-ii-commit-history-queries/#topological-sorting

Compared to Sapling's beautify_graph(), this is lazy, and can roughly preserve
the index (or chronological) order. I tried beautify_graph() with prioritizing
the @ commit, but the result seemed too aggressively reordered. Perhaps, for
more complex history, beautify_graph() would produce a better result. For my
wip branches (~30 branches, a couple of commits per branch), this works pretty
well.

#242
2023-07-25 01:45:37 +09:00
Yuya Nishihara
f8d56e816d cli: print parent commit summary on checkout
On "jj checkout", description of the working-copy commit is empty, and the
working-copy parent provides more information. It might be a bit verbose to
print parent summary on every history rewriting, but I think that's okay.
2023-05-02 15:04:13 +09:00
Ilya Grigoriev
0e2579ee6a Switch graph node to use for commit instead of
This follows up on 5c703aeb03.

The only reason for this change is that, subjectively, the result looks better to me. I'm not sure why, but I couldn't get used to the old symbol in spite of its seeming reasonableness. It felt really bold and heavy.

If people agree, we can wait until we need to update the screenshots for some other reason before merging this. Sorry I didn't figure this out while the discussion about the referenced commit was going on.

I'm not 100% certain how many fonts support each symbol. Please try it out and let me know if it doesn't work for you.

Compare after:

![image](https://user-images.githubusercontent.com/4123047/229251383-563b889d-7233-42e2-a3c5-bf9368a4d1fd.png)

and before:

![image](https://user-images.githubusercontent.com/4123047/229251695-7fd0ff2c-2832-4262-ade5-5120288cccdf.png)
2023-04-02 23:15:37 -07:00
Martin von Zweigbergk
5c703aeb03 cli: replace o as graph node by when using unicode graph
@joyously found `o` confusing because it's a valid change id prefix. I
don't have much preference, but `●` seems fine. The "ascii",
"ascii-large", and "legacy" graph styles still use "o".

I didn't change `@` since it seems useful to have that match the
symbol used on the CLI. I don't think we want to have users do
something like `jj co ◎-`.
2023-03-12 23:21:05 -07:00
Martin von Zweigbergk
a67fbb6714 cli: switch default graph style to be Sapling's curved style
We seem to quite unanimously prefer this style, so let's make the
default.
2023-02-12 07:23:29 -08:00
Ilya Grigoriev
3e7791bbc1 Make jj abandon print each abandoned commit once 2023-01-17 21:17:27 -08:00
Ilya Grigoriev
7057ce2183 Test that jj abandon root, specifying same revision twice 2023-01-17 21:17:27 -08:00
Ilya Grigoriev
c0fc9a464a jj abandon: Print every abandoned commit
This can be disabled with the new `--quiet` option.

Printing every commit would give the user all the information of how to undo
this or where to `jj restore` from if they realize they need to after the
abandon.
2023-01-11 23:32:39 -08:00
Ilya Grigoriev
6765850c7d jj abandon: Report what commit or how many commits were abandoned
There are not tests for `jj abandon`, and I haven't written any yet.
2023-01-11 23:32:39 -08:00
Ilya Grigoriev
c43f0a580a Add tests for the abandon command
I tested some hairy cases, but didn't add any simpler tests.
2023-01-11 23:32:39 -08:00