Martin von Zweigbergk
76fd6a830d
CommitBuilder: take parents as argument in for_new_commit()
...
It's rare to want to create a commit directly off of the root commit,
so let's have the caller tell us which parents they want.
2022-09-20 21:20:57 -07:00
Martin von Zweigbergk
1d9f1720c5
backend: add a Tree::from_hex()
helper
2022-09-20 21:20:57 -07:00
Yuya Nishihara
9bf8452411
conflicts: simplify state management of parse_conflict_hunk()
...
We no longer need body_seen because the header lines are deterministic.
2022-09-21 06:03:59 +09:00
dependabot[bot]
8f3ad14012
cargo: bump itertools from 0.10.4 to 0.10.5
...
Bumps [itertools](https://github.com/rust-itertools/itertools ) from 0.10.4 to 0.10.5.
- [Release notes](https://github.com/rust-itertools/itertools/releases )
- [Changelog](https://github.com/rust-itertools/itertools/blob/master/CHANGELOG.md )
- [Commits](https://github.com/rust-itertools/itertools/commits )
---
updated-dependencies:
- dependency-name: itertools
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-09-20 10:54:43 -07:00
Yuya Nishihara
16f2b82feb
conflicts: change diff line marker to %%%%%%%
...
I feel the original -------/+++++++ pair is slightly confusing because
each half can be a separator by itself. I don't know what character other
than '-'/'+' is preferred, but let's pick '%' (for "mod") per @martinvonz
suggestion.
2022-09-20 15:26:29 +09:00
dependabot[bot]
8402dd8264
cargo: bump insta from 1.19.1 to 1.20.0
...
Bumps [insta](https://github.com/mitsuhiko/insta ) from 1.19.1 to 1.20.0.
- [Release notes](https://github.com/mitsuhiko/insta/releases )
- [Changelog](https://github.com/mitsuhiko/insta/blob/master/CHANGELOG.md )
- [Commits](https://github.com/mitsuhiko/insta/compare/1.19.1...1.20.0 )
---
updated-dependencies:
- dependency-name: insta
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-09-19 10:05:05 -07:00
Martin von Zweigbergk
6812bd9584
cleanup: rename checkout
to wc_commit
...
`wc_commit` seems clearer than `checkout` and not too much longer. I
considered `working_copy` but it was less clear (could be the path to
the working copy, or an instance of `WorkingCopy`). I also considered
`working_copy_commit`, but that seems a bit too long.
2022-09-18 16:19:58 -07:00
Yuya Nishihara
98a66002b0
revset: add function to filter commits by matcher
...
This will be a basic building block of 'jj log PATH'. The implementation
is naive, but works fine for small repos like jj. For mid-size repos,
there would be various areas which need to be optimized.
2022-09-16 13:02:58 +09:00
dependabot[bot]
1145d7bfaa
cargo: bump thiserror from 1.0.34 to 1.0.35
...
Bumps [thiserror](https://github.com/dtolnay/thiserror ) from 1.0.34 to 1.0.35.
- [Release notes](https://github.com/dtolnay/thiserror/releases )
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.34...1.0.35 )
---
updated-dependencies:
- dependency-name: thiserror
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-09-15 21:52:44 -05:00
dependabot[bot]
502942183e
cargo: bump pest_derive from 2.3.0 to 2.3.1
...
Bumps [pest_derive](https://github.com/pest-parser/pest ) from 2.3.0 to 2.3.1.
- [Release notes](https://github.com/pest-parser/pest/releases )
- [Commits](https://github.com/pest-parser/pest/compare/v2.3.0...v2.3.1 )
---
updated-dependencies:
- dependency-name: pest_derive
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-09-13 23:22:31 -05:00
dependabot[bot]
f2386970d6
cargo: bump whoami from 1.2.1 to 1.2.3
...
Bumps [whoami](https://github.com/ardaku/whoami ) from 1.2.1 to 1.2.3.
- [Release notes](https://github.com/ardaku/whoami/releases )
- [Changelog](https://github.com/ardaku/whoami/blob/stable/CHANGELOG.md )
- [Commits](https://github.com/ardaku/whoami/compare/v1.2.1...v1.2.3 )
---
updated-dependencies:
- dependency-name: whoami
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-09-13 23:11:08 -05:00
dependabot[bot]
7a09ed4473
cargo: bump itertools from 0.10.3 to 0.10.4
...
Bumps [itertools](https://github.com/rust-itertools/itertools ) from 0.10.3 to 0.10.4.
- [Release notes](https://github.com/rust-itertools/itertools/releases )
- [Changelog](https://github.com/rust-itertools/itertools/blob/master/CHANGELOG.md )
- [Commits](https://github.com/rust-itertools/itertools/compare/v0.10.3...v0.10.4 )
---
updated-dependencies:
- dependency-name: itertools
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-09-13 23:09:32 -05:00
dependabot[bot]
8e37bbc86e
cargo: bump pest from 2.3.0 to 2.3.1
...
Bumps [pest](https://github.com/pest-parser/pest ) from 2.3.0 to 2.3.1.
- [Release notes](https://github.com/pest-parser/pest/releases )
- [Commits](https://github.com/pest-parser/pest/compare/v2.3.0...v2.3.1 )
---
updated-dependencies:
- dependency-name: pest
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-09-12 08:58:18 -07:00
Josh Soref
0e26e4bac4
spelling: the
...
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2022-09-09 11:58:37 -07:00
Josh Soref
fd3f8afe1a
spelling: nonexistent
...
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2022-09-09 11:58:37 -07:00
Josh Soref
e0bd06818e
spelling: commit
...
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2022-09-09 11:58:37 -07:00
Yuya Nishihara
31e90bdede
tests: use tempfile::TempDir instead of env::temp_dir() + random number
...
Otherwise /tmp/test-<random> file would be left.
2022-09-07 23:49:46 +09:00
Yuya Nishihara
3b835df66e
tests: do not use TempDir::into_path() which would persist the directory
...
https://docs.rs/tempfile/3.3.0/tempfile/struct.TempDir.html#method.into_path
2022-09-07 23:49:46 +09:00
Yuya Nishihara
872081c867
tests: use testutils::new_temp_dir() thoroughly
2022-09-07 23:49:46 +09:00
Yuya Nishihara
b0e9f1a852
tests: add utility function to create temporary dir with stable prefix
...
I noticed lots of /tmp/.tmp* directories were left after running tests.
This makes these directories more discoverable.
2022-09-07 23:49:46 +09:00
Martin von Zweigbergk
47e7307dcc
cargo: run cargo update
...
Our current version of `cpufeatures` was yanked so we needed to
upgrade at least that. Note that I had to add "UNICODE-DFS-2016" as an
allowed license for `cargo-deny`. I also had to upgrade `chrono` from
0.4.20 to 0.4.22 in the `Cargo.toml` files to prevent `cargo update`
from *downgrading* it in the lock file.
2022-09-06 15:50:05 -07:00
dependabot[bot]
d53d9020c9
cargo: bump insta from 1.19.0 to 1.19.1
...
Bumps [insta](https://github.com/mitsuhiko/insta ) from 1.19.0 to 1.19.1.
- [Release notes](https://github.com/mitsuhiko/insta/releases )
- [Changelog](https://github.com/mitsuhiko/insta/blob/master/CHANGELOG.md )
- [Commits](https://github.com/mitsuhiko/insta/compare/1.19.0...1.19.1 )
---
updated-dependencies:
- dependency-name: insta
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-09-01 10:50:49 -07:00
dependabot[bot]
989fcb6276
cargo: bump thiserror from 1.0.32 to 1.0.33
...
Bumps [thiserror](https://github.com/dtolnay/thiserror ) from 1.0.32 to 1.0.33.
- [Release notes](https://github.com/dtolnay/thiserror/releases )
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.32...1.0.33 )
---
updated-dependencies:
- dependency-name: thiserror
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-09-01 10:50:30 -07:00
Martin von Zweigbergk
0d1bf7cb3b
cli: disable open commits by default
2022-08-26 23:34:52 -07:00
dependabot[bot]
f8fd713bb8
cargo: bump serde_json from 1.0.83 to 1.0.85
...
Bumps [serde_json](https://github.com/serde-rs/json ) from 1.0.83 to 1.0.85.
- [Release notes](https://github.com/serde-rs/json/releases )
- [Commits](https://github.com/serde-rs/json/compare/v1.0.83...v1.0.85 )
---
updated-dependencies:
- dependency-name: serde_json
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-08-22 23:01:24 -07:00
Augie Fackler
298a972d4a
chrono: update to latest version and disable oldtime
feature
...
`oldtime` brings in an old version of the `time` crate, which we
don't need and has some issues reported in RustSec.
2022-08-22 22:33:37 -04:00
dependabot[bot]
27c2a55091
cargo: bump insta from 1.18.2 to 1.19.0
...
Bumps [insta](https://github.com/mitsuhiko/insta ) from 1.18.2 to 1.19.0.
- [Release notes](https://github.com/mitsuhiko/insta/releases )
- [Changelog](https://github.com/mitsuhiko/insta/blob/master/CHANGELOG.md )
- [Commits](https://github.com/mitsuhiko/insta/compare/1.18.2...1.19.0 )
---
updated-dependencies:
- dependency-name: insta
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-08-22 16:26:20 -07:00
Yuya Nishihara
51520bc87b
working_copy: don't follow symlinks while creating parent directories
...
Otherwise a file could be created out of the working copy directory.
This only works for untracked symlinks and sequentially "added" symlinks
and files. For "removed" and "modified" entries, the parent directories are
considered valid and fs::remove_file() will be called. This also doesn't
prevent race conditions caused by concurrent checkouts.
New create_parent_dirs() would be slightly slower than the original because
it traverses directories from the root whereas fs::create_dir_all() does that
from the leaf and exits when reached to a directory.
2022-08-17 13:22:51 +09:00
Yuya Nishihara
fbcec1fd2c
tests: don't leave /tmp/file, use tempfile::TempDir for cleanup
2022-08-17 12:15:04 +09:00
dependabot[bot]
c54c8c0519
cargo: bump insta from 1.18.1 to 1.18.2
...
Bumps [insta](https://github.com/mitsuhiko/insta ) from 1.18.1 to 1.18.2.
- [Release notes](https://github.com/mitsuhiko/insta/releases )
- [Changelog](https://github.com/mitsuhiko/insta/blob/master/CHANGELOG.md )
- [Commits](https://github.com/mitsuhiko/insta/compare/1.18.1...1.18.2 )
---
updated-dependencies:
- dependency-name: insta
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-08-12 10:00:27 -07:00
Martin von Zweigbergk
21f5bf8b15
cleanup: fix some things reported by clippy 1.63
2022-08-12 09:10:32 -07:00
dependabot[bot]
5f0cb71177
cargo: bump insta from 1.18.0 to 1.18.1
...
Bumps [insta](https://github.com/mitsuhiko/insta ) from 1.18.0 to 1.18.1.
- [Release notes](https://github.com/mitsuhiko/insta/releases )
- [Changelog](https://github.com/mitsuhiko/insta/blob/master/CHANGELOG.md )
- [Commits](https://github.com/mitsuhiko/insta/compare/1.18.0...1.18.1 )
---
updated-dependencies:
- dependency-name: insta
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-08-11 06:41:09 -07:00
dependabot[bot]
dca52545f3
cargo: bump pest_derive from 2.1.0 to 2.2.1
...
Bumps [pest_derive](https://github.com/pest-parser/pest ) from 2.1.0 to 2.2.1.
- [Release notes](https://github.com/pest-parser/pest/releases )
- [Commits](https://github.com/pest-parser/pest/compare/v2.1.0...v2.2.1 )
---
updated-dependencies:
- dependency-name: pest_derive
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-08-09 08:51:27 -07:00
dependabot[bot]
db52028510
cargo: bump thiserror from 1.0.31 to 1.0.32
...
Bumps [thiserror](https://github.com/dtolnay/thiserror ) from 1.0.31 to 1.0.32.
- [Release notes](https://github.com/dtolnay/thiserror/releases )
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.31...1.0.32 )
---
updated-dependencies:
- dependency-name: thiserror
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-08-08 15:01:06 -07:00
dependabot[bot]
32c570b714
cargo: bump insta from 1.17.0 to 1.18.0
...
Bumps [insta](https://github.com/mitsuhiko/insta ) from 1.17.0 to 1.18.0.
- [Release notes](https://github.com/mitsuhiko/insta/releases )
- [Changelog](https://github.com/mitsuhiko/insta/blob/master/CHANGELOG.md )
- [Commits](https://github.com/mitsuhiko/insta/commits/1.18.0 )
---
updated-dependencies:
- dependency-name: insta
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-08-08 14:22:41 -07:00
dependabot[bot]
5391b8bc28
cargo: bump serde_json from 1.0.82 to 1.0.83
...
Bumps [serde_json](https://github.com/serde-rs/json ) from 1.0.82 to 1.0.83.
- [Release notes](https://github.com/serde-rs/json/releases )
- [Commits](https://github.com/serde-rs/json/compare/v1.0.82...v1.0.83 )
---
updated-dependencies:
- dependency-name: serde_json
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-08-08 14:21:01 -07:00
dependabot[bot]
e19f2e74c9
cargo: bump config from 0.13.1 to 0.13.2
...
Bumps [config](https://github.com/mehcode/config-rs ) from 0.13.1 to 0.13.2.
- [Release notes](https://github.com/mehcode/config-rs/releases )
- [Changelog](https://github.com/mehcode/config-rs/blob/master/CHANGELOG.md )
- [Commits](https://github.com/mehcode/config-rs/compare/0.13.1...0.13.2 )
---
updated-dependencies:
- dependency-name: config
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-08-08 14:20:07 -07:00
dependabot[bot]
8cc6e09a28
cargo: bump pest from 2.2.0 to 2.2.1
...
Bumps [pest](https://github.com/pest-parser/pest ) from 2.2.0 to 2.2.1.
- [Release notes](https://github.com/pest-parser/pest/releases )
- [Commits](https://github.com/pest-parser/pest/compare/v2.2.0...v2.2.1 )
---
updated-dependencies:
- dependency-name: pest
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-08-08 14:19:36 -07:00
dependabot[bot]
6ad4014c07
cargo: bump bytes from 1.2.0 to 1.2.1
...
Bumps [bytes](https://github.com/tokio-rs/bytes ) from 1.2.0 to 1.2.1.
- [Release notes](https://github.com/tokio-rs/bytes/releases )
- [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md )
- [Commits](https://github.com/tokio-rs/bytes/commits )
---
updated-dependencies:
- dependency-name: bytes
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-08-08 14:19:22 -07:00
Yuya Nishihara
cc860f771c
working_copy: do not overwrite ignored file
...
Since the file should have been removed on Diff::Modified case, we can always
expect that write_file/conflict() creates new file.
2022-08-07 15:06:30 +02:00
Yuya Nishihara
b149cb07cc
working_copy: make set_sparse_patterns() ignore existing working copy files
...
This doesn't work yet since write_file() overwrites the existing file, which
will be fixed by the next patch.
I've added a callback parameter to update() just because that's the easiest
option. If we want to report the number of the conflicting files (through
CheckoutStats), the callback interface wouldn't work nicely and the error
handling would have to be moved to the update() body. If we want to make
both check_out() and set_sparse_patterns() ignore EEXIST error, we can
eliminate the calback parameter at all.
2022-08-07 15:06:30 +02:00
Yuya Nishihara
f1df8215a2
working_copy: extract inner action of update() loop as closure
...
It serves as a try_block where I'm going to add EEXIST handling.
2022-08-07 15:06:30 +02:00
Yuya Nishihara
0ac8d370df
tests: leverage fs::read() in test_gitignores_checkout_overwrites_ignored()
2022-08-07 15:06:30 +02:00
dependabot[bot]
e7fd575ee8
cargo: bump git2 from 0.14.4 to 0.15.0
...
Bumps [git2](https://github.com/rust-lang/git2-rs ) from 0.14.4 to 0.15.0.
- [Release notes](https://github.com/rust-lang/git2-rs/releases )
- [Commits](https://github.com/rust-lang/git2-rs/compare/0.14.4...git2-curl-0.15.0 )
---
updated-dependencies:
- dependency-name: git2
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-07-29 21:09:25 +02:00
dependabot[bot]
19c01d9877
cargo: bump pest from 2.1.3 to 2.2.0
...
Bumps [pest](https://github.com/pest-parser/pest ) from 2.1.3 to 2.2.0.
- [Release notes](https://github.com/pest-parser/pest/releases )
- [Commits](https://github.com/pest-parser/pest/commits/v2.2.0 )
---
updated-dependencies:
- dependency-name: pest
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-07-29 21:08:55 +02:00
dependabot[bot]
e857152fa0
cargo: bump insta from 1.16.0 to 1.17.0
...
Bumps [insta](https://github.com/mitsuhiko/insta ) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/mitsuhiko/insta/releases )
- [Changelog](https://github.com/mitsuhiko/insta/blob/master/CHANGELOG.md )
- [Commits](https://github.com/mitsuhiko/insta/commits )
---
updated-dependencies:
- dependency-name: insta
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-07-29 14:35:12 +02:00
dependabot[bot]
db971fa29f
cargo: bump test-case from 2.1.0 to 2.2.1
...
Bumps [test-case](https://github.com/frondeus/test-case ) from 2.1.0 to 2.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/v2.1.0...v2.2.1 )
---
updated-dependencies:
- dependency-name: test-case
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-07-24 10:52:00 +02:00
dependabot[bot]
202f9038c7
cargo: bump insta from 1.15.0 to 1.16.0
...
Bumps [insta](https://github.com/mitsuhiko/insta ) from 1.15.0 to 1.16.0.
- [Release notes](https://github.com/mitsuhiko/insta/releases )
- [Changelog](https://github.com/mitsuhiko/insta/blob/master/CHANGELOG.md )
- [Commits](https://github.com/mitsuhiko/insta/compare/1.15.0...1.16.0 )
---
updated-dependencies:
- dependency-name: insta
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-07-24 10:51:38 +02:00
Martin von Zweigbergk
cb8f7b8184
store: inline Store::load()
into caller
...
I think it makes sense for `RepoLoader` to know what kind of backend
to create. Then we can have some way of extending it for other backend
types.
2022-07-21 17:04:18 +02:00
Martin von Zweigbergk
25b922cd0b
store: reduce duplication in Workspace
and Repo
init code
...
There is a bit of duplicated across the three functions for creating a
`Workspace` and `Repo`. This patch reduces that duplication by passing
in a closure.
In addition to reducing duplication, this is a step towards making it
easier to add new backends.
2022-07-21 17:04:18 +02:00
dependabot[bot]
bf8a8caf01
cargo: bump bytes from 1.1.0 to 1.2.0
...
Bumps [bytes](https://github.com/tokio-rs/bytes ) from 1.1.0 to 1.2.0.
- [Release notes](https://github.com/tokio-rs/bytes/releases )
- [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md )
- [Commits](https://github.com/tokio-rs/bytes/compare/v1.1.0...v1.2.0 )
---
updated-dependencies:
- dependency-name: bytes
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-07-21 07:11:35 +02:00
Martin von Zweigbergk
36c6236f62
workspace: remove upgrade code for workspace without .jj/repo
2022-07-14 10:58:11 -07:00
Martin von Zweigbergk
b84be06c08
conflicts: minimize diffs in materialized conflicts
...
One advantage of our conflict marker style (compared to the usual
3-way markers) is that they provide the user with the diff between the
base and one side so the user doesn't have to do that in their head
(which is how I use 3-way markers anyway). However, since we currently
always use the "first" side for the diff, that diff can be larger than
if we had picked the other side, which makes the marker style worse
than the usual 3-way markers. This has bothered me many times and it's
about time we fix it.
2022-07-12 07:46:45 -07:00
Martin von Zweigbergk
fc578a2dd7
conflicts: use insta
in conflict tests
2022-07-12 07:46:45 -07:00
Martin von Zweigbergk
97cecb245d
cleanup: remove workaround for fixed split_inclusive()
bug
...
The fix for rustlang/rust#89716 was released in 1.59.0, which is our
MSRV.
2022-07-10 11:09:01 -07:00
dependabot[bot]
40afd98720
cargo: bump regex from 1.5.6 to 1.6.0
...
Bumps [regex](https://github.com/rust-lang/regex ) from 1.5.6 to 1.6.0.
- [Release notes](https://github.com/rust-lang/regex/releases )
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md )
- [Commits](https://github.com/rust-lang/regex/compare/1.5.6...1.6.0 )
---
updated-dependencies:
- dependency-name: regex
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-07-06 08:47:33 -07:00
Martin von Zweigbergk
3a351bee7d
cli: don't keep Repo references from before transaction start
...
We had a recent bug where we used a repo reference from before we
started a transaction and modified the repo. While it's often safe and
correct to use such references, it isn't always. This patch removes
all such cases. I think it generally makes the code clearer, and
better prepared for #50 , if we ever get around to that. I found these
by temporarily making `WorkspaceCommandHelper::start_transaction()`
take a mutable reference.
2022-07-06 07:21:57 -07:00
Martin von Zweigbergk
1b5cd140d5
CommitBuilder: remove unneeded store
arguments
...
The `CommitBuilder::store` field is used only in
`CommitBuilder::write_to_repo()`, but we can easily get access to the
`Store` from the `repo` argument there, so let's remove the field.
2022-07-06 07:21:57 -07:00
Martin von Zweigbergk
3aaeca9e1c
tests: add test for successful push
...
I think I had not added tests for successful push before because I
thought there was some issue with testing it with libgit2. There *is*
an issue, which is that libgit2 requires the remote to be bare when
it's on local disk, but we can very easily make the git repo bare in
this test.
I also updated the error handling in the `git` module to not let
follow-on errors hide the real error and to not fail if two branches
moved to the same commit.
2022-07-04 22:50:40 -07:00
Martin von Zweigbergk
418ab22be0
cli: add config for using only new UX for open commits
...
By adding `ui.open-commits=false` in your config, you can now make `jj
checkout` always create a new working-copy commit on top of the
specified commit. If the config is set, open commits will also appear
in the same color as closed commits in `jj log` etc. This will let
some of us experiment with the new UX before we decide if it's a good
idea or not. I left `jj close` in place because it's useful for
setting a description and creating a new commit in one step.
I didn't mention the new config in the release notes because I hope we
can reach a decision and remove the config before the next release.
2022-07-01 08:58:08 +08:00
Martin von Zweigbergk
42b2937d5e
cli: add jj edit
for editing a commit in the wokring copy
2022-07-01 08:58:08 +08:00
Martin von Zweigbergk
6952b4f91e
rewrite: create new checkout on top iff commit abandoned
...
When rebasing commits after rewrites, we also update all workspaces'
checkouts. If the new commit is closed, we create a new commit on
top. Since we're hoping to remove the open/closed concept, we need a
new condition. I considered creating a new commit on top if the change
ID was different from before the rewrite. However, that would make at
least `jj split` more complicated because it makes the first commit
keep the change ID but it wants the second commit to be checked
out. This patch instead creates the new commit on top only when the
original commit was abandoned.
2022-07-01 08:58:08 +08:00
Martin von Zweigbergk
b0912b3199
repo: add a function for getting workspaces by checkout
2022-07-01 08:58:08 +08:00
Martin von Zweigbergk
0e812220af
rewrite: always use MutableRepo::edit()
when updating checkouts
...
I think it's conceptually simpler to create a new commit and set that
commit to be the checkout in each workspace than to check out the
commit in one workspace and edit in the others.
2022-07-01 08:58:08 +08:00
Martin von Zweigbergk
bd1a8bd930
repo: split out an edit()
function from MutableRepo::check_out()
2022-07-01 08:58:08 +08:00
Martin von Zweigbergk
9a3c6928cc
repo: extract a function for abandoning previous checkout
...
This is a little refactoring to prepare for removing the `open` flag
off of commits.
2022-07-01 08:58:08 +08:00
Martin von Zweigbergk
8667e374b8
rewrite: pass a single new commit into update_checkouts()
...
`DescendantRebaser::update_checkouts()` only cares about the first
element in `new_commit_ids`, so let's just pass in a single commit ID
instead.
2022-07-01 08:58:08 +08:00
dependabot[bot]
73729e4517
cargo: bump serde_json from 1.0.81 to 1.0.82
...
Bumps [serde_json](https://github.com/serde-rs/json ) from 1.0.81 to 1.0.82.
- [Release notes](https://github.com/serde-rs/json/releases )
- [Commits](https://github.com/serde-rs/json/compare/v1.0.81...v1.0.82 )
---
updated-dependencies:
- dependency-name: serde_json
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-07-01 02:19:56 +08:00
Martin von Zweigbergk
0fe203ce8f
cleanup: fix an unused import on Windows
...
`OperationId` is only used in `test_snapshot_special_file()`, which
doesn't run (or even build) on Windows.
2022-06-29 07:21:24 +08:00
Martin von Zweigbergk
2c21ed40d8
working_copy: don't crash if file becomes directory while snapshotting
...
If a file gets replaced by a directory right after list files in a
directory but before we stat the file, we currently crash. Let's
instead treat it as a missing file, using the mechanism introduced for
#258 .
2022-06-21 05:38:28 +07:00
dependabot[bot]
0c3334e4e4
cargo: bump insta from 1.14.1 to 1.15.0
...
Bumps [insta](https://github.com/mitsuhiko/insta ) from 1.14.1 to 1.15.0.
- [Release notes](https://github.com/mitsuhiko/insta/releases )
- [Changelog](https://github.com/mitsuhiko/insta/blob/master/CHANGELOG.md )
- [Commits](https://github.com/mitsuhiko/insta/compare/1.14.1...1.15.0 )
---
updated-dependencies:
- dependency-name: insta
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-06-21 04:10:57 +07:00
Martin von Zweigbergk
29a71c619a
working_copy: ignore special files
...
This patch makes us treat special files (e.g. Unix sockets) as absent
when snapshotting the working copy. We can consider later reporting
such files back to the caller (possibly via callback) so it can inform
the user about them.
Closes #258
2022-06-20 09:26:29 +07:00
Martin von Zweigbergk
a42b24c014
working_copy: on checkout, record file state's type and size
...
This patch is essentially f6a516ff6d
taken further, to also apply to
when we write a symlink or a conflict. As with regular files, these
races seem very unlikely to happen, but I found these cases while
working on #258 , so let's fix. Fixing it also means that we don't need
to handle these transition cases in the next patch (when
`file_states()` can indicate that the file is e.g. a socket).
2022-06-20 09:26:29 +07:00
dependabot[bot]
2716f17d71
cargo: bump uuid from 1.1.1 to 1.1.2
...
Bumps [uuid](https://github.com/uuid-rs/uuid ) from 1.1.1 to 1.1.2.
- [Release notes](https://github.com/uuid-rs/uuid/releases )
- [Commits](https://github.com/uuid-rs/uuid/compare/1.1.1...1.1.2 )
---
updated-dependencies:
- dependency-name: uuid
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-06-13 10:06:25 -07:00
Martin von Zweigbergk
e8e03880cf
matchers: add IntersectionMatcher
...
I plan to use this matcher for some future `jj add` command (for
#323 ). The idea is that we'll do a path-restricted walk of the working
copy based on the intersection of the sparse patterns and any patterns
specified by the user. However, I think it will be useful before that,
for @arxanas's fsmonitor feature (#362 ).
2022-06-09 21:27:51 -07:00
Martin von Zweigbergk
4fda0f8b6a
matchers: simplify DifferenceMatcher
slightly
...
The new `Visit::Nothing` variant lets us more easily restructure
`DifferenceMatcher::visit()` to make it handle the case of not
removing anything. I think this makes the code a little clearer.
2022-06-09 21:27:51 -07:00
Martin von Zweigbergk
169261ca21
matchers: add a Visit::Nothing
variant
...
I didn't initially create a `Visit::Nothing` variant because I was
worried that the fact that there then are two ways of expressing this
value (there's also `Visit::Specific` with empty sets). However, the
value is quite useful for pattern matching, so I'm now thinking it's
worth the risk.
2022-06-09 21:27:51 -07:00
Martin von Zweigbergk
bcf94bd70e
CommitBuilder: when rewriting commit, replace placeholder user/email
...
If a commit's author field has the placeholder user/email values
(i.e. "(no name configured)" and "(no email configured)"), and they
have now configured their email and username, they probably want us to
update the author field with the new information, so that's what this
patch does. Thanks to durin42@ for the suggestion on #322 .
2022-06-06 17:31:01 -07:00
dependabot[bot]
1e87edb917
cargo: bump uuid from 1.1.0 to 1.1.1
...
Bumps [uuid](https://github.com/uuid-rs/uuid ) from 1.1.0 to 1.1.1.
- [Release notes](https://github.com/uuid-rs/uuid/releases )
- [Commits](https://github.com/uuid-rs/uuid/compare/1.1.0...1.1.1 )
---
updated-dependencies:
- dependency-name: uuid
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-06-01 09:07:34 -07:00
dependabot[bot]
f6e95decb4
cargo: bump insta from 1.14.0 to 1.14.1
...
Bumps [insta](https://github.com/mitsuhiko/insta ) from 1.14.0 to 1.14.1.
- [Release notes](https://github.com/mitsuhiko/insta/releases )
- [Changelog](https://github.com/mitsuhiko/insta/blob/master/CHANGELOG.md )
- [Commits](https://github.com/mitsuhiko/insta/compare/1.14.0...1.14.1 )
---
updated-dependencies:
- dependency-name: insta
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-05-31 09:09:14 -07:00
Martin von Zweigbergk
8ae9540f2c
cli: make move/squash/unsquash
keep empty working-copy commit
...
If the source commit becomes empty as a result of
`move/squash/unsquash`, we abandon it. However, perhaps we shouldn't
do that if the source commit is a working-copy commit because
working-copy commits are often work-in-progress commits.
The background for this change is that @arxanas had just started a new
change and had set a description on it, and then decided to make some
changes in the working copy that should be in the parent
commit. Running `jj squash` then abandoned the working-copy commit,
resuling in the description getting lost.
2022-05-30 07:52:24 -07:00
Martin von Zweigbergk
540f2eb583
errors: avoid using Debug
formatting on error types
...
The regular `Display` format is (not surprisingly) more user-friendly,
as pointed out by @yuja.
I also switched to using format strings for these cases, and some
nearby strings for consistency.
2022-05-25 19:33:59 -07:00
dependabot[bot]
ee87215e1c
cargo: bump uuid from 1.0.0 to 1.1.0
...
Bumps [uuid](https://github.com/uuid-rs/uuid ) from 1.0.0 to 1.1.0.
- [Release notes](https://github.com/uuid-rs/uuid/releases )
- [Commits](https://github.com/uuid-rs/uuid/compare/1.0.0...1.1.0 )
---
updated-dependencies:
- dependency-name: uuid
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-05-25 12:25:15 -07:00
Martin von Zweigbergk
c9ab0a20d3
working_copy: stat path without traversing from root in one case
...
We can easily make the `DirEntry` available here, so we can call
`.metadata()` on that instead of on the `Path`. I think that avoids
walking the path. I'm sure this has no significant impact on
performance, but it's also almost as readable.
2022-05-25 11:51:18 -07:00
Martin von Zweigbergk
f6a516ff6d
working_copy: record expected written size, not actual size, on checkout
...
When we have just written a file to disk on checkout, let's record the
size we expected instead of what we got from `fstat()`. This should
address a race where the file was modified between the time we wrote
it and the time we requested its stat. I just happened to notice this
while going through the code; it seems very unlikely to be noticed in
practice.
2022-05-25 11:51:18 -07:00
Martin von Zweigbergk
fa4b5aa2c7
working_copy: propagate most errors on checkout
2022-05-25 11:51:18 -07:00
Martin von Zweigbergk
9aa2009320
working_copy: improve error handling when getting file stats
2022-05-25 11:51:18 -07:00
Martin von Zweigbergk
9feb786a51
working_copy: extract function for getting mtime
...
We had a few lines of duplicated code for this, so I moved it into a
function and added better error handling.
2022-05-25 11:51:18 -07:00
Martin von Zweigbergk
23f9e6479f
working_copy: stop suppressing a warning that doesn't happen
...
We mutate the `new_file_state` variable on line 513 regardless of
platform these days, so we don't need to suppress the warning on Unix.
2022-05-25 11:51:18 -07:00
Martin von Zweigbergk
ecb86118e5
working_copy: get file metadata using open file descriptor
...
When we have just written a file or conflict, we can get metadata for
it via the open file descriptor instead of using the path. That
removes the risk of a race where the file got removed or replaced by
another file type (at least on Unix).
2022-05-25 11:51:18 -07:00
Martin von Zweigbergk
e7aaf2f95f
working_copy: pass Metadata
into file_state()
...
This is a refactoring to prepare for getting the metadata from an
already open file when possible.
2022-05-25 11:51:18 -07:00
Martin von Zweigbergk
d451242746
working_copy: propagate backend errors on checkout
2022-05-25 11:51:18 -07:00
Martin von Zweigbergk
899325e94e
working_copy: use #[from]
to slightly simplify error handling
2022-05-25 11:51:18 -07:00
Martin von Zweigbergk
9dbf32db3a
settings: fix a clippy warning
2022-05-25 10:02:11 -07:00
Tal Pressman
9831b82a98
Add configuration option to override branch name prefix.
2022-05-26 00:41:52 +09:00
dependabot[bot]
044bc93aeb
cargo: bump git2 from 0.14.2 to 0.14.4
...
Bumps [git2](https://github.com/rust-lang/git2-rs ) from 0.14.2 to 0.14.4.
- [Release notes](https://github.com/rust-lang/git2-rs/releases )
- [Commits](https://github.com/rust-lang/git2-rs/compare/0.14.2...0.14.4 )
---
updated-dependencies:
- dependency-name: git2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-05-24 08:56:29 -07:00
Martin von Zweigbergk
45c9d297c2
drop: downgrade two assertions to error messages
...
These assertions were there to catch bugs, but when the bugs happen,
the assertions can obsure the underlying error (as @tp-woven found out
on #258 ). Let's just print errors instead.
2022-05-23 15:36:18 -07:00
dependabot[bot]
ca5a2391ab
cargo: bump regex from 1.5.5 to 1.5.6
...
Bumps [regex](https://github.com/rust-lang/regex ) from 1.5.5 to 1.5.6.
- [Release notes](https://github.com/rust-lang/regex/releases )
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md )
- [Commits](https://github.com/rust-lang/regex/compare/1.5.5...1.5.6 )
---
updated-dependencies:
- dependency-name: regex
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-05-23 09:10:52 -07:00
Martin von Zweigbergk
5c6f82ec7b
tests: remove &UserSettings
argument from TestRepo::init()
...
We don't even have any settings that affect the repo, so there's no
point in passing the settings. I think this was a leftover from before
we separated out the "workspace" concept; now we no longer create a
working-copy commit when we initialize a repo (we do that when we
attach the workspace).
2022-05-21 22:33:16 -07:00
Martin von Zweigbergk
4cf04f373e
tests: move init_{repo,workspace}
functions onto types
...
I tried to create a `TestRepo` and was surprised that I couldn't do
that by calling a function on it.
2022-05-21 22:33:16 -07:00