Commit graph

7904 commits

Author SHA1 Message Date
Jakob Hellermann
270b54209e cli: autocomplete: complete --config with possible configuration keys
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
the trailing `=` is especially nice to have because otherwise fish will
complete the suggestion and insert a space before the cursor.
With the `=`, `jj config --config ui.pagin<TAB>never` works.
2025-01-12 17:53:22 +00:00
Benjamin Tan
c0c582fcee cli: describe: use CommitRewriter::reparent
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 makes it clear that the rewritten commit will have the same tree as
the original commit.
2025-01-12 14:56:26 +00:00
Yuya Nishihara
fe86bee64c cargo: bump gix to 0.69.1
The new track_empty flag is set to the default value. It was introduced by the
following commit, and I think the default behavior is good.

d3f5f27732
2025-01-12 10:01:58 +00:00
Benjamin Tan
9aaf98330b cli: git push: allow signing commits on push
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 adds the `git.sign-on-push` configuration which can be used to
automatically sign unsigned commits before pushing to a Git remote.
2025-01-12 02:33:32 +00:00
Benjamin Tan
d7f064c311 cli: op log: add --reversed option
Closes #4190.
2025-01-12 01:51:25 +00:00
Benjamin Tan
73d38b5cdc cli: remove GraphLog::Edge type
`jj_lib::graph::GraphEdge` can be used directly instead.
2025-01-12 01:51:25 +00:00
Benjamin Tan
9b45c90cc5 tests: remove unnecessary format_time_range template alias
This is already set in the test configuration.
2025-01-12 01:51:25 +00:00
Yuya Nishihara
89e0a7021a cli: git: store absolute remote path in config file
The "git" CLI chdir()s to the work tree root, so paths in config file are
usually resolved relative to the workspace root. OTOH, jj doesn't modify the
process environment, so libgit2 resolves remote paths relative to cwd, not to
the workspace root. To mitigate the problem, this patch makes "jj git remote"
sub commands to store resolved path in .git/config. It would be nice if we can
reconfigure in-memory git2 remote object to use absolute paths (or set up
in-memory named remote without writing a config file), but there's no usable
API afaik.

This behavior is different from "git remote add"/"set-url". I don't know the
rationale, but these commands don't resolve relative paths, whereas "git clone"
writes resolved path to .git/config. I think it's more consistent to make all
"jj git" sub commands resolve relative paths.
2025-01-12 01:45:03 +00:00
Yuya Nishihara
20b3d02ff2 cli: git: extract absolute_git_source() as utility function 2025-01-12 01:45:03 +00:00
Waleed Khan
7b47368c24 cli: upgrade scm-record from v0.4.0 to v0.5.0
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-01-11 18:36:12 +00:00
Benjamin Tan
f02ed0050f lib: dag_walk: fix doc comment typos
This commit fixes more typos unintentionally introduced in d9c68e08,
when renaming `jj branch` to `jj bookmark`.
2025-01-11 16:19:52 +00:00
Jakob Hellermann
f1e91cdab5 cli: complete: fix stderr during autocomplete of revsets
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
When running `cmd.spawn()` rust will by default inherit
the stderr of the parent, so `jj log test<TAB>`, would
print `There is no jj repo in "."` into the prompt.
2025-01-11 12:34:21 +00:00
Yuya Nishihara
98724278c5 templater: add config(name) function
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 could be used in order to switch template outputs conditionally, or to
get the default push remote for example.
2025-01-11 01:40:23 +00:00
Yuya Nishihara
4e30fc7215 templater: pass RepoLoader to OperationTemplateLanguage
UserSettings will be obtained from there. If operation template supported
"self.repo() -> Repo" method, RepoLoader would be needed. It's equivalent to
Repo in CommitTemplateLanguage.
2025-01-11 01:40:23 +00:00
Yuya Nishihara
83d237a32c templater: introduce ConfigValue type, port "config list" value to it
I'm going to add config(name) accessor, which returns ConfigValue.
2025-01-11 01:40:23 +00:00
Yuya Nishihara
8e5a18b26e op diff: remove redundant "Change {change_id}" from changed commits graph
This makes the graph compact. Short change ids are usually printed as a part
of commit summary. The --no-graph output is a bit harder to parse, but we can
still discriminate entries by change ids.
2025-01-11 01:23:51 +00:00
Stephen Jennings
4ef8ad8445 docs: Explain what elided revisions are
A common question is asking how to show elided revisions. This FAQ
explains why revisions are elided and how to display them.
2025-01-11 01:18:45 +00:00
Philip Metzger
c40e5210c4 docs: fix the mkdocs admonition I recently added
I didn't check the indentation as it _needs_ to be a codeblock to render correctly.
2025-01-10 23:09:01 +00:00
Philip Metzger
f9dad76512 workflows: fix the pre-release docs workflow
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
It contained a check for `repo_owner == 'martinvonz'` which meant that it hasn't run in 4 weeks.
This is another great example showing why current CI systems suck, as it always was "successful" in
doing nothing with no warning whatsoever.

