Commit graph

21 commits

Author SHA1 Message Date
Martin von Zweigbergk
3f24411bbf cargo: upgrade the config crate from 0.11.0 to 0.12.0
This required a bit of work.
2022-03-18 22:33:04 -07:00
Martin von Zweigbergk
d56ae79d3f working_copy: let caller pass in base Git ignores (#65, #87)
The library crate shouldn't look up the user's `$HOME` directory
(maybe the library is used by a server process), so let's have the
caller pass it into the library crate instead.
2022-03-12 10:48:06 -08:00
Martin von Zweigbergk
2291bfffce cli: add a WorkspaceCommandHelper::edit_diff() proxy (#65, #87)
I'm about to make callers pass in "base" Git ignores when writing a
tree from the working copy. `edit_diff()` will then need to pass
that. It'll be easier to do that if we have a proxy on
`WorkspaceCommandHelper`.
2022-03-12 10:48:06 -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
9a640bfe13 working_copy: save TreeState later, just before releasing lock
I was surprised that we save the `TreeState` before
`LockedWorkingCopy::finish()`. That means that even if the caller
instead decides to discard the changes, some changes will already have
been written.
2022-01-19 08:32:59 -08:00
Martin von Zweigbergk
99e5a28d17 cli: don't materialize conflicts when editing diffs
The diff-editing code shares the `TreeState` functionality with the
working-copy code. That means we can now let the user edit conflicts
without materializing them first. So now the user can do e.g. `jj edit
-r <some commit>` and resolve only some of the conflicts.
2021-11-07 15:17:51 -08:00
Martin von Zweigbergk
ce5e95fa80 store: rename Store to Backend and StoreWrapper to Store
For what's currently called `Store` in the code, I have been using
"backend" in plain text. That probably means that `Backend` is a good
name for it.
2021-09-12 12:02:10 -07:00
Martin von Zweigbergk
4c416dd864 cleanup: let Clippy fix a bunch of warnings 2021-06-14 00:27:31 -07:00
Martin von Zweigbergk
dd4c47f373 tree: support filtering diff by matcher
This change teaches `Tree::diff()` to filter by a matcher. It only
filters the result so far; it does not restrict the tree walk to what
`Matcher::visit()` says is necessary yet. It also doesn't teach the
CLI to create a matcher and pass it in.
2021-06-09 16:26:58 -07:00
Martin von Zweigbergk
fdeb499836 trees: merge into tree module 2021-06-05 14:20:07 -07:00
Martin von Zweigbergk
03ea8779df cli: make diff editor configurable
This patch adds a simple `ui.diff-editor` config, which defaults to
`meld`. This fixes issue #10.
2021-05-31 09:40:29 -07:00
Martin von Zweigbergk
54f6165ef1 repo_path: replace remaining uses of DirRepoPath by RepoPath 2021-05-19 15:11:04 -07:00
Martin von Zweigbergk
03ae1b747c repo_path: remove FileRepoPath in favor of just RepoPath
I had initially hoped that the type-safety provided by the separate
`FileRepoPath` and `DirRepoPath` types would help prevent bugs. I'm
not sure if it has prevented any bugs so far. It has turned out that
there are more cases than I had hoped where it's unknown whether a
path is for a directory or a file. One such example is for the path of
a conflict. Since it can be conflict between a directory and a file,
it doesn't make sense to use either. Instead we end up with quite a
bit of conversion between the types. I feel like they are not worth
the extra complexity. This patch therefore starts simplifying it by
replacing uses of `FileRepoPath` by `RepoPath`. `DirRepoPath` is a
little more complicated because its string form ends with a '/'. I'll
address that in separate patches.
2021-05-19 15:11:04 -07:00
Martin von Zweigbergk
66460477b7 cli: add instructions for all diff-editing (aka interactive) commands
Now when you do e.g. `jj split`, you'll get a `JJ-INSTRUCTIONS` file
as part of the diff you're editing.
2021-05-16 09:31:16 -07:00
Martin von Zweigbergk
d42e6c77b2 project: rename project from Jujube to Jujutsu
"Jujutsu" is probably much more familiar and relatable to most
people. Also, I'm still not sure how "jujube" is supposed to be
pronounced :P
2021-05-15 10:28:40 -07:00
Martin von Zweigbergk
f4a41f3880 trees: make tree diff return an iterator instead of taking a callback
This is yet another step towards making it easy to propagate
`BrokenPipe` errors. The `jj diff` code (naturally) diffs two trees
and prints the diffs. If the printing fails, we shouldn't just crash
like we do today.

The new code is probably slower since it does more copying (the
callback got references to the `FileRepoPath` and `TreeValue`). I hope
that won't make a noticeable difference. At least `jj diff -r
334afbc76fbd --summary` didn't seem to get measurably slower.
2021-04-07 23:18:00 -07:00
Martin von Zweigbergk
4b8484e561 rustfmt: configure to group imports 2021-03-14 10:46:25 -07:00
Martin von Zweigbergk
abc9dc1733 cargo: rename crates to names available on crates.io
I'm preparing to publish an early version before someone takes the
name(s) on crates.io. "jj" has been taken by a seemingly useless
project, but "jujube" and "jujube-lib" are still available, so let's
use those.
2021-01-03 10:16:00 -08:00
Martin von Zweigbergk
3280d75ff4 diff_edit: mark "before" directory readonly to clarify to user
Changes to the "before" side of the diff will have no effect, so let's
clarify that by marking it readonly. At least Meld checks the
permissions and shows in the UI that the left side is readonly.
2020-12-26 11:47:52 -08:00
Martin von Zweigbergk
b6192a7ed5 diff_edit: add missing copyright header 2020-12-26 11:47:52 -08:00
Martin von Zweigbergk
b820eddde3 commands: add an interactive mode for jj restore
This adds an interactive mode for `jj restore`. It works by first
creating two temporary directories with the contents of the subset of
files that differ between the two trees, and then letting the user
edit the directory representing the right/after side. This has some
advantages compared to the interactive modes in Git and Mercurial:

 * It lets the user edit the final state as opposed to the diff itself
   (depending on the diff tool, of course). I think most users find it
   easier to edit the file contents than to edit the patch
   format.

 * It delegates the hard work to a tool that is already written (this
   is a big advantage for an immature tool like Jujube, but it is not
   an advantage from the user's point of view).

Almost all of the work in this commit went into adding a function that
takes two trees, lets the user edit the diff, and returns a new tree
id. I plan to reuse that function for other interactive commands. One
planned command is `jj edit`, which will let the user edit the changes
in a commit. `jj edit -r abc123` will be mostly about providing a more
intuitive name for `jj restore --source abc123^ --destination abc123`,
plus it will be different for merge commits (it will edit only the
changes in the merge commit). I also plan to add `jj split` by letting
the user edit the full diff, leaving only the parts that should go
into the first commit. Perhaps there will also be commands for moving
part of a commit out of or into a parent commit.
2020-12-26 01:16:19 -08:00