Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render synthetic nodes in jj log by default #3261

Merged
merged 2 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

* Graph node symbols are now configurable via `ui.graph.default_node` and `ui.graph.elided_node`.

* `jj log` now includes synthetic nodes in the graph where some revisions were
elided.

* `jj squash` now accepts `--from` and `--into` (mutually exclusive with `-r`).
It can thereby be for all use cases where `jj move` can be used.

Expand Down
11 changes: 9 additions & 2 deletions cli/src/commands/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,21 @@ use crate::diff_util::{self, DiffFormatArgs};
use crate::graphlog::{get_graphlog, Edge};
use crate::ui::Ui;

/// Show commit history
/// Show revision history
///
/// Renders a graphical view of the project's history, ordered with children
/// before parents. By default, the output only includes mutable revisions,
/// along with some additional revisions for context.
///
/// Spans of revisions that are not included in the graph per `--revisions` are
/// rendered as a synthetic node labeled "(elided revisions)".
#[derive(clap::Args, Clone, Debug)]
pub(crate) struct LogArgs {
/// Which revisions to show. Defaults to the `revsets.log` setting, or
/// `@ | ancestors(immutable_heads().., 2) | trunk()` if it is not set.
#[arg(long, short)]
revisions: Vec<RevisionArg>,
/// Show commits modifying the given paths
/// Show revisions modifying the given paths
#[arg(value_hint = clap::ValueHint::AnyPath)]
paths: Vec<String>,
/// Show revisions in the opposite order (older revisions first)
Expand Down
2 changes: 1 addition & 1 deletion cli/src/config-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
"log-synthetic-elided-nodes": {
"type": "boolean",
"description": "Whether to render elided parts of the graph as synthetic nodes.",
"default": false
"default": true
},
"editor": {
"type": "string",
Expand Down
2 changes: 1 addition & 1 deletion cli/src/config/misc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ diff-instructions = true
paginate = "auto"
pager = { command = ["less", "-FRX"], env = { LESSCHARSET = "utf-8" } }
log-word-wrap = false
log-synthetic-elided-nodes = false
log-synthetic-elided-nodes = true

[snapshot]
max-new-file-size = "1MiB"
10 changes: 7 additions & 3 deletions cli/tests/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ To get started, see the tutorial at https://github.com/martinvonz/jj/blob/main/d
* `git` — Commands for working with the underlying Git repo
* `init` — Create a new repo in the given directory
* `interdiff` — Compare the changes of two commits
* `log` — Show commit history
* `log` — Show revision history
* `move` — Move changes from one revision into another
* `new` — Create a new, empty change and (by default) edit it in the working copy
* `next` — Move the current working copy commit to the next child revision in the
Expand Down Expand Up @@ -1010,13 +1010,17 @@ This excludes changes from other commits by temporarily rebasing `--from` onto `

## `jj log`

Show commit history
Show revision history

Renders a graphical view of the project's history, ordered with children before parents. By default, the output only includes mutable revisions, along with some additional revisions for context.

Spans of revisions that are not included in the graph per `--revisions` are rendered as a synthetic node labeled "(elided revisions)".

**Usage:** `jj log [OPTIONS] [PATHS]...`

###### **Arguments:**

* `<PATHS>` — Show commits modifying the given paths
* `<PATHS>` — Show revisions modifying the given paths

###### **Options:**

Expand Down
1 change: 1 addition & 0 deletions cli/tests/test_log_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1356,6 +1356,7 @@ fn test_elided() {

// Elide some commits from each side of the merge. It's unclear that a revision
// was skipped on the left side.
test_env.add_config("ui.log-synthetic-elided-nodes = false");
insta::assert_snapshot!(get_log("@ | @- | description(initial)"), @r###"
@ merge
├─╮
Expand Down