1247 Commits

Author SHA1 Message Date
Yuya Nishihara
902ef9fce3 diff: fix inconsistent handling of "short" format arguments
All "short" formats should be able to be combined with -p/--patch. It was also
weird that "short" diff stats followed "long" color-words/git diffs.

Fixes #5986
2025-03-12 04:32:01 +00:00
Ilya Grigoriev
2f97d4a3d8 cli clone and init: remove unhelpful parts of clap error
We could replace clap's "SuggestedSubcommand" instead of removing it,
but then the user might not notice that this is a custom suggestion and
not pay enough attention to it.

This uses the just-released https://github.com/clap-rs/clap/pull/5941.
2025-03-12 04:02:52 +00:00
Ilya Grigoriev
2bb8775c44 cli clone and init: color test for the error message
There are alternative ways to solving the problem addressed by the next
commit, but they don't seem to preserve color well. So, let's have a
test to make sure future refactorings can tell whether this issue is
still relevant.
2025-03-12 04:02:52 +00:00
Ilya Grigoriev
c38e316a91 cli op diff: show changes to the working copy positions
I find this useful for debugging what happened sometimes,
e.g. after some concurrent operations mess.
2025-03-12 03:41:27 +00:00
Ilya Grigoriev
7d7a2fa390 cli string patterns: explain case-insensitive string prefixes
Before reading the docs, my instinct was to try `iglob:` instead of the
correct `glob-i:`.
2025-03-12 03:09:03 +00:00
Yuya Nishihara
e054a291b1 git: use translated remote symbols in import_refs()
This removes the special case for RefName::LocalBranch(_), which can be
processed as a remote bookmark.

"jj git import" now prints local bookmarks and tags with @git suffix. I think
this is more correct since these refs are imported from the backing Git
repository.
2025-03-12 02:20:00 +00:00
Yuya Nishihara
d8ae6dc8c9 tests: port test_bookmark_command.rs to TestWorkDir API 2025-03-12 02:18:56 +00:00
Yuya Nishihara
8fc6dea310 tests: port test_backout_command.rs to TestWorkDir API 2025-03-12 02:18:56 +00:00
Yuya Nishihara
b87a50783d tests: port test_alias.rs to TestWorkDir API 2025-03-12 02:18:56 +00:00
Yuya Nishihara
a68620a803 tests: port test_advance_bookmarks.rs to TestWorkDir API 2025-03-12 02:18:56 +00:00
Yuya Nishihara
76e9342bbb tests: port test_acls.rs to TestWorkDir API 2025-03-12 02:18:56 +00:00
Yuya Nishihara
d5d4c7fe79 tests: port test_absorb_command.rs to TestWorkDir API, add read_file() helper
read_file() returns BString as it implements Display.
2025-03-12 02:18:56 +00:00
Martin von Zweigbergk
dc7216d73a cli: diff: support multiple revisions to -r 2025-03-11 06:27:51 +00:00
Emily
185a09b9ca git: add test for Git state clean‐up 2025-03-11 03:09:13 +00:00
Ilya Grigoriev
09426ac222 cli fileset errors: insert link to docs 2025-03-11 03:00:58 +00:00
Emily
fe9e71b90e git: remove .gitmodules parsing code
This is redundant with `gix`’s native API and not used by anything
but a hidden debugging command.
2025-03-11 02:37:13 +00:00
Yuya Nishihara
1a8d2f5195 tests: use TestWorkDir in test_abandon_command.rs 2025-03-11 01:23:13 +00:00
Yuya Nishihara
e802c4b8fe tests: move current_operation_id() to TestWorkDir 2025-03-11 01:23:13 +00:00
Yuya Nishihara
61a449554b tests: pass &TestWorkDir to create_commit*() helper
Callers will be ported to TestWorkDir API separately.
2025-03-11 01:23:13 +00:00
Jo Liss
4e3f43c261 docs: explain that jj root is synonymous with jj workspace root 2025-03-10 21:44:06 +00:00
Emily
eeb34146ca tests: remove libgit2 test performance hack
I think we should only initialize the library for the fetch/push
tests now, so it should be okay to drop this.
2025-03-10 15:08:08 +00:00
Caleb White
072af8448f cli: bookmark move: allow short aliases for --to/--from
If `--to` is going to become a required argument, it should
have a short alias as it will be used quite frequently.

Given that `--to` has a short alias it only makes sense to
allow `-f` for `--from` as this is consistent with other
commands and nothing makes this particular command special.
2025-03-10 13:02:08 +00:00
Yuya Nishihara
16028245d6 tests: add workspace test helper, use it in test_global_opts.rs
It's super common to pair test_env with repo_path.

