Commit Graph

943 Commits

Author SHA1 Message Date
Martin von Zweigbergk
c59dcd76a4 cargo: upgrade clap to 3.1.0
This avoids some deprecation warnings from `cargo install` (which
picks the latest version instead of the locked version by default).
2022-02-27 13:16:02 -08:00
Martin von Zweigbergk
1978a7d038 docs: use stable Rust toolchain for installation
We don't need the nightly toolchain anymore since #70 (thanks,
@arxanas!).
2022-02-27 12:49:00 -08:00
Martin von Zweigbergk
a88865a418 cli: add an option to avoid committing the working copy
It can be useful in command prompts and scripts to be able to quickly
get e.g. the `jj status` output without spending time committing the
working copy (perhaps because some background process continuously
commits the working copy). One can already do that by passing
`--at-op=<operation ID>`, but then one needs to look up the operation
ID first. That is both extra work for the user/script and it means
there's an extra `jj op log` invocation to get the operation ID. Let's
have a global flag to make it easy and efficient to do.
2022-02-27 12:12:24 -08:00
Martin von Zweigbergk
1a0b5b9c9e docs: mention user-specific config path on different platforms
Since #85, we load the user's config from a path under
`dirs::config_dir()`. It's probably not obvious to all users where to
put the file, so let's describe that. (I didn't know where to put the
file on my Mac until I looked at the function's documentation.)
2022-02-27 11:48:45 -08:00
Martin von Zweigbergk
648cfd698c cleanup: run rustfmt 2022-02-27 10:59:28 -08:00
Matthew L Daniel
88cc9ffcbc Fix a link from 423a894 2022-02-26 00:15:53 -08:00
Cole Mickens
fbe8eb47db lib/settings: try to load from platform config_dir 2022-02-26 00:09:34 -08:00
Waleed Khan
76974a9050 build: suppress unstable_name_collisions warnings on stable
Originally, I had thought that these warnings would only potentially show up in nightly because there was a feature which exposed these functions, and we would be able to enable that feature and conditionally not define the conflicting methods. But it looks like these warnings also show up in stable. I've just suppressed each of them individually. Other options would be to rename them and just make them wrapper methods, or to disable `unstable_name_collisions` warnings at a higher scope (possibly including at the crate level).
2022-02-23 23:41:55 -08:00
Waleed Khan
38aee9f749 ci: add Clippy stable check
Currently, `main` has Clippy lint warnings on stable, but not on nightly.
2022-02-23 23:41:55 -08:00
Martin von Zweigbergk
f9298582a7
Merge pull request #71 from pingiun/remove-rust-overlay
Remove rust nightly nix overlay
2022-02-21 09:28:23 -08:00
Jelle Besseling
54a6adf47a
Remove rust nightly overlay 2022-02-21 18:14:48 +01:00
Martin von Zweigbergk
5e7f69c4e8
Merge pull request #70 from arxanas/stable-rust
Support stable Rust
2022-02-21 03:17:03 -08:00
Waleed Khan
b011805fc7 ci: use stable Rust for builds
We still use nightly Clippy to ensure that 1) it builds under nightly and 2) that we pick up any new lints.
2022-02-20 22:21:14 -08:00
Waleed Khan
9202aae8b1 build: conditionally use map_first_last feature if available 2022-02-20 22:21:14 -08:00
Waleed Khan
dd3272fe90 build: use assert_matches crate
The `assert_matches` feature is nightly-only, so use this crate as a shim.
2022-02-20 22:21:14 -08:00
Waleed Khan
75480c2bdc build: migrate diff_bench to criterion
Benchmarking is currently nightly-only, so to get `jujutsu` to build on stable, we need to use a stable benchmarking library.
2022-02-20 22:21:14 -08:00
Waleed Khan
261cd1a1c4 build: add shims for nightly feature map_first_last 2022-02-20 22:16:07 -08:00
Waleed Khan
325eb4f4ca Add .editorconfig
This file sets formatting defaults for editors. See https://editorconfig.org/.
2022-02-20 22:16:07 -08:00
Martin von Zweigbergk
c3a5ea0062
Merge pull request #66 from pingiun/add-flake
Add flake.nix
2022-02-20 15:33:50 -08:00
Jelle Besseling
9fb580b6ee
Add nix installation instructions 2022-02-20 22:53:04 +01:00
Jelle Besseling
e25752c746
Add updateToolchainManifest explanation 2022-02-20 21:56:52 +01:00
Jelle Besseling
e3d40a1904
Add comment about nix build 2022-02-20 21:49:54 +01:00
Jelle Besseling
dde64d244a
Add generated attributes 2022-02-20 21:49:44 +01:00
Jelle Besseling
f8ef71cfa7
Fix program name 2022-02-20 21:49:15 +01:00
Jelle Besseling
327ea5390d
Add nix check workflow 2022-02-20 21:48:51 +01:00
Jelle Besseling
50b8357234
Add flake.nix 2022-02-20 21:30:05 +01:00
Martin von Zweigbergk
2916cb2d9f cli: exit with code 1 on invalid config
This should have been part of the previous commit (fix for #55).
2022-02-19 23:45:41 -08:00
Martin von Zweigbergk
108b785a36 cli: don't panic on invalid config
If `~/.jjconfig` is invalid, we currently simply panic. That results
in a poor error message. We should handle the error instead.

Closes #55.
2022-02-19 23:38:23 -08:00
Martin von Zweigbergk
f4cadff6e1 README: description additional installation steps for Mac
I'm not sure which steps are needed and what they depend on (I didn't
need the `pkg-config` bits), so the steps are a little vague for now.

