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: add global option to not commit transaction #4457

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

martinvonz
Copy link
Owner

@martinvonz martinvonz commented Sep 13, 2024

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added tests to cover my changes

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
self.env
.command
.maybe_commit_transaction(tx, "import git head"),
);
locked_ws.finish(self.user_repo.repo.op_id().clone())?;
Copy link
Collaborator

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));
Copy link
Collaborator

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
Copy link
Collaborator

@ilyagr ilyagr Sep 14, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants