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

cli: document that we create a new working-copy commit for abandoned one

When we abandon a working-copy commit, we create a new working-copy
commit on top. This behave is very useful, but it's not obvious. Let's
document it.

Thankfully, 2bbefcc338 (rewrite: default to not simplifying ancestor
merges) means that there are much fewer commands where we need to
document this behavior.
This commit is contained in:
Martin von Zweigbergk 2024-02-25 16:39:35 -08:00 committed by Martin von Zweigbergk
parent fd4acf679c
commit a976b5d482
7 changed files with 36 additions and 0 deletions

View file

@ -27,6 +27,9 @@ use crate::ui::Ui;
/// Abandon a revision, rebasing descendants onto its parent(s). The behavior is /// Abandon a revision, rebasing descendants onto its parent(s). The behavior is
/// similar to `jj restore --changes-in`; the difference is that `jj abandon` /// similar to `jj restore --changes-in`; the difference is that `jj abandon`
/// gives you a new change, while `jj restore` updates the existing change. /// gives you a new change, while `jj restore` updates the existing change.
///
/// If a working-copy commit gets abandoned, it will be given a new, empty
/// commit. This is true in general; it is not specific to this command.
#[derive(clap::Args, Clone, Debug)] #[derive(clap::Args, Clone, Debug)]
pub(crate) struct AbandonArgs { pub(crate) struct AbandonArgs {
/// The revision(s) to abandon /// The revision(s) to abandon

View file

@ -150,6 +150,9 @@ pub struct GitInitArgs {
} }
/// Fetch from a Git remote /// Fetch from a Git remote
///
/// If a working-copy commit gets abandoned, it will be given a new, empty
/// commit. This is true in general; it is not specific to this command.
#[derive(clap::Args, Clone, Debug)] #[derive(clap::Args, Clone, Debug)]
pub struct GitFetchArgs { pub struct GitFetchArgs {
/// Fetch only some of the branches /// Fetch only some of the branches
@ -233,6 +236,9 @@ pub struct GitPushArgs {
} }
/// Update repo with changes made in the underlying Git repo /// Update repo with changes made in the underlying Git repo
///
/// If a working-copy commit gets abandoned, it will be given a new, empty
/// commit. This is true in general; it is not specific to this command.
#[derive(clap::Args, Clone, Debug)] #[derive(clap::Args, Clone, Debug)]
pub struct GitImportArgs {} pub struct GitImportArgs {}

View file

@ -34,6 +34,9 @@ use crate::ui::Ui;
/// If the source became empty and both the source and destination had a /// If the source became empty and both the source and destination had a
/// non-empty description, you will be asked for the combined description. If /// non-empty description, you will be asked for the combined description. If
/// either was empty, then the other one will be used. /// either was empty, then the other one will be used.
///
/// If a working-copy commit gets abandoned, it will be given a new, empty
/// commit. This is true in general; it is not specific to this command.
#[derive(clap::Args, Clone, Debug)] #[derive(clap::Args, Clone, Debug)]
#[command(group(ArgGroup::new("to_move").args(&["from", "to"]).multiple(true).required(true)))] #[command(group(ArgGroup::new("to_move").args(&["from", "to"]).multiple(true).required(true)))]
pub(crate) struct MoveArgs { pub(crate) struct MoveArgs {

View file

@ -116,6 +116,9 @@ use crate::ui::Ui;
/// |/ |/ /// |/ |/
/// J J /// J J
/// ``` /// ```
///
/// If a working-copy commit gets abandoned, it will be given a new, empty
/// commit. This is true in general; it is not specific to this command.
#[derive(clap::Args, Clone, Debug)] #[derive(clap::Args, Clone, Debug)]
#[command(verbatim_doc_comment)] #[command(verbatim_doc_comment)]
#[command(group(ArgGroup::new("to_rebase").args(&["branch", "source", "revision"])))] #[command(group(ArgGroup::new("to_rebase").args(&["branch", "source", "revision"])))]

View file

@ -31,6 +31,9 @@ use crate::ui::Ui;
/// If the source became empty and both the source and destination had a /// If the source became empty and both the source and destination had a
/// non-empty description, you will be asked for the combined description. If /// non-empty description, you will be asked for the combined description. If
/// either was empty, then the other one will be used. /// either was empty, then the other one will be used.
///
/// If a working-copy commit gets abandoned, it will be given a new, empty
/// commit. This is true in general; it is not specific to this command.
#[derive(clap::Args, Clone, Debug)] #[derive(clap::Args, Clone, Debug)]
#[command(visible_alias = "amend")] #[command(visible_alias = "amend")]
pub(crate) struct SquashArgs { pub(crate) struct SquashArgs {

View file

@ -31,6 +31,9 @@ use crate::ui::Ui;
/// If the source became empty and both the source and destination had a /// If the source became empty and both the source and destination had a
/// non-empty description, you will be asked for the combined description. If /// non-empty description, you will be asked for the combined description. If
/// either was empty, then the other one will be used. /// either was empty, then the other one will be used.
///
/// If a working-copy commit gets abandoned, it will be given a new, empty
/// commit. This is true in general; it is not specific to this command.
#[derive(clap::Args, Clone, Debug)] #[derive(clap::Args, Clone, Debug)]
#[command(visible_alias = "unamend")] #[command(visible_alias = "unamend")]
pub(crate) struct UnsquashArgs { pub(crate) struct UnsquashArgs {

View file

@ -172,6 +172,8 @@ Abandon a revision
Abandon a revision, rebasing descendants onto its parent(s). The behavior is similar to `jj restore --changes-in`; the difference is that `jj abandon` gives you a new change, while `jj restore` updates the existing change. Abandon a revision, rebasing descendants onto its parent(s). The behavior is similar to `jj restore --changes-in`; the difference is that `jj abandon` gives you a new change, while `jj restore` updates the existing change.
If a working-copy commit gets abandoned, it will be given a new, empty commit. This is true in general; it is not specific to this command.
**Usage:** `jj abandon [OPTIONS] [REVISIONS]...` **Usage:** `jj abandon [OPTIONS] [REVISIONS]...`
###### **Arguments:** ###### **Arguments:**
@ -847,6 +849,8 @@ Create a new Git backed repo
Fetch from a Git remote Fetch from a Git remote
If a working-copy commit gets abandoned, it will be given a new, empty commit. This is true in general; it is not specific to this command.
**Usage:** `jj git fetch [OPTIONS]` **Usage:** `jj git fetch [OPTIONS]`
###### **Options:** ###### **Options:**
@ -921,6 +925,8 @@ By default, pushes any branches pointing to `remote_branches(remote=<remote>)..@
Update repo with changes made in the underlying Git repo Update repo with changes made in the underlying Git repo
If a working-copy commit gets abandoned, it will be given a new, empty commit. This is true in general; it is not specific to this command.
**Usage:** `jj git import` **Usage:** `jj git import`
@ -1056,6 +1062,8 @@ Use `--interactive` to move only part of the source revision into the destinatio
If the source became empty and both the source and destination had a non-empty description, you will be asked for the combined description. If either was empty, then the other one will be used. If the source became empty and both the source and destination had a non-empty description, you will be asked for the combined description. If either was empty, then the other one will be used.
If a working-copy commit gets abandoned, it will be given a new, empty commit. This is true in general; it is not specific to this command.
**Usage:** `jj move [OPTIONS] <--from <FROM>|--to <TO>> [PATHS]...` **Usage:** `jj move [OPTIONS] <--from <FROM>|--to <TO>> [PATHS]...`
###### **Arguments:** ###### **Arguments:**
@ -1457,6 +1465,9 @@ M L'
J J J J
``` ```
If a working-copy commit gets abandoned, it will be given a new, empty
commit. This is true in general; it is not specific to this command.
**Usage:** `jj rebase [OPTIONS] --destination <DESTINATION>` **Usage:** `jj rebase [OPTIONS] --destination <DESTINATION>`
###### **Options:** ###### **Options:**
@ -1668,6 +1679,8 @@ After moving the changes into the parent, the child revision will have the same
If the source became empty and both the source and destination had a non-empty description, you will be asked for the combined description. If either was empty, then the other one will be used. If the source became empty and both the source and destination had a non-empty description, you will be asked for the combined description. If either was empty, then the other one will be used.
If a working-copy commit gets abandoned, it will be given a new, empty commit. This is true in general; it is not specific to this command.
**Usage:** `jj squash [OPTIONS] [PATHS]...` **Usage:** `jj squash [OPTIONS] [PATHS]...`
###### **Arguments:** ###### **Arguments:**
@ -1858,6 +1871,8 @@ After moving the changes out of the parent, the child revision will have the sam
If the source became empty and both the source and destination had a non-empty description, you will be asked for the combined description. If either was empty, then the other one will be used. If the source became empty and both the source and destination had a non-empty description, you will be asked for the combined description. If either was empty, then the other one will be used.
If a working-copy commit gets abandoned, it will be given a new, empty commit. This is true in general; it is not specific to this command.
**Usage:** `jj unsquash [OPTIONS]` **Usage:** `jj unsquash [OPTIONS]`
###### **Options:** ###### **Options:**