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

cli: rename obslog to evolution #4146

Merged
merged 1 commit into from
Sep 5, 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 @@ -13,6 +13,9 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

### Deprecations

* `jj obslog` is now called `jj evolution-log`/`jj evolog`. `jj obslog` remains
as an alias.

### New features

### Fixed bugs
Expand Down
8 changes: 3 additions & 5 deletions cli/src/commands/obslog.rs → cli/src/commands/evolog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@ use crate::ui::Ui;
///
/// Lists the previous commits which a change has pointed to. The current commit
/// of a change evolves when the change is updated, rebased, etc.
///
/// Name is derived from Merciual's obsolescence markers.
#[derive(clap::Args, Clone, Debug)]
pub(crate) struct ObslogArgs {
pub(crate) struct EvologArgs {
#[arg(long, short, default_value = "@")]
revision: RevisionArg,
/// Limit number of revisions to show
Expand Down Expand Up @@ -74,10 +72,10 @@ pub(crate) struct ObslogArgs {
}

#[instrument(skip_all)]
pub(crate) fn cmd_obslog(
pub(crate) fn cmd_evolog(
ui: &mut Ui,
command: &CommandHelper,
args: &ObslogArgs,
args: &EvologArgs,
) -> Result<(), CommandError> {
let workspace_command = command.workspace_helper(ui)?;
let repo = workspace_command.repo().as_ref();
Expand Down
2 changes: 1 addition & 1 deletion cli/src/commands/interdiff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use crate::ui::Ui;
///
/// This excludes changes from other commits by temporarily rebasing `--from`
/// onto `--to`'s parents. If you wish to compare the same change across
/// versions, consider `jj obslog -p` instead.
/// versions, consider `jj evolog -p` instead.
#[derive(clap::Args, Clone, Debug)]
#[command(group(ArgGroup::new("to_diff").args(&["from", "to"]).multiple(true).required(true)))]
pub(crate) struct InterdiffArgs {
Expand Down
7 changes: 4 additions & 3 deletions cli/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ mod diff;
mod diffedit;
mod duplicate;
mod edit;
mod evolog;
mod file;
mod fix;
mod git;
Expand All @@ -36,7 +37,6 @@ mod merge;
mod r#move;
mod new;
mod next;
mod obslog;
mod operation;
mod parallelize;
mod prev;
Expand Down Expand Up @@ -96,6 +96,8 @@ enum Command {
Diffedit(diffedit::DiffeditArgs),
Duplicate(duplicate::DuplicateArgs),
Edit(edit::EditArgs),
#[command(alias = "obslog", visible_alias = "evolution-log")]
Evolog(evolog::EvologArgs),
martinvonz marked this conversation as resolved.
Show resolved Hide resolved
#[command(subcommand)]
File(file::FileCommand),
/// List files in a revision (DEPRECATED use `jj file list`)
Expand Down Expand Up @@ -123,7 +125,6 @@ enum Command {
Move(r#move::MoveArgs),
New(new::NewArgs),
Next(next::NextArgs),
Obslog(obslog::ObslogArgs),
#[command(subcommand)]
#[command(visible_alias = "op")]
Operation(operation::OperationCommand),
Expand Down Expand Up @@ -213,7 +214,7 @@ pub fn run_command(ui: &mut Ui, command_helper: &CommandHelper) -> Result<(), Co
Command::Move(args) => r#move::cmd_move(ui, command_helper, args),
Command::New(args) => new::cmd_new(ui, command_helper, args),
Command::Next(args) => next::cmd_next(ui, command_helper, args),
Command::Obslog(args) => obslog::cmd_obslog(ui, command_helper, args),
Command::Evolog(args) => evolog::cmd_evolog(ui, command_helper, args),
Command::Operation(args) => operation::cmd_operation(ui, command_helper, args),
Command::Parallelize(args) => parallelize::cmd_parallelize(ui, command_helper, args),
Command::Prev(args) => prev::cmd_prev(ui, command_helper, args),
Expand Down
2 changes: 1 addition & 1 deletion cli/src/commit_templater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ fn builtin_commit_methods<'repo>() -> CommitTemplateBuildMethodFnMap<'repo, Comm
function.expect_no_arguments()?;
let repo = language.repo;
let out_property = self_property.map(|commit| {
// The given commit could be hidden in e.g. obslog.
// The given commit could be hidden in e.g. `jj evolog`.
let maybe_entries = repo.resolve_change_id(commit.change_id());
maybe_entries.map_or(0, |entries| entries.len()) > 1
});
Expand Down
80 changes: 39 additions & 41 deletions cli/tests/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ This document contains the help content for the `jj` command-line program.
* [`jj diffedit`↴](#jj-diffedit)
* [`jj duplicate`↴](#jj-duplicate)
* [`jj edit`↴](#jj-edit)
* [`jj evolog`↴](#jj-evolog)
* [`jj file`↴](#jj-file)
* [`jj file chmod`↴](#jj-file-chmod)
* [`jj file list`↴](#jj-file-list)
Expand All @@ -59,7 +60,6 @@ This document contains the help content for the `jj` command-line program.
* [`jj log`↴](#jj-log)
* [`jj new`↴](#jj-new)
* [`jj next`↴](#jj-next)
* [`jj obslog`↴](#jj-obslog)
* [`jj operation`↴](#jj-operation)
* [`jj operation abandon`↴](#jj-operation-abandon)
* [`jj operation diff`↴](#jj-operation-diff)
Expand Down Expand Up @@ -120,6 +120,7 @@ To get started, see the tutorial at https://github.com/martinvonz/jj/blob/main/d
* `diffedit` — Touch up the content changes in a revision with a diff editor
* `duplicate` — Create a new change with the same content as an existing one
* `edit` — Sets the specified revision as the working-copy revision
* `evolog` — Show how a change has evolved over time
* `file` — File operations
* `fix` — Update files with formatting fixes or other changes
* `git` — Commands for working with Git remotes and the underlying Git repo
Expand All @@ -128,7 +129,6 @@ To get started, see the tutorial at https://github.com/martinvonz/jj/blob/main/d
* `log` — Show revision history
* `new` — Create a new, empty change and (by default) edit it in the working copy
* `next` — Move the working-copy commit to the child revision
* `obslog` — Show how a change has evolved over time
* `operation` — Commands for working with the operation log
* `parallelize` — Parallelize revisions by making them siblings
* `prev` — Change the working copy revision relative to the parent revision
Expand Down Expand Up @@ -692,6 +692,42 @@ For more information, see https://martinvonz.github.io/jj/latest/FAQ#how-do-i-re



## `jj evolog`

Show how a change has evolved over time

Lists the previous commits which a change has pointed to. The current commit of a change evolves when the change is updated, rebased, etc.

**Usage:** `jj evolog [OPTIONS]`

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

* `-r`, `--revision <REVISION>`

Default value: `@`
* `-n`, `--limit <LIMIT>` — Limit number of revisions to show
* `--no-graph` — Don't show the graph, show a flat list of revisions
* `-T`, `--template <TEMPLATE>` — Render each revision using the given template

For the syntax, see https://github.com/martinvonz/jj/blob/main/docs/templates.md
* `-p`, `--patch` — Show patch compared to the previous version of this change

If the previous version has different parents, it will be temporarily rebased to the parents of the new version, so the diff is not contaminated by unrelated changes.
* `-s`, `--summary` — For each path, show only whether it was modified, added, or deleted
* `--stat` — Show a histogram of the changes
* `--types` — For each path, show only its type before and after

The diff is shown as two letters. The first letter indicates the type before and the second letter indicates the type after. '-' indicates that the path was not present, 'F' represents a regular file, `L' represents a symlink, 'C' represents a conflict, and 'G' represents a Git submodule.
* `--name-only` — For each path, show only its path

Typically useful for shell commands like: `jj diff -r @- --name_only | xargs perl -pi -e's/OLD/NEW/g`
* `--git` — Show a Git-format diff
* `--color-words` — Show a word-level diff with changes indicated only by color
* `--tool <TOOL>` — Generate diff by external command
* `--context <CONTEXT>` — Number of lines of context to show



## `jj file`

File operations
Expand Down Expand Up @@ -1105,7 +1141,7 @@ If the given directory does not exist, it will be created. If no directory is gi

Compare the changes of two commits

This excludes changes from other commits by temporarily rebasing `--from` onto `--to`'s parents. If you wish to compare the same change across versions, consider `jj obslog -p` instead.
This excludes changes from other commits by temporarily rebasing `--from` onto `--to`'s parents. If you wish to compare the same change across versions, consider `jj evolog -p` instead.

**Usage:** `jj interdiff [OPTIONS] <--from <FROM>|--to <TO>> [PATHS]...`

Expand Down Expand Up @@ -1253,44 +1289,6 @@ implied.



## `jj obslog`

Show how a change has evolved over time

Lists the previous commits which a change has pointed to. The current commit of a change evolves when the change is updated, rebased, etc.

Name is derived from Merciual's obsolescence markers.

**Usage:** `jj obslog [OPTIONS]`

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

* `-r`, `--revision <REVISION>`

Default value: `@`
* `-n`, `--limit <LIMIT>` — Limit number of revisions to show
* `--no-graph` — Don't show the graph, show a flat list of revisions
* `-T`, `--template <TEMPLATE>` — Render each revision using the given template

For the syntax, see https://github.com/martinvonz/jj/blob/main/docs/templates.md
* `-p`, `--patch` — Show patch compared to the previous version of this change

If the previous version has different parents, it will be temporarily rebased to the parents of the new version, so the diff is not contaminated by unrelated changes.
* `-s`, `--summary` — For each path, show only whether it was modified, added, or deleted
* `--stat` — Show a histogram of the changes
* `--types` — For each path, show only its type before and after

The diff is shown as two letters. The first letter indicates the type before and the second letter indicates the type after. '-' indicates that the path was not present, 'F' represents a regular file, `L' represents a symlink, 'C' represents a conflict, and 'G' represents a Git submodule.
* `--name-only` — For each path, show only its path

Typically useful for shell commands like: `jj diff -r @- --name_only | xargs perl -pi -e's/OLD/NEW/g`
* `--git` — Show a Git-format diff
* `--color-words` — Show a word-level diff with changes indicated only by color
* `--tool <TOOL>` — Generate diff by external command
* `--context <CONTEXT>` — Number of lines of context to show



## `jj operation`

Commands for working with the operation log
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ mod test_diff_command;
mod test_diffedit_command;
mod test_duplicate_command;
mod test_edit_command;
mod test_evolog_command;
mod test_file_chmod_command;
mod test_file_print_command;
mod test_file_untrack_command;
Expand All @@ -50,7 +51,6 @@ mod test_log_command;
mod test_move_command;
mod test_new_command;
mod test_next_prev_commands;
mod test_obslog_command;
mod test_operations;
mod test_parallelize_command;
mod test_rebase_command;
Expand Down
10 changes: 5 additions & 5 deletions cli/tests/test_commit_template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ fn test_log_builtin_templates_colored_debug() {
}

#[test]
fn test_log_obslog_divergence() {
fn test_log_evolog_divergence() {
let test_env = TestEnvironment::default();
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
let repo_path = test_env.env_root().join("repo");
Expand Down Expand Up @@ -473,8 +473,8 @@ fn test_log_obslog_divergence() {
◆ zzzzzzzz root() 00000000
"###);

// Obslog and hidden divergent
let stdout = test_env.jj_cmd_success(&repo_path, &["obslog"]);
// Evolog and hidden divergent
let stdout = test_env.jj_cmd_success(&repo_path, &["evolog"]);
insta::assert_snapshot!(stdout, @r###"
@ qpvuntsm?? [email protected] 2001-02-03 08:05:08 ff309c29
│ description 1
Expand All @@ -484,8 +484,8 @@ fn test_log_obslog_divergence() {
(empty) (no description set)
"###);

// Colored obslog
let stdout = test_env.jj_cmd_success(&repo_path, &["obslog", "--color=always"]);
// Colored evolog
let stdout = test_env.jj_cmd_success(&repo_path, &["evolog", "--color=always"]);
insta::assert_snapshot!(stdout, @r###"
@ qpvuntsm?? [38;5;[email protected] 2001-02-03 08:05:08 ff309c29
│ description 1
Expand Down
Loading