Commit Graph

1081 Commits

Author SHA1 Message Date
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
Martin von Zweigbergk
819ad475f5 docs: give Google credit for letting this be my 20% project
This has been my 20% for at least a year (dedicating most of my
Wednesdays to it), so let's give Google some credit for that in the
README.
2022-02-08 09:59:28 -08:00
Martin von Zweigbergk
2dbdff1ad1 cli: add support for matching directories
A few commands (`restore`, `diff`, and `untrack` so far) accept path
arguments, but they only support files. Let's make them work with
directories too.
2022-02-06 14:49:22 -08:00
Martin von Zweigbergk
cce12261d8 matchers: add a matcher for path prefixes (#52)
It's useful to be able to match path prefixes for many commands,
e.g. to allow `jj restore src` to restore all files in under `src/`
(or a file called `src`). I also plan to use it for sparse checkouts.

We'll need to be able to match path prefixes
2022-02-06 14:49:22 -08:00
Martin von Zweigbergk
d49892431b matchers: make visit() return cloned sets instead of references
This is just to avoid the lifetime parameter. It was a premature
optimization to return a reference (we don't even use the matchers
yet, so it cloning these sets clearly doesn't show up in profiling).
2022-02-05 20:24:53 -08:00
Martin von Zweigbergk
3c787459dc tests: remove a leftover removal of a checkout in a revset test
The test setup no longer attaches a workspace to the repo, so there's
also no need remove it.
2022-02-05 20:11:50 -08:00
Martin von Zweigbergk
80aeae48b5 cli: fix git diff to not add context lines to count twice
We add `num_after_lines` to the line ranges just a few lines before
the place I removed the addition from in this patch.
2022-02-05 16:00:54 -08:00
Martin von Zweigbergk
f294df6e8e view: inline checkout() into remaining few callers 2022-02-05 15:43:37 -08:00
Martin von Zweigbergk
9b275a406c tests: don't create workspaces in CommitBuilder tests 2022-02-05 15:39:03 -08:00
Martin von Zweigbergk
980e80618c tests: don't create workspaces in conflict tests 2022-02-05 15:39:03 -08:00
Martin von Zweigbergk
2af6b4c58d tests: don't create workspaces in operation tests 2022-02-05 15:35:59 -08:00
Martin von Zweigbergk
2eb46fda8a tests: don't create workspaces in diff-summary tests 2022-02-05 15:31:09 -08:00
Martin von Zweigbergk
978cafe387 tests: don't create workspaces in RevsetGraphIterator tests 2022-02-05 15:30:27 -08:00