Some of the tests still use absolute paths because it seemed rather confusing
to mix paths relative to the repo_root and to the env_root.
2025-03-10 07:50:18 +00:00
Yuya Nishihara
c0066083ad git: make import of refs/remotes/git/* non-error, warn failed refs instead
I'm going to reimplement git_ref_filter to process translated remote bookmark
names, and "git" remote will mean the local Git-tracking remote there. The
reserved remote name is checked prior to filtering because refs in that remote
cannot be represented as remote symbols.

I originally implemented the error handling the other way because we didn't
have a machinery to report partial import failure. Now we have stats, it's
easy to report skipped ref names.
2025-03-10 02:04:33 +00:00
Emily
8297938feb git: port remote management to gix 2025-03-09 21:17:10 +00:00
Emily
09f6cafa2b git: add remote management tests 2025-03-09 21:17:10 +00:00
Martin von Zweigbergk
0055cd4e0b cli tests: move create_commit() tests helpers to common/ 2025-03-09 00:44:25 +00:00
Martin von Zweigbergk
169c131902 test_git_fetch: move clarification of description to template
I'm about to move the `create_commit()` helper to a common
place. However, this version of `create_commit()` is different from
the others in that it put a prefix of "descr_for_" in the
description. This patch removes that and instead updates the template
so it's still clear what's a description and what's a bookmark name.
2025-03-09 00:44:25 +00:00
Ilya Grigoriev
7b38f82b3f cli op log: short -d alias for --op-diff
`--op-diff` is often more useful than `-p`/`--patch`.
2025-03-08 06:49:34 +00:00
Yuya Nishihara
df3c15a030 revset: remove support for multiple files() arguments
Since there are no revset functions that require at least N arguments, the
error message test is moved to test_templater.rs.
2025-03-08 00:54:28 +00:00
Yuya Nishihara
54868877d6 revset, templater: remove deprecated "branches" aliases 2025-03-08 00:54:28 +00:00
George Christou
ad39c97d04 cli: remove untrack subcommand 2025-03-07 11:00:08 +00:00
Yuya Nishihara
dfb10cab9b git: reject reserved remote name early in fetch() function
I'm going to make git::import_refs() not fail because of a real remote named
"git", but fetching from such remote should be an error.
2025-03-07 03:03:45 +00:00
Yuya Nishihara
b2fd1a002e git: extract helper to check unsupported remote name 2025-03-07 03:03:45 +00:00
George Christou
5eb3c5b658 cli: remove unsquash subcommand 2025-03-07 01:46:19 +00:00
Ilya Grigoriev
5eae2d92a0 tests: run insta --force-update-snapshots
This is a replacement for #5558.

Thanks to @yuja 's https://github.com/mitsuhiko/insta/pull/722, this is
now easy to generate.
2025-03-06 21:35:08 +00:00
George Christou
693be6cc02 config: remove support for git.push-branch-prefix 2025-03-06 11:47:01 +00:00
Jonathan Gilchrist
742bc8af1c config: Allow hiding the 'how to resolve conflicts' hint
This only deals with a single hint for now to resolve any discussions
around naming and approach.
2025-03-06 10:49:54 +00:00
George Christou
b7f7d923bd config: rename core.watchman.register_snapshot_trigger 2025-03-06 08:42:35 +00:00
Ilya Grigoriev
1449c2d040 debug init-local: remove the ui.allow-init-native option
It is not needed to gate `jj debug init-local` on an option now that the
command is no longer called `jj init`.

This also includes a separate fixup to #5845 in demos/
2025-03-05 05:52:02 +00:00
Baltasar Dinis
4c5800ac4a cli/tests: port test_git_clone to gitoxide 2025-03-05 05:39:19 +00:00
Baltasar Dinis
09d92e8278 cli/tests: port test_git_fetch to gitoxide 2025-03-05 05:39:19 +00:00
Baltasar Dinis
876262a41b cli/tests: have clone helper take in a remote name
This is relevant for the git_fetch tests
2025-03-05 05:39:19 +00:00
Baltasar Dinis
a19787d2d4 cli/tests: port test_git_push to gitoxide 2025-03-05 05:39:19 +00:00
Baltasar Dinis
c2a92fce37 cli/tests: port test_git_remotes to gitoxide 2025-03-05 05:39:19 +00:00
Yuya Nishihara
4de95ac2f5 cli: reimplement "jj revert" stub as error hint
We might rename "jj backout" to "jj revert", but until then, user can add alias
as they want.

Closes #5335
Closes #5701
2025-03-05 05:22:51 +00:00
Ilya Grigoriev
d446a85c4a cli: make init and clone print a friendly error but be overridable with aliases
The main goal here is so that a completely new user that types in `jj
init` or `jj clone` gets a pointer to the correct command needed to try
out `jj`.
2025-03-05 02:53:48 +00:00
Ilya Grigoriev
22bc271a7b cli: move jj init to jj debug init-local
We could also incorporate parts of #5827 later.
2025-03-05 02:53:48 +00:00
Ilya Grigoriev
8bd7d3daea test_global_opts: use the Git backend
Follows up on #5875
2025-03-05 02:53:48 +00:00
Martin von Zweigbergk
88157c32b9 tests: avoid using the local backend
Now that we depend on the `git` executable being available for `jj git
fetch/push` tests, we might as well use it for `jj util gc` tests
too.

I also switched to using the Git backend in
`cli/tests/test_file_track_untrack_commands.rs`, which seemed to be
using the local backend for no good reason.
2025-03-04 22:12:17 +00:00