mirror of
https://github.com/martinvonz/jj.git
synced 2024-09-11 13:56:29 +03:00
cli: make operation to undo or restore to a positional argument
I originally made the operation argument a named argument (`--operation`) to allow for a change ID to be passed as a positional argument, matching e.g. `hg revert -r <rev> <path>`. However, even if we add support for undoing changes only to certain change IDs, it's going to be done much less frequently than full undo/restore. We can therefore make that a named argument if we ever add it.
This commit is contained in:
parent
0058236a43
commit
8744015f33
@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Breaking changes
|
||||||
|
|
||||||
|
* `jj [op] undo` and `jj op restore` used to take the operation to undo or
|
||||||
|
restore to as an argument to `-o/--operation`. It is now a positional
|
||||||
|
argument instead (i.e. `jj undo -o abc123` is now written `jj undo abc123`).
|
||||||
|
|
||||||
### New features
|
### New features
|
||||||
|
|
||||||
* `jj rebase` now accepts a `--branch/-b <revision>` argument, which can be used
|
* `jj rebase` now accepts a `--branch/-b <revision>` argument, which can be used
|
||||||
|
@ -1527,7 +1527,7 @@ struct OperationLogArgs {}
|
|||||||
#[derive(clap::Args, Clone, Debug)]
|
#[derive(clap::Args, Clone, Debug)]
|
||||||
struct OperationRestoreArgs {
|
struct OperationRestoreArgs {
|
||||||
/// The operation to restore to
|
/// The operation to restore to
|
||||||
#[clap(long, alias = "op", short, default_value = "@")]
|
#[clap(default_value = "@")]
|
||||||
operation: String,
|
operation: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1535,7 +1535,7 @@ struct OperationRestoreArgs {
|
|||||||
#[derive(clap::Args, Clone, Debug)]
|
#[derive(clap::Args, Clone, Debug)]
|
||||||
struct OperationUndoArgs {
|
struct OperationUndoArgs {
|
||||||
/// The operation to undo
|
/// The operation to undo
|
||||||
#[clap(long, alias = "op", short, default_value = "@")]
|
#[clap(default_value = "@")]
|
||||||
operation: String,
|
operation: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ fn test_undo_rewrite_with_child() {
|
|||||||
o modified
|
o modified
|
||||||
o
|
o
|
||||||
"###);
|
"###);
|
||||||
test_env.jj_cmd_success(&repo_path, &["undo", "-o", &op_id_hex]);
|
test_env.jj_cmd_success(&repo_path, &["undo", &op_id_hex]);
|
||||||
|
|
||||||
// Since we undid the description-change, the child commit should now be on top
|
// Since we undid the description-change, the child commit should now be on top
|
||||||
// of the initial commit
|
// of the initial commit
|
||||||
|
Loading…
Reference in New Issue
Block a user