Commit graph

1623 commits

Author SHA1 Message Date
Martin von Zweigbergk
15b0225547 tests: test attempt to create identical commits
We currently don't allow you to create two identical commits. It
results in an internal error. I think we need to allow it. Let's start
by testing the current behavior.

I created these as CLI tests because I want to make sure that `evolog`
and `op diff` get tested, including rendering.
2025-10-27 16:35:47 +00:00
Martin von Zweigbergk
284fadda3a tests: allow overriding $JJ_TIMESTAMP and $JJ_RANDOMNESS_SEED in tests
I think if a particular test sets e.g. $JJ_TIMESTAMP, they would
expect it to get used by `run_jj()` but we currently overwrite a few
variables in that method. This patch makes it so we respect all
environment added to the test environment.

I'm going to use this for a test case that attempts to create
identical commits.
2025-10-27 16:35:47 +00:00
Cole Helbling
d1d8048538 metaedit: replace --update-committer-timestamp with --force-rewrite
Some checks failed
binaries / Build binary artifacts (push) Has been cancelled
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
Just moments ago, I ran into a case where I wanted to change both the
author and committer of a change. I knew about the new `jj metaedit`
command, but until now that only gave me the ability to update the
author of my change, so the committer would remain the same. My only
other option was to reach for `jj desc ... --reset-author`, which has
a deprecation warning:

    Warning: `jj describe --reset-author` is deprecated; use `jj metaedit --update-author` instead

In spite of that warning, this had the desired effect: both the author
and committer were updated.

So I figured I'd help `metaedit` grow these flags so it can be a _true_
replacement for `jj desc --reset-author`.

---