Closes #62.
2022-02-19 23:23:58 -08:00
Martin von Zweigbergk
4a0bd07e8c README: add note about use of libgit2 C library
Closes #56.
2022-02-19 22:55:48 -08:00
Martin von Zweigbergk
d9b364442e cleanup: update references to .jj/store/git to .jj/repo/store/git
The `store/` directory (and many others) recently moved into
`.jj/repo/`, but I forgot to update a few places.
2022-02-17 22:44:14 -08:00
Martin von Zweigbergk
7c247116b9 repo: remove code for upgrading old repos to have .jj/store/git/
1b6efdc3f8 moved `.jj/git/` into `.jj/store/` for consistency with
the layout of native stores. It provided automatic format upgrades for
repos with the old format. It's been about four months now, so let's
remove the migration code.
2022-02-17 22:44:05 -08:00
Martin von Zweigbergk
1eb913d444 cli: when setting git HEAD in collocated repo, also update own record
When running in a working copy collocated with git's, we export the
working copy's commit's parent to git after every command. However, we
forgot to update our own record of git's HEAD. That means that on
subsequent imports from git, it'll look like the user had updated HEAD
using a git command. When we detect that, we trust that the user had
taken care of the changes in the working copy and we simply abandon
our old working copy commit. That led to the bug reported in $54,
where the second commit of a `jj split` got lost.

The fix is to also update our record of where git's HEAD is when we
tell git to update it.

Closes #54.
2022-02-17 22:12:30 -08:00
Martin von Zweigbergk
03e6b8c0e6 working_copy: take Tree, not CommitId, as argument to check_out()
We no longer need the commit ID, so we shouldn't make the callers pass
it. This lets us simplify several tests, because they no longer to
create commits just to check out a tree in the working copy.
2022-02-13 12:14:34 -08:00
Martin von Zweigbergk
315e5e87a3 working_copy: take a tree object instead of ID in TreeState::check_out()
The callers mostly have the tree object available anyway.
2022-02-13 12:12:08 -08:00
Martin von Zweigbergk
00c9a1ae11 working_copy: stop taking commit ID in LockedWorkingCopy::finish()
We used to use the value to detect races, but we use the tree ID and
the operation ID these days, so we don't need the commit ID.

By changing this, we can avoid creating some commit IDs in tests,
which is why I tackled this issue now.
2022-02-12 23:48:06 -08:00
Martin von Zweigbergk
cde3609163 working_copy: stop taking initial checkout in constructor
We don't use the value anymore.
2022-02-12 23:45:05 -08:00
Martin von Zweigbergk
993de96fc7 working_copy: stop keeping track of commit ID 2022-02-12 17:22:37 -08:00
Martin von Zweigbergk
bde7b8f449 cli: print working copy's operation ID instead of commit ID in debug command 2022-02-12 17:16:19 -08:00
Martin von Zweigbergk
e098c01935 working_copy: replace commit ID by tree ID for checking for changes
What matters for the working copy is the tree ID. We should be able to
remove the commit ID. This patch gets us close.
2022-02-12 17:16:19 -08:00
Martin von Zweigbergk
21d277b7dc cli: check for concurrent operation during jj untrack
This patch addresses the TODO about a (tiny) race that could happen if
`jj untrack` was run concurrently with another operation.
2022-02-12 16:52:18 -08:00
Martin von Zweigbergk
537b1de7d9 working_copy: move check of old commit ID on checkout to higher level
There are only two callers of `LockedWorkingCopy::check_out()`. One is
in `commands.rs`. That caller already checks after taking the lock
that the old commit ID is as expected. The other caller is
`WorkingCopy::check_out()`. We can simply move the check to that level
since it's the only caller that cares now.
2022-02-12 14:27:40 -08:00
Martin von Zweigbergk
be7b0e6839 cargo: upgrade dependencies 2022-02-09 22:21:39 -08:00
Martin von Zweigbergk
117bf13708 cargo: upgrade backoff 2022-02-09 22:21:39 -08:00
Martin von Zweigbergk
33cc6b1253 cargo: upgrade blake2 2022-02-09 22:19:04 -08:00
Martin von Zweigbergk
de6e77dcdf cargo: remove unused dependencies from CLI crate 2022-02-09 22:14:53 -08:00
Martin von Zweigbergk
68710366b4 cli: add support for restricting jj files by paths 2022-02-09 12:24:15 -08:00
Martin von Zweigbergk
dabfd04da6 tests: attempt to de-flake operation-merging test
We resolve checkouts in favor of the first-committed operation (which
is more likely to have managed to update the working copy). The test
case has been flaky on GitHub lately. I've run it 1000 times on my
machine without failure. I don't know if GitHub's machines are just
faster in some way (SSD, maybe) that makes them finish the two
operations in the test in the same millisecond. Let's add a
1-millisecond sleep to see if that helps. If it doesn't, then maybe
the issue is that the clock has lower precision (or their clocks can
go backwards?).
2022-02-09 11:15:10 -08:00
Martin von Zweigbergk
b74851e005 working_copy: make sure discarded update is not visible
`LockedWorkingCopy::discard()` shouldn't result in changes to the
on-disk state, but `LockedWorkingCopy::check_out()` may have already
written a state file, which is surprising. The changes also remain in
memory, which is also surprising. Let's fix both of those issues.
2022-02-09 10:40:51 -08:00
Martin von Zweigbergk
d24cf15f2d tests: in .gitignore test, explicitly save working copy state
One of the .gitignore tests writes a tree from the working copy
twice. However, it discards the `LockedWorkingCopy` instance after the
first write, so the second write shouldn't really see the changes from
the first write. It does see them because we don't clear them in
memory (and we also surprisingly write them to disk). I'm about to fix
that, so the test needs to be fixed first.
2022-02-09 10:34:52 -08:00