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

merge_tools: extract tool configuration from invocation path #3172

Merged
merged 6 commits into from
Mar 2, 2024

Conversation

yuja
Copy link
Contributor

@yuja yuja commented Mar 1, 2024

Prep for #2575.

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

Copy link
Member

@martinvonz martinvonz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the snapshot directory will be removed soon

Do you mean that you're changing how the merge tools run so we don't create the temporary working copies? For external merge tools too? Or did we create the temporary working copies for the builtin tool too?

@yuja
Copy link
Contributor Author

yuja commented Mar 2, 2024

Because the snapshot directory will be removed soon

Do you mean that you're changing how the merge tools run so we don't create the temporary working copies?

Oops, I just meant the directory is removed at the end of the function call. I'll update the commit message.

yuja added 6 commits March 2, 2024 10:20
…y snapshot

Because the snapshot directory is removed at the end of the function, it doesn't
make sense to enable watchman in it. The max_new_file_size parameter might be
somewhat useful, but it's unlikely that the temporary directory contains
gigantic node_modules tree for example. OTOH, the base_ignores matters since it
may contain common ignore patterns like *~.

This eliminates most of the UserSettings dependencies from this function.
This clarifies that the instructions text can be omitted. All callers appear to
pass non-empty instructions, though.
This gets rid of the last UserSettings dependency from edit_diff_external().
I'm going to remove it from edit_diff() too, and let callers pass a
preconfigured MergeTool struct instead.

These changes will make it easier to add --tool=<name> argument jj-vcs#2575.
I'm going to make them be loaded by caller, and these newtypes will provide
extra compile-time safety (plus nicer API to be added later.) The error types
will be cleaned up later patches.
This moves the config loading closer to CLI args where --tool=<name> option
will be processed. The factory function are proxied through the command helper
so that the base_ignores can be attached there later.
write!(ui.hint(), ..) error is suppressed because it seemed weird if the
configuration error had io::Error variant. The write error isn't important
anyway.
@yuja yuja force-pushed the push-qzxyxnsovttt branch from ebff58c to a50acea Compare March 2, 2024 01:23
@yuja yuja enabled auto-merge (rebase) March 2, 2024 01:23
@yuja yuja merged commit b926fd8 into jj-vcs:main Mar 2, 2024
16 checks passed
@yuja yuja deleted the push-qzxyxnsovttt branch March 2, 2024 01:31
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.

2 participants