Commit graph

4258 commits

Author SHA1 Message Date
dependabot[bot]
b3e7e7adf6 cargo: bump the cargo-dependencies group with 4 updates
Bumps the cargo-dependencies group with 4 updates: [insta](https://github.com/mitsuhiko/insta), [rayon](https://github.com/rayon-rs/rayon), [rustix](https://github.com/bytecodealliance/rustix) and [smallvec](https://github.com/servo/rust-smallvec).


Updates `insta` from 1.31.0 to 1.32.0
- [Changelog](https://github.com/mitsuhiko/insta/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mitsuhiko/insta/compare/1.31.0...1.32.0)

Updates `rayon` from 1.7.0 to 1.8.0
- [Changelog](https://github.com/rayon-rs/rayon/blob/master/RELEASES.md)
- [Commits](https://github.com/rayon-rs/rayon/compare/rayon-core-v1.7.0...rayon-core-v1.8.0)

Updates `rustix` from 0.38.13 to 0.38.14
- [Release notes](https://github.com/bytecodealliance/rustix/releases)
- [Commits](https://github.com/bytecodealliance/rustix/compare/v0.38.13...v0.38.14)

Updates `smallvec` from 1.11.0 to 1.11.1
- [Release notes](https://github.com/servo/rust-smallvec/releases)
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.11.0...v1.11.1)

---
updated-dependencies:
- dependency-name: insta
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo-dependencies
- dependency-name: rayon
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo-dependencies
- dependency-name: rustix
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: smallvec
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-21 10:01:13 -07:00
Waleed Khan
409356fa5b merge_tools: enable :builtin as default diff/merge editor 2023-09-21 03:29:27 +02:00
dependabot[bot]
1e94f92cea cargo: bump the cargo-dependencies group with 1 update
Bumps the cargo-dependencies group with 1 update: [unicode-width](https://github.com/unicode-rs/unicode-width).

- [Commits](https://github.com/unicode-rs/unicode-width/compare/v0.1.10...v0.1.11)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-20 14:35:21 -05:00
Ilya Grigoriev
86767e47d7 cargo: make jj installable with cargo binstall
https://github.com/cargo-bins/cargo-binstall

Note that `jj` will only become installable once the next release
is published to crates.io. For this reason, I am planning to
wait until then before documenting the fact that `jj` can be
installed this way.

At that point, `cargo binstall jj-cli` should be sufficient.

Before then, it's possible to test that this will work by doing

```
cargo binstall jj-cli --force --strategies crate-meta-data --log-level debug  --dry-run --manifest-path cli/Cargo.toml
``` 

Without --dry-run, this should install the 0.9 release if run
on `cli/Cargo.toml` form this commit.
2023-09-20 09:35:18 -07:00
Ilya Grigoriev
d79e8293aa cargo: stop cargo install from installing fake-editor & co.
Among other things, this prevented `jj` from working with
`cargo binstall`.

The trick is taken from
https://github.com/rust-lang/cargo/issues/2911#issuecomment-1483256987.

We could now also remove `--bin jj` from the installation commands
in `install-and-setup.md`, but I'm not sure we should. That argument
makes it clear that the binary is `jj`, not `jj-cli`.

Fixes #216.
2023-09-20 09:01:54 -07:00
Martin von Zweigbergk
6f53d3a103 tests: test views, operations, and mutable repos only with test backend
I don't think the backend type should matter for any of these.
2023-09-20 07:47:30 -07:00
Martin von Zweigbergk
e3f82cd99a tests: leverage TestRepo::init() in test_merged_tree
I forgot to update these call sites when I introduced (the new version
of) `TestRepo::init()`.
2023-09-20 07:47:30 -07:00
Ilya Grigoriev
6d5390d1db cli: add upstream remote to default trunk()
This makes trunk() correct after `jj git fetch --remote upstream --branch
main`.
2023-09-19 20:51:23 -07:00
Ilya Grigoriev
0c31e0ba61 trunk() docs fix: commits aren't tried in order; newest commit wins
That's my understanding of how `latest()` revset works.
2023-09-19 20:51:23 -07:00
Martin von Zweigbergk
f39b0d24c8 tests: use test backend in working copy tests, fix MergedTree bug
Only tests dealing with Git submodules care about the backend type.

Switching the tests to use the test backend also uncovered another bug
in `MergedTree`, so I fixed that too. The bug only happens with legacy
trees (path-level conflicts) and backends that care about the conflict
path, so it wouldn't happen with Git backends, and it wouldn't happen
at Google either (because we use tree-level conflicts).
2023-09-19 20:49:41 -07:00
Martin von Zweigbergk
0f7054e8c3 tests: wherever we test with only one backend, use the test backend
I don't think there's any reason to use the local backend in tests
instead of using the stricter test backend.

I think we should generally use the test backend in tests and only use
the local backend or git backend when there's a particular reason to
do so (such as in `test_bad_locking` where the on-disk directory
structure matters). But this patch only deals with the simpler cases
where we were only testing with the local backend.
2023-09-19 20:49:41 -07:00
Yuya Nishihara
aa3dfaa859 cli: fix operation id recorded on unmanaged Git HEAD move
This appears to be broken at db0d14569b "cli: wrap repo in a struct to
prepare for adding cached data." Testing this isn't easy since the operation
id recorded here will be overwritten immediately by snapshot_working_copy(),
and the snapshotting should work fine so long as the tree id matches.
2023-09-19 21:30:40 +09:00
Yuya Nishihara
96cb3a6053 docs: use branch@remote syntax in trunk() example
It's simpler, and user-specified trunk() wouldn't need fallback.
2023-09-19 21:29:08 +09:00
Martin von Zweigbergk
d575aaeca8 backend: move constant functions first
`root_commit_id()`, `root_change_id()`, and `empty_tree_id()` were
strangely ordered between `write_symlink()` and `read_tree().
2023-09-19 05:24:51 -07:00
Waleed Khan
742df2758b merge_tools: reorder editor_args_from_settings
The rest of the functions in this file are defined before they are used, so it confused me when trying to track down this function in the static call graph.
2023-09-19 07:27:21 +02:00
dependabot[bot]
39c0f0d2d5 github: bump the github-dependencies group with 1 update
Bumps the github-dependencies group with 1 update: [dtolnay/rust-toolchain](https://github.com/dtolnay/rust-toolchain).

- [Release notes](https://github.com/dtolnay/rust-toolchain/releases)
- [Commits](0e66bd3e6b...1482605bfc)

---
updated-dependencies:
- dependency-name: dtolnay/rust-toolchain
  dependency-type: direct:production
  dependency-group: github-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-18 09:10:59 -07:00
dependabot[bot]
35d9ef44a5 cargo: bump the cargo-dependencies group with 3 updates
Bumps the cargo-dependencies group with 3 updates: [clap](https://github.com/clap-rs/clap), [test-case](https://github.com/frondeus/test-case) and [timeago](https://github.com/vi/timeago).


Updates `clap` from 4.4.3 to 4.4.4
- [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/v4.4.3...v4.4.4)

Updates `test-case` from 3.1.0 to 3.2.1
- [Release notes](https://github.com/frondeus/test-case/releases)
- [Changelog](https://github.com/frondeus/test-case/blob/master/CHANGELOG.md)
- [Commits](https://github.com/frondeus/test-case/compare/v3.1.0...v3.2.1)

Updates `timeago` from 0.4.1 to 0.4.2
- [Release notes](https://github.com/vi/timeago/releases)
- [Commits](https://github.com/vi/timeago/compare/v0.4.1...v0.4.2)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: test-case
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo-dependencies
- dependency-name: timeago
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-18 08:58:24 -07:00
Martin von Zweigbergk
7ecd64fde1 merged_tree: use child path when merging child
This fixes a bug where we used the parent directory's path when trying
read trees and files for a child entry. Many tests in
`test_merged_tree` fail after switching to the test backend there
without this fix/
2023-09-18 07:53:19 -07:00
Martin von Zweigbergk
63ba2a6346 tests: add a strict backend for use in tests
We ran into a bug in `MergedTree` with our commit backend at
Google. The problem there was that `MergedTree` sometimes uses the
wrong path when reading files and trees. We didn't catch the bug in
our tests (outside of Google) because both our backends let you read
files and trees at any path.

This commit introduces a stricter backend that we can use in tests to
catch this kind of bug. For simplicity, it stores all data in
memory. Since tests are short-lived, I think that should be fine.

For now, this backend is stricter only in that it doesn't mix objects
written to different paths. We can make it strict/lossy in other ways
later (e.g. modifying written commit objects).

I think having a backend designed for tests can also be useful for
later making it possible to control the backend, e.g. to inject
errors.

We may want to replace almost all uses of the local backend in tests
with uses of this new test backend.
2023-09-18 07:53:19 -07:00
Martin von Zweigbergk
cfffbb6cd7 content_hash: make public
I'm going to use `content_hash` in a new commit backend for use in
tests.
2023-09-18 07:53:19 -07:00
Martin von Zweigbergk
9c30d7500b testutils: delete bool-typed init() in favor of enum-typed version
It makes the call sites clearer if we pass the `TestRepoBackend` enum
instead of the boolean `use_git` value. It's also more extensible (I
plan to add another backend for tests).
2023-09-18 07:15:37 -07:00
Martin von Zweigbergk
50596c499e testutils: allow passing TestRepoBackend to TestWorkspace too 2023-09-18 07:15:37 -07:00
Martin von Zweigbergk
c6cf9d54f6 testutils: add an enum for TestRepo backend
I plan to add another backend for use in tests.
2023-09-18 07:15:37 -07:00
Martin von Zweigbergk
79527d707c testutils: use .jj-internal git repos in most tests
I don't think there's much reason to run most tests with a `.git`
directory outside of `.jj`. I think it's just that way for historical
reasons. It's been that way since I added support for `.jj`-internal
repos in a8a9f7dedd.

The reason I want to switch is to make it a little easier to create
test repos for different backends. The problem with `.jj`-external git
repos is that they depend on an additional path.

I had to update `test_bad_locking.rs` to make the code merging
directories able handle missing directories on some side, because
git's loose objects result in directories getting created on one or
both sides.
2023-09-18 07:15:37 -07:00
Martin von Zweigbergk
2bc641c57c test_bad_locking: make merge_directories() expect non-existent target
I ran into some issues here when switching our tests to use
`.jj`-internal git repos. For example, the `std::fs::copy()` calls
started failing, which may be related to #2103. I think one problem is
that we could end up calling `merge_directories()` twice for the same
directory. This patch fixes that by deduping the paths we call with,
and makes the function assume that the output directory doesn't exist.
2023-09-18 06:59:28 -07:00
Waleed Khan
393b035498 merge_tools: create builtin merge editor 2023-09-18 06:33:29 +02:00
Ruben Slabbert
f2f5ded5f0 revsets: add trunk alias with default to main/master/root 2023-09-17 10:17:23 +10:00
Ilya Grigoriev
c45216ed02 templates.md docs: Document string literal format
We are a little weird about which string escapes we support, and we don't
support raw strings.  I thought this might be worth documenting.

Inspired by https://github.com/martinvonz/jj/pull/2251
2023-09-15 20:16:09 -07:00
Ilya Grigoriev
c5f74bc466 docs: mention git pack-refs for co-located repos
As suggested by @yuja in
https://github.com/martinvonz/jj/issues/1841#issuecomment-1720451152

Thanks to @lazywei for pointing out that `git pack-refs --all` is better, at
least on the first run. I haven't checked, but suspect, that because of the
number of `refs/jj` refs jj creates, it might always be better.
2023-09-15 19:49:11 -07:00
Ilya Grigoriev
f31e66d663 github: rename jj-docs-bot to jj-docs[bot]
Perhaps this will stop Github from showing jj-docs-bot as a very active
contributor in https://github.com/martinvonz/jj/pulse. This would
probably fair, even though jj-docs-bot tries its best to be a good and
helpful bot.

Regardless, this seems to be the standard on Github which has
`dependabot[bot]` and `github-actions[bot]`.
2023-09-15 19:31:48 -07:00
dependabot[bot]
e288a152d0 cargo: bump the cargo-dependencies group with 1 update
Bumps the cargo-dependencies group with 1 update: [chrono](https://github.com/chronotope/chrono).

- [Release notes](https://github.com/chronotope/chrono/releases)
- [Changelog](https://github.com/chronotope/chrono/blob/main/CHANGELOG.md)
- [Commits](https://github.com/chronotope/chrono/compare/v0.4.30...v0.4.31)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-15 17:09:28 +00:00
Martin von Zweigbergk
21921cfd73 docs: add a section about profiling 2023-09-14 21:15:03 -07:00
Ilya Grigoriev
33087bcd90 cli docs: document that --config-toml can be repeated 2023-09-14 18:09:27 -07:00
Zachary Dremann
2177dc0657 Allow \0 escape for nulls
This allows safely getting e.g. multiple descriptions, and knowing where the
boundaries are
2023-09-14 17:11:05 -04:00
dependabot[bot]
fedd289a13 cargo: bump the cargo-dependencies group with 1 update
Bumps the cargo-dependencies group with 1 update: [serde_json](https://github.com/serde-rs/json).

- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.106...v1.0.107)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-14 15:45:03 +00:00
Philip Metzger
09a99e36dc docs/design: Clarify run.md a bit.
This is essentially a new version, which clarifies multiple statements about
`jj run`. Notably, it cleans up some mistakes which were overlooked or deemed
good enough in the Google Docs version.
2023-09-14 16:39:40 +02:00
Philip Metzger
5b729a90a9 docs/design: Move the run doc to github.
This ticks another box in #1869.

Co-Authored-By: arxanas <me@waleedkhan.name>
Co-Authored-By: hooper <hooper@google.com>
Co-Authored-By: martinvonz <martinvonz@google.com>
2023-09-14 16:39:40 +02:00
Glen
2c74fa8c7c docs: document script to colocate a jj-only repo
https://github.com/martinvonz/jj/discussions/2230 indicates a lot of
interest in this, so we'd probably want to support this officially at
some point. Until then, document a script that has worked well-enough
for some of us.
2023-09-14 10:00:39 +08:00
dependabot[bot]
63b02ab05f 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 [libc](https://github.com/rust-lang/libc).


Updates `clap` from 4.4.2 to 4.4.3
- [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/v4.4.2...v4.4.3)

Updates `libc` from 0.2.147 to 0.2.148
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.147...0.2.148)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-13 08:58:37 -07:00
Ilya Grigoriev
0cf83ea306 contributing.md: add section about contributing to the docs 2023-09-11 18:22:56 -07:00
Ilya Grigoriev
fd80dcd5ed README: Edits to Getting Started
The link to the glossary was weirdly far from the link to the FAQ.

Also, added a mention of the prerelease docs.
2023-09-11 18:22:56 -07:00
Ilya Grigoriev
eee3d488f1 README: point users to the new documentation website 2023-09-11 18:22:56 -07:00
Ilya Grigoriev
21f4015cbf install-and-setup.md: explain how to compile the latest release
Also a few minor updates.
2023-09-11 18:21:56 -07:00
dependabot[bot]
9d20f1af31 cargo: bump the cargo-dependencies group with 2 updates
Bumps the cargo-dependencies group with 2 updates: [rustix](https://github.com/bytecodealliance/rustix) and [serde_json](https://github.com/serde-rs/json).


Updates `rustix` from 0.38.11 to 0.38.13
- [Release notes](https://github.com/bytecodealliance/rustix/releases)
- [Commits](https://github.com/bytecodealliance/rustix/compare/v0.38.11...v0.38.13)

Updates `serde_json` from 1.0.105 to 1.0.106
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.105...v1.0.106)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-11 09:53:28 -07:00
Martin von Zweigbergk
8bfb6c10fd cli: add jj op log --no-graph
Seems useful, and makes it consistent with the `jj log` and `jj
obslog`.
2023-09-10 15:17:43 -07:00
Yuya Nishihara
fc86d91b15 tests: fix test_merge_views_branches() to set up local "feature" branches
Git refs aren't involved in this test.
2023-09-11 01:07:29 +09:00
Yuya Nishihara
b80d04319d tests: rewrite "@"/"root" revset resolution tests without using bad git refs 2023-09-11 01:07:29 +09:00
Martin von Zweigbergk
86206e83a4 repo_path: avoid repeated copying of PathBuf in to_fs_path()
I've noticed `WorkspaceCommandHelper::format_file_path()` appear in
profiles a few times. A big part of that is spent in
`RepoPath::to_fs_path()`. I think I had been thinking that
`PathBuf::join()` takes `self` by value and mutates it, but it turns
out it creates a new instance. So our `result = result.join(...)` in a
loop was copying the `PathBuf` over and over. This fixes that and also
reserves the expected size. That speeds up `jj files
--ignore-working-copy -r v6.0` in the Linux repo from 546.0 s to 509.3
s (6.7%).
2023-09-09 08:43:29 -07:00
Austin Seipp
2e8b824da7 chore(nix): add 'default' features to list of cargo features
Summary: By default, and to be explicit, the local flake turns off default
features. But, 70f6e0a turned off watchman support for the Nix build by
accident. Enable default features so this doesn't happen again.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Change-Id: Ib7dd935eceab328fa5b0333b10368377
2023-09-08 19:38:24 -05:00
Martin von Zweigbergk
70f6e0a452 cargo: enable the watchman feature by default
I think the feature is requested by enough users that we should
include it by default, also for people who install from source (we
include it in the `packaging` feature already).

It increases the size of the binary from 16.5 MiB to 17.8 MiB. I
suspect we'd see some of that increase in size soon anyway, as I'm
probably going to use Tokio for making async backend requests.
2023-09-08 09:34:55 -07:00