2527 Commits

Author SHA1 Message Date
Martin von Zweigbergk
5d7ab9be6b git: also test how we set the index flags
I'm about to set the intent-to-add flag for newly added files. It's
also somewhat useful to see the index flags for conflict stages (the
different stages).
2025-03-25 13:40:13 +00:00
Benjamin Tan
60ce0b87d8 cli: git: add git root command
This was discussed briefly in [1], and makes it easier to execute
scripts which require a reference to the Git directory.

[1]: https://github.com/jj-vcs/jj/discussions/5767#discussioncomment-12480764
2025-03-25 08:58:43 +00:00
Martin von Zweigbergk
e392448288 time_util: replace use of chrono-english by interim
https://rustsec.org/advisories/RUSTSEC-2024-0395 recommends switching
from `chrono-english` to `interim` because the former is unmaintained.
2025-03-24 23:59:21 +00:00
Baltasar Dinis
f4d89fb6df cli/tests: add a filter to remove trailing whitespace in test_git_push_rejected_by_remove
The git remote sideband adds a dummy suffix of 8 spaces to attempt to clear
any leftover data. This is done to help with cases where the line is
rewritten.

However, a common option in a lot of editors removes trailing whitespace.
This means that anyone with that option that opens this file would make the
following snapshot fail. Using the insta filter here normalizes the
output.
2025-03-24 21:49:20 +00:00
Evan Mesterhazy
6ba5a76f51 cli split: Rename "siblings" test to "parallel"
The name of the flag was changed from --siblings to --parallel a while back,
but the tests weren't renamed.

#cleanup
2025-03-24 14:42:40 +00:00
Evan Mesterhazy
bb78c06d76 cli split: Add a simple split with descendants test
We have this test for split --parallel, but we don't actually have a
non-parallel split test where the target commit has descendants.
2025-03-24 14:42:06 +00:00
Evan Mesterhazy
b627924828 cli split: Explain how the diff script works in test_split_interactive_with_paths
It wasn't immediately obvious to me what was happening here, but once I
understood it it seemed pretty simple. Perhaps it's worth a comment to explain
it to the next reader.
2025-03-24 13:58:21 +00:00
Yuya Nishihara
5ee1dbbd22 git: wrap list of failed exports in struct
I have no immediate plan, but I think we can make "jj git export" show exported
refs. The FailedRefExport type is replaced with a plain tuple since we have a
named type wrapping (symbol, reason) pairs now.
2025-03-24 01:18:24 +00:00
Yuya Nishihara
7404338362 git: replace remaining caller of old parse_git_ref() 2025-03-23 11:02:49 +00:00
Yuya Nishihara
b6419ca790 git: in import_refs(), split known remote bookmarks/tags maps
It's simpler, and more consistent with export_refs().
2025-03-23 01:32:29 +00:00
Yuya Nishihara
7d59d0564e git: use translated remote symbols in export_refs()
I also made to_git_ref_name() stricter as it seemed odd that empty tag name and
remote name were allowed.
2025-03-23 01:32:29 +00:00
Yuya Nishihara
5ae63a2355 tests: port test_gitignores.rs to TestWorkDir API 2025-03-23 01:31:28 +00:00
Yuya Nishihara
0d8aeee3e5 tests: port test_git_remotes.rs to TestWorkDir API 2025-03-23 01:31:28 +00:00
Yuya Nishihara
d5226aad0a tests: port test_git_push.rs to TestWorkDir API 2025-03-23 01:31:28 +00:00
Yuya Nishihara
b80e5e07b8 tests: port test_git_private_commits.rs to TestWorkDir API 2025-03-23 01:31:28 +00:00
Yuya Nishihara
1466bce13c tests: move instantiation out of set_up() in test_git_{private_commits,push}.rs
set_up() doesn't have to create TestEnvironment by itself, and the local
TestWorkDir will borrow &test_env.
2025-03-23 01:31:28 +00:00
Yuya Nishihara
7583b9108e tests: port test_git_init.rs to TestWorkDir API 2025-03-23 01:31:28 +00:00
Yuya Nishihara
c2f2461b5f cli: truncate list of newly conflicted commits
If there are hundreds of new conflict commits, the user wouldn't want to see all
of them.
2025-03-23 01:31:22 +00:00
Yuya Nishihara
00c2d15f29 cli: do not print commit summary for previously-conflicted commits
I usually don't read these messages carefully, and the red "(conflict)" label
looked scary. Suppose we don't have to take further action on resolved commits,
I don't think we need to print commit summary for each resolved commit.
2025-03-23 01:31:22 +00:00
Yuya Nishihara
e52ddda98f conflicts: pack MaterializedTreeValue::File fields, use read_all() helper
This pattern is common.
2025-03-23 01:31:15 +00:00
Yuya Nishihara
9a615b5b62 config: relax bare string rule to accept middle apostrophes, etc.
Closes #5748
2025-03-22 09:00:44 +00:00
Caleb White
caf172f651 templates: create builtin_draft_commit_description template
This moves the default template to `builtin_draft_commit_description` and
points `draft_commit_description` to it. This makes it easier to override
the template while still being able to refer to the default.
2025-03-22 02:06:10 +00:00
Yuya Nishihara
ca616fade2 tests: port test_git_import_export.rs to TestWorkDir API 2025-03-21 01:19:20 +00:00
Yuya Nishihara
569a405cea tests: port test_git_fetch.rs to TestWorkDir API 2025-03-21 01:19:20 +00:00
Yuya Nishihara
64f8661f0f tests: port test_git_colocated.rs to TestWorkDir API 2025-03-21 01:19:20 +00:00
Yuya Nishihara
a36bf18a57 tests: port test_git_clone.rs to TestWorkDir API
In test_git_clone.rs, it's common to execute "jj git clone" or do file operation
at the root directory. This patch adds root_dir: &TestWorkDir references for
that reason. We might want to somehow merge root_dir and test_env later.
2025-03-21 01:19:20 +00:00
Caleb White
680c41c30f signing: add gpgsm backend
The adds support for PKCS#12 certificates through the `gpgsm` backend.