The above all happened before I was kindly informed in Discord
(https://discord.com/channels/968932220549103686/1431315533164314674)
that `jj metaedit --update-committer-timestamp` should do what I was
hoping for, which I had initially disregarded and never tried because
the help text originally said:

    This updates the committer date to now, without modifying the committer.

However, after trying it out, I noticed it actually _did_ modify the
committer.

So, I set out to improve the situation by renaming the flag (so it's
not partially-wrong: it does update the committer timestamp, as well as
everything else about the committer) and improving the help text in the
various flags.

---

In no particular order, thanks to:

* obtuse, for informing me that the `--update-committer-timestamp`
flag does what I wanted in the first place
* gaetan, for pointing out that my way of thinking was not quite meshing
with how jj does things (every modification will update the committer)
* Martin, for the new flag name
2025-10-25 22:31:16 +00:00
David Higgs
0034daa9ac describe: ensure --stdin messages get trailing newlines
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
2025-10-24 12:05:27 +00:00
David Higgs
708baa13de tests: exercise describe revset matching no commits
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
2025-10-24 01:13:04 +00:00
David Higgs
902e9e4541 tests: exercise metaedit more with empty author/email 2025-10-24 01:13:04 +00:00
David Higgs
60d8cab25a tests: exercise metaedit --quiet 2025-10-24 01:13:04 +00:00
David Higgs
f2d27dd538 tests: exercise hidden metaedit -r option 2025-10-24 01:13:04 +00:00
David Higgs
8d06c6fcb3 tests: exercise metaedit revset matching no commits 2025-10-24 01:13:04 +00:00
Yuya Nishihara
3d43b556c3 cli: git colocation: fix check for non-main workspace
Also removed period from the error message per convention.

Fixes #7812
2025-10-23 01:50:55 +00:00
Yuya Nishihara
3a10ca3824 cli: git colocation: sort subcommands lexicographically 2025-10-23 01:50:55 +00:00
Martin von Zweigbergk
b734cd8fa0 cli: test that jj log --ignore-immutable still renders immutable commits
I had missed that `jj log` is supposed to render commits as immutable
even when `--ignore-immutable` is passed. Thanks to @yuja for pointing
this out.
2025-10-22 15:12:14 +00:00
Yuya Nishihara
34b8191c9f cli: tests: let TestEnvironment store extra env vars in OsString
We don't need to support variables in arbitrary encoding, but it's simpler to
just accept any OsString inputs.
2025-10-22 14:46:24 +00:00
Yuya Nishihara
3523e753d5 cli: tests: remove unneeded unicode conversion from TestEnvironment 2025-10-22 14:46:24 +00:00
Angel Ezquerra
3c98f9a7d3 git: add git colocation enable | disable | status commands (fixes #4624)
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
This new command lets you turn a non colocated git repo into a colocated repo or vice-versa (by using the `jj git colocation enable` and `jj git colocation disable` commands respectively).
These commands simply implement the instructions found in https://github.com/jj-vcs/jj/blob/main/docs/git-compatibility.md#converting-a-repo-into-a-co-located-repo

You can also call `jj git colocation status` to show the current colocation status and `jj colocation` to show a help message (with the list of sub-commands).
2025-10-22 06:39:23 +00:00
Daniel Luz
b77bb24114 cli: restore: provide modified file completion for --changes-in/-c
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
2025-10-21 21:22:00 +00:00
Martin von Zweigbergk
3a511becd6 cargo: bump ignore crate to 0.4.24
This includes the fix for
https://github.com/BurntSushi/ripgrep/issues/3127. The fix let us
optionally allow unclosed character classes in .gitignore files. It is
allowed by default when using the `GitignoreBuilder` (as we do), so we
get the fix without code changes.
2025-10-20 17:20:14 +00:00
David Higgs
2c3b7a3240 tests: prevent cli tests from failing when generating code coverage
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
2025-10-20 13:00:50 +00:00
Scott Taylor
141832414a backend: remove MergedTreeId::Legacy variant
I'm planning to try to add conflict labels to `MergedTree` and
`MergedTreeId`, and it will be easier to add them if both are structs
with similar methods. Since we don't support reading/writing legacy
conflicts anymore (as far as I'm aware), I think it should be safe to
delete the `MergedTreeId::Legacy` variant now.
2025-10-19 13:14:27 +00:00
Owen Brooks
f88b0d8093 cli: git clone: add --branch option
When cloning with the branch option:
- Only the specified branch will be fetched
- The trunk alias is only set if the specified branch happens to be the default branch
- The clone fails if the branch does not exist in the remote
2025-10-19 05:14:11 +00:00
Yuya Nishihara
ba48317236 templater: add commit.local/remote_tags() methods for completeness
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
2025-10-16 15:44:50 +00:00
Yuya Nishihara
0fb99c12cc templater: include remote tags in "tags" output
Since we can now update tags internally, local and remote tags may be out of
sync in non-colocated Git repositories. "tags" template should indicate that.
2025-10-16 15:44:50 +00:00
Yuya Nishihara
75041a2953 cli: add completion helper for existing tag names
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
2025-10-16 03:03:38 +00:00
Yuya Nishihara
1f30c337c7 cli: add tag delete commands 2025-10-16 03:03:38 +00:00
Yuya Nishihara
4d9cfa65c1 cli: add tag set command
This is a stripped-down version of cmd_bookmark_set(). Since tags shouldn't
usually be rewritten, I've made it fail on updating existing tags by default.
2025-10-16 03:03:38 +00:00
Remo Senekowitsch
883d9879d2 cli complete: suggest tracking absent remote bookmarks
This is a follow-up to 937d88ff25,
which made this operation possible in the first place.
2025-10-15 20:20:07 +00:00
Gaëtan Lehmann
4be2aad955 op diff: -G as short version of --no-graph
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
2025-10-15 17:21:29 +00:00
Gaëtan Lehmann
bb7c3c5b2d op show: -G as short version of --no-graph 2025-10-15 17:21:29 +00:00
Gaëtan Lehmann
bb072635a8 evolog: -G as short version of --no-graph 2025-10-15 17:21:29 +00:00
Gaëtan Lehmann
039863855c op log: -G as short version of --no-graph
To be consistent with `jj log -G`.
2025-10-15 17:21:29 +00:00
Yuya Nishihara
77e2c14d79 cli: git-push: allow pushing new bookmark to tracked remote
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
2025-10-15 01:52:19 +00:00
Yuya Nishihara
9aaff6afbb cli: bookmark: fix list template to accept absent-tracked remote refs 2025-10-15 01:52:19 +00:00
Yuya Nishihara
937d88ff25 cli: bookmark: allow tracking/untracking absent remote bookmarks
#7072
2025-10-15 01:52:19 +00:00
Yuya Nishihara
82dd14fd85 git: ensure RemoteView is created for remote with no existing refs
This will help "jj bookmark track" know whether absent remote ref can be created
for the specified remote. "jj bookmark" subcommands shouldn't depend on
gix::Repository API.
2025-10-15 01:52:19 +00:00
Yuya Nishihara
429fec1ae3 git: export tag changes
Although we don't have "jj git tag set"/"delete" commands, this fixes weird undo
behavior #6325. The discussion in #6325 is derailed, but there would be another
issue for the "abandon unreachable" behavior.

Fixes #6325
2025-10-15 01:31:16 +00:00
ase
f34dbabd47 config: add support for --when.workspaces
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
2025-10-14 17:50:07 +00:00
Remo Senekowitsch
9fd1ab78cd git: ensure untracked files are removed from index
Previously untracking a file with `jj file untrack` would not remove the
file from the git index (intent-to-add), making the output of
`jj status` and `git status` inconsistent.
2025-10-14 15:23:50 +00:00
Martin von Zweigbergk
017d34625b undo: hint about jj op restore when trying to undo merge operation 2025-10-14 05:19:46 +00:00
Remo Senekowitsch
6efaa210df cli: remove deprecated command backout 2025-10-13 16:49:23 +00:00
Martin von Zweigbergk
71661495b8 bisect: don't say that we run the provided command from the workspace root
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
I don't know if I planned to make the command run from the workspace
root but it doesn't currently do that. I don't think we should change
it either.
2025-10-12 23:50:50 +00:00
Martin von Zweigbergk
829b2ed261 bisect: deprecate --command <cmd> in favor of -- <cmd> <args>...
`jj bisect run --command` splits the argument on spaces, so
e.g. `--command 'cargo test'` will run `cargo` with `test` as
argument. It is hard to pass more complex commands to because we don't
parse e.g. quotes as the shell would (and we wouldn't match the user's
preferred shell even if we did).

This patch deprecates the `--command` argument in favor of positional
arguments, so the user can do things like this:

```
jj bisect run --range ..main -- bash -c 'jj duplicate -r xyz -B @ && cargo test'
```

That will run the tests with the `xyz` change applied.
2025-10-12 23:50:50 +00:00
bipul
72bfc1c96f config: add workspace-level configuration support
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
- Added support for workspace-specific configuration using `jj config` commands.
- Introduced `--workspace` option to `jj config edit`, `jj config set`, and `jj config unset`.
- Workspace configuration file is stored in `.jj/workspace-config.toml` per workspace.
- Simplified workspace path handling logic.
- Updated documentation and test snapshots to reflect new behavior.

This improves flexibility for users working across multiple workspaces.

Co-authored-by: Eidolon <furyhunter600@gmail.com>
Co-authored-by: ase <adam@sandbergericsson.se>
2025-10-12 14:43:12 +00:00
Joseph Lou
12d649223f template: Add template-aliases.empty_placeholder
This is similar to `description_placeholder` and provides a simple alias
to globally override the "(empty)" label to something else.
2025-10-11 16:44:28 +00:00
Gaëtan Lehmann
b3ea95ff59 squash: fix -A -B behavior
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
and add the corresponding test. The children of the new commit were not
properly rebased on their parents.

fix: #7636
2025-10-09 15:53:46 +00:00
Gaëtan Lehmann
39c73e403f metaedit: fix 'squash' in test name
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
2025-10-09 07:29:04 +00:00
Gaëtan Lehmann
336d9f7997 metaedit: test multiple input revisions
We were previously only testing the edition on a single revision.
2025-10-09 07:29:04 +00:00
Bryce Berger
b9ad82b97a templates: add remote and * to bookmarks in builtin_log_redacted
Remote names are potentially sensitive? Unsure, so better to redact them.

For getting the "*": This could have been done without modifying the
Rust side, with e.g. `stringify(bookmark).ends_with("*")`. However, this
feels brittle.

With adding `.synced()` to the template language, bookmark formatting
_could_ be done entirely in templates now. I don't know if that's
desired, so leaving for a potential future commmit.
2025-10-08 12:48:27 +00:00
David Higgs
a9797552d7 metaedit: add --message option, fix: #7634 2025-10-07 00:54:16 +00:00
Steve Fink
14ca2edb7e cli: Make log -G be the short form of --no-graph
Closes #7638
2025-10-06 23:02:16 +00:00
Angel Ezquerra
dc59c66c12 metaedit: do not edit the change if the --author-timestamp matches the current timestamp (fixes #7602)
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
2025-10-06 07:19:45 +00:00