I also only noticed it because I wanted to check my latest doc change on the prerelease site.
2025-01-10 22:05:09 +00:00
Evan Martin
1f24d57325 docs: fix typo in in command 2025-01-10 21:21:08 +00:00
Philip Metzger
038c0bab12 docs: Make dynamic completions a bit more visible
In recent times multiple users showed up and were confused _why_ some
completions didn't show up, so make it explicit that they're opt-in
until the Clap upstream has made it so.
Also remove the link to the dynamic completions improvements issue, as it was closed
a while ago.
2025-01-10 20:59:45 +00:00
Benjamin Tan
113984d82c nix: fix error running rust commands in devshell on macOS
The `RUSTFLAGS` enviroment variable needs to be set in a `shellHook` to
allow the command to be interpreted by the shell. Otherwise, it will
just be passed as a string into the `rustc` binary:

```
cargo nextest run --workspace
error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `rustc - --crate-name ___ --print=file-names -Zthreads=0 -C 'link-arg=--ld-path=$(unset' 'DEVELOPER_DIR;' /usr/bin/xcrun --find 'ld)' -C link-arg=-ld_new --target aarch64-apple-darwin --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg` (exit status: 1)
  --- stderr
  error: Unrecognized option: 'find'
```
2025-01-10 20:36:41 +00:00
Benjamin Tan
9f533aeb78 cli: util: rename mangen to install-man-pages
The `jj util install-man-pages` command will generate man pages for all
`jj` subcommands and install them to the provided destination.

Closes #4157.
2025-01-10 18:54:05 +00:00
Benjamin Tan
f9371ccfd6 cargo: bump clap_mangen to 0.2.25 2025-01-10 18:54:05 +00:00
Bryce Berger
b714592952 nix: clean up flake
The build inputs were duplicated, once in packages.jujutsu and again in
devShells.default. This removes the duplication.
2025-01-10 18:15:42 +00:00
dependabot[bot]
f755e8f683 cargo: bump the cargo-dependencies group with 2 updates
Bumps the cargo-dependencies group with 2 updates: [clap](https://github.com/clap-rs/clap) and [syn](https://github.com/dtolnay/syn).


Updates `clap` from 4.5.25 to 4.5.26
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.25...clap_complete-v4.5.26)