Closes #5856
2025-03-20 17:01:39 +00:00
Yuya Nishihara
9f867b6fac tests: port test_fix_command.rs to TestWorkDir API 2025-03-19 14:52:52 +00:00
Yuya Nishihara
602799afae tests: inline init_with_fake_formatter() to callers 2025-03-19 14:52:52 +00:00
Yuya Nishihara
5647113cbd tests: extract helper that configures fake "fix" formatter 2025-03-19 14:52:52 +00:00
Yuya Nishihara
1769b14995 tests: port test_file_track_untrack_commands.rs to TestWorkDir API 2025-03-19 14:52:52 +00:00
Yuya Nishihara
6f31ba9042 cli: git-push: use RemoteRefSymbol to format and pass name@remote around
This ensures that remote symbols are printed with quoting as needed. Local
bookmark names aren't quoted, which will be fixed separately by introducing
RefName(str) newtype.
2025-03-19 14:28:56 +00:00
Yuya Nishihara
8ae605703e cli: git-push: rename bookmark name/remote variables, bind reference
I'm going to replace (name, remote) pair with RemoteRefSymbol. The underlying
name types will also be changed to RefName/RemoteName newtypes.
2025-03-19 14:28:56 +00:00
Yuya Nishihara
f37f927bc2 cli: abandon: remove --summary flag, just print elided list
AFAICT, this option was needed when we're going to abandon hundreds of commits.
However, I typically notice that I had to use --summary to suppress the output
after the fact. Since the list is now truncated up to 10 commits, I don't think
the --summary flag is useful anymore. This patch also removes the special case
for 1 item, which existed primarily for overriding --summary.
2025-03-19 05:32:26 +00:00
Yuya Nishihara
976f3585e1 cli: truncate list of abandoned/created/updated commits
The choice of the upper limit is arbitrary. We use 5 in "multiple revisions"
error, but I feel 5 would be too small for "jj absorb", where the stack of
mutable commits may be ~10, but wouldn't likely be ~100s.
2025-03-19 05:32:26 +00:00
Yuya Nishihara
f07203cb3b cli: extract helper that prints list of indented commit summary 2025-03-19 05:32:26 +00:00
Yuya Nishihara
3b083f914c tests: port test_file_show_command.rs to TestWorkDir API 2025-03-19 01:47:00 +00:00
Yuya Nishihara
9e04e60594 tests: port test_file_chmod_command.rs to TestWorkDir API 2025-03-19 01:47:00 +00:00
Yuya Nishihara
ae5e717d4e tests: port test_file_annotate_command.rs to TestWorkDir API 2025-03-19 01:47:00 +00:00
Yuya Nishihara
bf53953c46 tests: port test_evolog_command.rs to TestWorkDir API 2025-03-19 01:47:00 +00:00
Yuya Nishihara
4f192d0162 tests: port test_edit_command.rs to TestWorkDir API 2025-03-19 01:47:00 +00:00
Yuya Nishihara
082602f2da tests: port test_duplicate_command.rs to TestWorkDir API 2025-03-19 01:47:00 +00:00
Yuya Nishihara
322c9951cf ui: do not pass empty choice input to parse function
Since prompt_choice_with() is now public, it should handle the default value
more consistently. parse() shouldn't be a function that can potentially feed a
default value.

