-
Notifications
You must be signed in to change notification settings - Fork 319
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: add global option to not commit transaction #4457
base: main
Are you sure you want to change the base?
Conversation
c6b2f3d
to
6f0c626
Compare
This patch adds a global `--no-commit-transaction` flag that prevents publishing of most operations, including the ones created by `snapshot_working_copy()` and `finish_transaction()`. The operations are still created as usual. We may want to follow up with a `jj op publish/commit/adopt` command for publishing an operation that was not committed. Closes #2562
6f0c626
to
762f5e0
Compare
self.env | ||
.command | ||
.maybe_commit_transaction(tx, "import git head"), | ||
); | ||
locked_ws.finish(self.user_repo.repo.op_id().clone())?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it safe to finalize working-copy modification here?
@@ -1606,10 +1633,11 @@ See https://martinvonz.github.io/jj/latest/working-copy/#stale-working-copy \ | |||
print_failed_git_export(ui, &refs)?; | |||
} | |||
|
|||
self.user_repo = ReadonlyUserRepo::new(tx.commit(description)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps, we'll also need to disable git exports because the operation is discarded. (There's another git::export_refs()
caller in snapshot_working_copy()
.)
It might make sense to split may_update_working_copy
/working_copy_shared_with_git
flags into may_snapshot
/may_update
/may_import
/may_export
, but I'm not sure if that works out.
@@ -49,6 +49,9 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | |||
|
|||
* `jj op log` gained an option to include operation diffs. | |||
|
|||
* A new global flag `--no-commit-transaction` lets you run a command without |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Non-blocking) I'm thinking of alternative names.
--no-publish-operation
might be a little better (?) than --no-commit-transaction
.
--transient-operation
? In the same vein, --disposable-operation
or --provisional-operation
(but I prefer transient). --ephemeral-operation
(thanks, thesaurus).
--dry-run
would be appropriate for many operations, but not for fetch
, push
, git export
, and such.
We can absolutely decide or change our mind later, but I like "transient" and "ephemeral", I think. All of these could go with "transaction" instead of "operation", though I slightly prefer the latter.
Checklist
If applicable:
CHANGELOG.md