Updates `syn` from 2.0.95 to 2.0.96
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.95...2.0.96)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-10 16:48:27 +00:00
dependabot[bot]
792bcb634d github: bump taiki-e/install-action in the github-dependencies group
Bumps the github-dependencies group with 1 update: [taiki-e/install-action](https://github.com/taiki-e/install-action).


Updates `taiki-e/install-action` from 2.47.9 to 2.47.10
- [Release notes](https://github.com/taiki-e/install-action/releases)
- [Changelog](https://github.com/taiki-e/install-action/blob/main/CHANGELOG.md)
- [Commits](df5dec2a2f...0779861fb4)

---
updated-dependencies:
- dependency-name: taiki-e/install-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-10 16:47:05 +00:00
Yuya Nishihara
e124404af3 cli: remove handling of deprecated fix.tool-command config
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 originally implemented this as a custom config migration rule, but the next
release is v0.26, so we can just drop support for fix.tool-command.
2025-01-10 05:45:16 +00:00
Yuya Nishihara
b97b7384bb config: allow inline table syntax in mutation and conditional scope API
This is a middle ground. An inline table can still be overwritten or deleted
because it's syntactically a value. It would be annoying if "jj config set
colors.<name> '{ .. }'" couldn't be executed more than once because the existing
item was a table.

#5255
2025-01-10 02:56:21 +00:00
Austin Seipp
1b07df143a github: don't run dependabot or gh-readonly-queue builds twice
Like `main`, we don't want to double build these branches since they will be
handled by `merge_group` already.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2025-01-10 02:44:55 +00:00
Yuya Nishihara
f14a6e6f19 git: remove PartialEq requirement from GitPushError
Non-trivial error types usually don't implement Eq/PartialEq.
2025-01-10 01:16:33 +00:00
Yuya Nishihara
ce6119a024 tests: insert insta::allow_duplicates! { .. } per snapshot
This might be a bug of insta, but new snapshots were associated with wrong
assertion blocks if allow_duplicates! { .. } contained multiple assertions.
2025-01-10 01:00:09 +00:00
Bryce Berger
84e619cae6 contributing: recommend bacon over cargo-watch
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
As of [1], `cargo-watch` is on minimal development and officially
recommends `bacon` as a successor.

[1]: 9f27bc1c96,
2025-01-09 19:39:54 +00:00
dependabot[bot]
cba1966a77 cargo: bump the cargo-dependencies group with 4 updates
Bumps the cargo-dependencies group with 4 updates: [clap](https://github.com/clap-rs/clap), [clap_complete](https://github.com/clap-rs/clap), [thiserror](https://github.com/dtolnay/thiserror) and [tokio](https://github.com/tokio-rs/tokio).


Updates `clap` from 4.5.24 to 4.5.25
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.24...clap_complete-v4.5.25)

Updates `clap_complete` from 4.5.41 to 4.5.42
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.41...clap_complete-v4.5.42)

Updates `thiserror` from 2.0.9 to 2.0.10
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/2.0.9...2.0.10)

Updates `tokio` from 1.42.0 to 1.43.0
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.42.0...tokio-1.43.0)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: clap_complete
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-09 18:28:37 +00:00
dependabot[bot]
d913ec5173 github: bump the github-dependencies group with 2 updates
Bumps the github-dependencies group with 2 updates: [actions/upload-artifact](https://github.com/actions/upload-artifact) and [taiki-e/install-action](https://github.com/taiki-e/install-action).


Updates `actions/upload-artifact` from 4.5.0 to 4.6.0
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](6f51ac03b9...65c4c4a1dd)