We no longer print "unrecognized response" on empty input. I think this is
correct because an empty input is noop.
2025-03-18 15:43:43 +00:00
Yuya Nishihara
c2c2196b14 cli: split name/email not configured message to warning and hint
We usually print a short error message plus detailed hints.
2025-03-18 14:35:54 +00:00
Yuya Nishihara
b9e88be191 cli: extract common formatting function for updated working-copy stats
It's not important to print the parent commits on update-stale, but there should
be no reason to deviate the output formatting.
2025-03-18 14:35:54 +00:00
Yuya Nishihara
ccf927e1d8 cli: pass CheckoutStats to "print" function by reference 2025-03-18 14:35:54 +00:00
Yuya Nishihara
1a4d8dbbf4 ui: reimplement prompt_yes_no() by using prompt_choice_with()
It was odd that uppercase "Y"/"N" wasn't accepted.
2025-03-18 11:17:34 +00:00
Yuya Nishihara
083292d198 ui: extract prompt_choice_with(..callback)
I think "jj next/prev" prompt can also support selection by change ID prefix.
Maybe we can also add ui.prompt_choice_range(prompt, range, default) if that's
common?
2025-03-18 11:17:34 +00:00
Ilya Grigoriev
2a4b2dedf0 simple backend: document the lack of fetching and pushing
This is barely worth doing, but since I did it once...

I feel that some people might treat the simple backend as an easter egg, and
this will help them know what to expect.
2025-03-18 06:38:18 +00:00
Ilya Grigoriev
659325f9c3 cli git fetch: stop tracing the arguments of the outer function
The important arguments are traced in the inner function.

Previously:

```
2025-03-18T05:01:44.714692Z DEBUG run_command:cmd_git_fetch{args=GitFetchArgs { branch: [Exact("main"), Exact("master"), Glob(GlobPattern("gh-readonly-queue*")), Glob(GlobPattern("ig/*"))], remotes: [Exact("upstream")], all_remotes: false }}:fetch{remote_name="upstream" branch_names=[Exact("main"), Exact("master"), Glob(GlobPattern("gh-readonly-queue*")), Glob(GlobPattern("ig/*"))] depth=None}: jj_lib::git_subprocess: spawning a git subprocess cmd=LC_ALL="C" "git" "--git-dir" "/Users/ilyagr/dev/jj/.git" "branch" "--remotes" "--delete" "--" "upstream/master"
```

Now:

```
2025-03-18T05:06:29.573444Z DEBUG run_command:cmd_git_fetch:fetch{remote_name="upstream" branch_names=[Exact("main"), Exact("master"), Glob(GlobPattern("gh-readonly-queue*")), Glob(GlobPattern("ig/*"))] depth=None}: jj_lib::git_subprocess: spawning a git subprocess cmd=LC_ALL="C" "git" "--git-dir" "/Users/ilyagr/dev/jj/.git" "branch" "--remotes" "--delete" "--" "upstream/master"
```
2025-03-18 06:02:05 +00:00