2 Commits

Author SHA1 Message Date
phundrak 88c77f8ac6 docs(README): update the README to reflect new features
Run checks and build archives / coverage-and-sonar (push) Successful in 6m59s
Run checks and build archives / build (windows-x86_64) (push) Successful in 7m38s
Run checks and build archives / build (linux-aarch64) (push) Successful in 7m45s
Run checks and build archives / build (linux-x86_64) (push) Successful in 9m1s
2026-06-14 15:13:21 +02:00
phundrak 5aa382a4c9 feat: implement --new flag
The new `--new` or `-n` flag allows to create a new revision after the
single revision being described.

Running `jj-cz --new` is the equivalent of running `jj-cz --new @`,
describing the current revision and creating a new revision after it.

Passing several revisions to `jj-cz` with the `--new` flag will result
in an error.
2026-06-14 15:13:21 +02:00
2 changed files with 10 additions and 9 deletions
+4 -6
View File
@@ -300,8 +300,7 @@ mod tests {
/// Test mock new_revision() returns configured error
#[tokio::test]
async fn mock_new_revision_returns_error() {
let mock =
MockJjExecutor::new().with_new_revision_response(Err(Error::RepositoryLocked));
let mock = MockJjExecutor::new().with_new_revision_response(Err(Error::RepositoryLocked));
let result = mock.new_revision("@").await;
assert!(result.is_err());
assert!(matches!(result.unwrap_err(), Error::RepositoryLocked));
@@ -310,10 +309,9 @@ mod tests {
/// Test mock new_revision() records revset even on error
#[tokio::test]
async fn mock_new_revision_records_revset_on_error() {
let mock =
MockJjExecutor::new().with_new_revision_response(Err(Error::JjOperation {
context: "failed".to_string(),
}));
let mock = MockJjExecutor::new().with_new_revision_response(Err(Error::JjOperation {
context: "failed".to_string(),
}));
let result = mock.new_revision("abc").await;
assert!(result.is_err());
let calls = mock.new_revision_calls();
+6 -3
View File
@@ -783,8 +783,8 @@ mod tests {
/// Test workflow new_revision() propagates executor errors
#[tokio::test]
async fn workflow_new_revision_propagates_error() {
let mock_executor = MockJjExecutor::new()
.with_new_revision_response(Err(Error::RepositoryLocked));
let mock_executor =
MockJjExecutor::new().with_new_revision_response(Err(Error::RepositoryLocked));
let workflow = CommitWorkflow::new(mock_executor);
let result = workflow.new_revision("@").await;
@@ -809,7 +809,10 @@ mod tests {
let workflow = CommitWorkflow::with_prompts(mock_executor, mock_prompts);
workflow.run_for_revset("@").await.expect("describe failed");
workflow.new_revision("@").await.expect("new_revision failed");
workflow
.new_revision("@")
.await
.expect("new_revision failed");
let messages = workflow.executor.describe_messages();
assert_eq!(messages.len(), 1);