Updates `taiki-e/install-action` from 2.47.8 to 2.47.9
- [Release notes](https://github.com/taiki-e/install-action/releases)
- [Changelog](https://github.com/taiki-e/install-action/blob/main/CHANGELOG.md)
- [Commits](08d473f7b2...df5dec2a2f)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-dependencies
- dependency-name: taiki-e/install-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-09 17:59:57 +00:00
Jakob Hellermann
80c4222399 cli: oplog: add builtin_op_log_oneline template
Motivation:
* one-line logs can be more readable and fit more content into the screen
* consistency with `jj log -T builtin_log_oneline`
2025-01-09 15:58:40 +00:00
Yuya Nishihara
720c903b99 git: port s/bookmark/branch/ renames to config migration rules
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
These two are easy. "fix.tool-command" will be processed by a custom migration
rule of Box<dyn Fn(&mut ConfigLayer) -> ..> type.
2025-01-09 07:23:08 +00:00
Yuya Nishihara
30fb1078b2 cli: integrate config migration
The list of migration rules is managed by CliRunner. I don't know if that's
needed, but in theory, an extension may insert migration rules as well as
default config layers.

Migration could be handled by ConfigEnv::resolve_config(), but it seemed rather
complicated because Vec<ConfigMigrationRule> cannot be cloned, and the scope of
these variables are a bit different.
2025-01-09 07:23:08 +00:00
Yuya Nishihara
98eaadf280 config: add simple migration logic to update deprecated variables
Instead of resolving deprecated variables by callers or config object, this
patch adds a function that rewrites deprecated variables globally (and emits
warnings accordingly.)  It's simpler because StackedConfig doesn't have to deal
with renamed variables internally. OTOH, warnings will be issued no matter if
variables are used or not, which might be a bit noisy.

Maybe we can also add "jj config migrate" command that updates user and repo
configs.
2025-01-09 07:23:08 +00:00
Yuya Nishihara
3fbf1249f9 files: use Merge constructor to interleave conflicting diff parts
Since we build a temporary Vec<_> anyway, we can just rely on the Merge API.
2025-01-09 06:54:09 +00:00
Yuya Nishihara
3d4b5e45e7 merge: inline trivial_merge_inner()
All callers pass &[T] now.
2025-01-09 06:54:09 +00:00
Martin von Zweigbergk
8a3ae86b38 merge: update test values to be simpler and more clearly exhaustive
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-01-09 00:07:05 +00:00
Martin von Zweigbergk
71494299bb merge: make trivial_merge() take a single slice of interleaved terms
I have come to think of conflicts more and more as one positive
followed by a series of diffs and less as two separate sets of adds
and removes. We've already changed the implmentation of `Merge` to be
a single list of interleaved positive and negative terms. I think it's
simpler to use the same format in `trivial_merge()` too.

To keep the diff simple, I just preserved the test case values and
order as is for now even if that means that some of them are now
unintuitive. I'll clean that up in the next commit.
2025-01-09 00:07:05 +00:00
Scott Taylor
7df0f16fe0 resolve: try to resolve all conflicted files in fileset
If many files are conflicted, it would be nice to be able to resolve all
conflicts at once without having to run `jj resolve` multiple times.
This is especially nice for merge tools which try to automatically
resolve conflicts without user input, but it is also good for regular
merge editors like VS Code.

This change makes the behavior of `jj resolve` more consistent with
other commands which accept filesets since it will use the entire
fileset instead of picking an arbitrary file from the fileset.

Since we don't support passing directories to merge tools yet, the
current implementation just calls the merge tool repeatedly in a loop
until every file is resolved, or until an error occurs. If an error
occurs after successfully resolving at least one file, the transaction
is committed with all of the successful changes before returning the
error. This means the user can just close the editor at any point to
cancel resolution on all remaining files.
2025-01-08 23:52:21 +00:00
Scott Taylor
5f77edf503 merge_tools: extract MergeToolFile struct
I'm going to change the merge tools to accept multiple files, and this
will make it easier to pass all the required data about each file.
2025-01-08 23:52:21 +00:00
Austin Seipp
6fec006405 github: don't run build workflows twice on push to main
The new `merge_group` event will already attach all the CI events from the
various workflows where it applies. If the merge queue is drained and merges to
`main`, having `push` on these workflows will cause them to be run again, doubling
the number of CI checks. We don't need `push` anymore, basically.

Also, because checks can be cancelled now, the current double running can
probably lead to an awkward setup like:

- Merge Queue merges A to main, starts `push` workflows
- Merge Queue then merges B and C to main, starts `push` workflows
- `A`'s workflows get cancelled if it's not yet done
- This makes it look like `A` has failing tests somehow, but it doesn't

Therefore, just removing the double builds is the first step to cut down on the
CI times for our repo.

We also run the build workflows on all pushes to NOT main, because that will
help people who want to run CI before opening an actual PR.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2025-01-08 22:54:14 +00:00
Austin Seipp
a45eb0b0d5 github: don't cancel concurrent builds on main
This will make sure the build on the main listing still looks clean, instead of
previous builds being cancelled and making it look like things failed.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2025-01-08 22:37:25 +00:00
Austin Seipp
6083135f19 lib: remove hack to migrate old git remotes
Deletes another vestigial trace of git in the lib crate.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2025-01-08 22:02:21 +00:00
Austin Seipp
e15429ba91 cli: make git support optional
There are some experiments to try and compile `jj` to WebAssembly, so that we
might be able to do things like interactive web tutorials. One step for that
is making `git` support in `jj-cli` optional, because we can stub it out for
something more appropriate and it's otherwise a lot of porting annoyance for
both gitoxide and libgit2.

(On top of that, it might be a useful build configuration for other experiments
of mine where removing the need for the large libgit2 depchain is useful.)

As part of this, we need to mark `jj-lib` as having `default-features = false`
in the workspace dependency configuration; otherwise, the default behavior
for Cargo is to compile with all its default features, i.e. with git support
enabled, ignoring the `jj-cli` features clauses.

Other than that, it is fairly straightforward junk; it largely just sprinkles
some `#[cfg]` around liberally in order to make things work. It also adjusts the
CI pipeline so this is tested there, too, so we can progressively clean it up.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2025-01-08 22:02:21 +00:00
Austin Seipp
992066c60c lib: remove use of zstd
`zstd` is only used to write files in the native backend right now. For now,
jettison it, to unbundle some C code that we don't really need.

(Ideally, a future compression library would be pure Rust, but we'll cross that
bridge when we get to it...)

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2025-01-08 22:02:21 +00:00