Commit Graph

1390 Commits

Author SHA1 Message Date
Waleed Khan
67be21d9cb cleanup: fix some cargo clippy warnings 2022-05-02 21:49:01 -07:00
Waleed Khan
7a551e584f cli: jj branch can accept any number of branches 2022-05-02 21:33:58 -07:00
Yuya Nishihara
f6acee41df diff_edit: load command arguments from merge-tools.<name> config
Apparently, I need to pass `--merge` option to use kdiff3 as a diff editor.

We could add `diff-editor-args` or extend `diff-editor` to a list of command
arguments, but we'll eventually add stock merge tools and the configuration
would look like:

    [merge-tools.<name>]
    program = ...
    diff-args = [...]
    edit-args = [...]
    merge-args = [...]
2022-05-03 12:24:05 +09:00
Martin von Zweigbergk
1f2753fd3f cli: fix incompatibility between #271 and #273
The two PRs were incompatible, but it seems they were allowed to
"merge" (rebase) because the merge was conflict free?
2022-05-02 17:46:06 -07:00
Martin von Zweigbergk
305adf05cc cli: when auto-importing from git, rebase descendants 2022-05-02 17:01:38 -07:00
Martin von Zweigbergk
726b29978d tests: show failure in git-shared working copy after deleting commit in git
Since 57ba9a9409, if the automatic import from git results in some
abandoned commit, that information gets recorded in the `MutableRepo`,
but I forgot to add a call to rebase the descendants. That causes a
failed assertion at
81a8cfefcb/lib/src/transaction.rs (L86). This
patch add a test showing that failure.
2022-05-02 17:01:38 -07:00
Waleed Khan
ed2b8643f8 docs: update README.md
The intention is to make it easier to jump to the Installation section.
2022-05-02 13:57:10 -07:00
Waleed Khan
7a99a17304 cli: make jj branch --revision/--delete/--forget mutually-exclusive 2022-05-02 13:44:17 -07:00
Martin von Zweigbergk
7268e5608e working_copy: propagate errors when snapshotting
Closes #258
2022-05-02 11:23:38 -07:00
dependabot[bot]
6649dbabae cargo: bump serde_json from 1.0.79 to 1.0.80
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.79 to 1.0.80.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.79...v1.0.80)

---
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-05-02 18:08:03 +00:00
dependabot[bot]
399cec09d7 cargo: bump clap_complete from 3.1.2 to 3.1.3
Bumps [clap_complete](https://github.com/clap-rs/clap) from 3.1.2 to 3.1.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/clap_complete-v3.1.2...clap_complete-v3.1.3)

---
updated-dependencies:
- dependency-name: clap_complete
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-02 09:55:38 -07:00
dependabot[bot]
9ae642e11b cargo: bump thiserror from 1.0.30 to 1.0.31
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.30 to 1.0.31.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.30...1.0.31)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-02 09:46:59 -07:00
dependabot[bot]
0cb1033afd cargo: bump clap from 3.1.12 to 3.1.14
Bumps [clap](https://github.com/clap-rs/clap) from 3.1.12 to 3.1.14.
- [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/v3.1.12...v3.1.14)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-02 08:59:26 -07:00
Waleed Khan
4e026c6c93 diff_edit: add hint when using default editor 2022-05-02 08:19:23 -07:00
Martin von Zweigbergk
543a95c653 rewrite: propagate backend errors in DescendantRebase::rebase_next() 2022-05-02 08:05:24 -07:00
Martin von Zweigbergk
96b3e05bc5 working_copy: rename write_tree() to snapshot()
I think I copied the name `write_tree()` from Git, but I find it quite
confusing, since it's not clear if it write a tree to the working copy
or reads the working copy and writes a tree to the store (it's the
former).
2022-05-02 08:00:15 -07:00
Martin von Zweigbergk
90c8cb0cba errors: add a custom error type for StackedTable 2022-05-01 23:35:09 -07:00
Martin von Zweigbergk
89476261c0 cleanup: move {read,write}_conflict() methods earlier in Backend trait
The methods working on conflicts are more closely related to those
working on files and trees, so it makes sense for them to be closer.
2022-05-01 23:35:09 -07:00
Martin von Zweigbergk
b97fd381e5 diff_edit: delete unused error variant (since 9e9727af4e) 2022-05-01 22:58:18 -07:00
Martin von Zweigbergk
5bad272e90 docs: update stale references to -o argument deleted in 8744015f33 2022-05-01 16:33:27 -07:00
Martin von Zweigbergk
5893b52fd1 cleanup: use while let Some(...) instead of checking before popping 2022-05-01 13:45:00 -07:00
Waleed Khan
00a8abcdbb diff_edit: improve error handling
Used to produce a message like this:

```
thread 'main' panicked at 'failed to run diff editor: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/diff_edit.rs:136:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```

Now produces a message like this:

```
Error: Failed to edit diff: Error executing editor 'meld': No such file or directory (os error 2)
```
2022-04-30 13:28:38 -07:00
Waleed Khan
2b843d418b cli: don't show bench/debug subcommands by default 2022-04-30 12:56:23 -07:00
Martin von Zweigbergk
81a8cfefcb cli: add a mode of pushing with branch taken from change ID
This adds `jj git push --change <revision>` which creates a branch
with a name based on the revision's change ID, and then pushes that
like with `--branch`. That can be useful so you don't have to manually
add the branch (and come up with a name for it). The created branch
behaves like any other branch, so it's possible to make it point to a
commit with a different change ID.
2022-04-29 15:55:03 -07:00
Martin von Zweigbergk
bc75b08f4b cli: extract a function for finding single-branch push update
This will be reused in the next commit.
2022-04-29 15:55:03 -07:00
Martin von Zweigbergk
6e30bd76f9 cargo: move some test deps to [dev-dependencies] 2022-04-29 14:25:55 -07:00
Martin von Zweigbergk
d42c71f48d errors: fix some easy error propagation in commands.rs
This is actually enough to fix #248, but I'll continue to work on
error handling for a while. I'd like to at least include the bad
object ID in this type of error messages.

Closes #248.
2022-04-29 14:10:16 -07:00
Martin von Zweigbergk
0719dae975 cli: add a command for listing git remotes and their URLs
As requested by @talpr. I added this is a separate new command `jj git
remote list`. One could also imagine showing the listing when there is
no sub-command specified to `jj git remote`, but we don't have other
commands that behave that way yet.

Closes #243
2022-04-29 14:08:24 -07:00
Martin von Zweigbergk
491d0e3b06 cli: add a debug command for showing information about an operation
This adds `jj debug operation <operation ID>`, which will print the
operation object and its associated view object.
2022-04-29 13:50:22 -07:00
Martin von Zweigbergk
23d37f9060 git_backend: delete obsolete (?) comment about not avoiding use of index
It seems to me that we have never created a Git index in order to
create a commit, not even in the earliest versions of the code (before
it was moved to Git).
2022-04-29 13:26:27 -07:00
Martin von Zweigbergk
dc32bb1f95 git: avoid creating a HashSet only to convert to a Vec 2022-04-28 22:46:50 -07:00
Martin von Zweigbergk
8ef00a3498 tests: re-run with insta crate version b9d99e87065b 2022-04-28 16:55:10 -07:00
Martin von Zweigbergk
57ba9a9409 git: when importing refs, abandon commits that were abandoned in git
Now that I'm using GitHub PRs instead of pushing directly to the main
branch, it's quite annoying to have to abandon the old commits after
GitHub rebases them. This patch makes it so we compare the remote's
previous heads to the new heads and abandons any commits that were
removed on the remote. As usual, that means that descendants get
rebased onto the closest remaining commit.

This is half of #241. The other half is to detect rewritten branches
and rebase on top.
2022-04-28 11:28:09 -07:00
Martin von Zweigbergk
e3254fa5c4 rewrite: don't rewrite the "removed" side of a branch conflict
Let's say we have a simple history like this:

```
B C D
 \|/
  A
```

Branch `main` initially points to commit B. Two concurrent operations
then move the branch to commits C and D. When the two concurrent
operations get merged, the branch will be recorded as pointing to
"C+D-B". If a subsequent operation now abandons commit B, we would
update the "removed" side of the branch conflict. That seems a little
dishonest. I think the reason I did it that way was in order to not
keep B visible back when having it present in the "removed" side would
keep it visible (before 33bf6ce1d5).

I noticed this issue while working on #241 because
`test_import_refs_reimport()` started failing. That test case is
pretty much exactly the case above.
2022-04-28 11:28:09 -07:00
dependabot[bot]
aff2293e1d github: bump github/codeql-action from 2.1.8 to 2.1.9
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.1.8 to 2.1.9.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](1ed1437484...7502d6e991)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-28 08:49:42 -07:00
Martin von Zweigbergk
0789a8a4c0 revsets: allow single internal - and + characters in symbols (#46) 2022-04-28 08:14:15 -07:00
Martin von Zweigbergk
78da5596b7 working_copy: switch an if let Some() { } else { } to a match 2022-04-26 21:19:09 -07:00
Martin von Zweigbergk
0fbb1d3971 working_copy: don't visit whole ignored tree even if last in order
When committing the working copy, we try to not visit ignored
directories (as e.g. `target/` often is), but we need to visit it if
there are already tracked files in it. I initially missed that in
c1060610bd and then fixed it in a028f33e3b. The fix works by
checking if the next path after the ignored path is inside the ignore
path (viewed as a directory). However, I forgot to handle the case
where there are no paths at all after the ignored path. So, for
example, if the `target/` directory should be ignored and it there
were no tracked paths after `target/` in alphabetical order, we would
still visit the directory. That's why the bug reproduced in the
`git-branchless` repo but not in the `jj` repo (because there are
files under `testing/` and `tests/` here).

Closes #247.
2022-04-26 20:53:49 -07:00
Jason R. Coombs
2d4e653e90 Add hint on including completions with xonsh shell. 2022-04-26 16:31:51 -07:00
Jason R. Coombs
99cce19774 Avoid hard-coding homebrew install prefix. 2022-04-26 16:31:51 -07:00
Jason R. Coombs
c2dbbf434d Minor editorial changes for native backend footnote. 2022-04-26 16:31:51 -07:00
Martin von Zweigbergk
9e9727af4e diff_edit: use sparse checkouts instead of emulating it (#52)
I think we can simply use sparse checkouts for the diff-editing
functionality now that we have it. I'm really happy with how simple it
got :)
2022-04-26 14:52:17 -07:00
Martin von Zweigbergk
885c780642 cli: add commands for working with sparse patterns (#52)
This adds a `jj sparse` command with options to list and manage the
set of paths to include in the working copy. It only supports includes
(postive matches) for now.

I'm not sure "sparse" is the best name for the feature. Perhaps it
would make sense as a subcommand under `jj workspace` - maybe `jj
workspace track`? However, there's also `jj untrack` for removing a
file from the working copy and leaving it in the working copy. I'm
happy to hear suggestions, or we can get back to the naming later.
2022-04-26 14:52:17 -07:00
Martin von Zweigbergk
b2f6725a04 cli: extract helper for making changes to the working copy (#52)
Most commands that are going to make changes to the working copy want
to share some logic for detecting concurrent changes, so let's extract
that to a function.
2022-04-26 14:52:17 -07:00
Martin von Zweigbergk
18a64c365a working_copy: respect sparse patterns when writing tree (#52) 2022-04-26 14:52:17 -07:00
Martin von Zweigbergk
0d881de56c working_copy: allow updating sparse patterns (#52)
With this patch, we add support for setting the sparse patterns, and
we respect it when updating the working copy.
2022-04-26 14:52:17 -07:00
Martin von Zweigbergk
ceb6c152a1 working_copy: record sparse patterns in the tree state (#52)
This patch makes room for sparse patterns in the `TreeState` proto
message. We also start setting that value to a list of just the
pattern `.` when we create new working copies. Old working copies
without the sparse patterns are also interpreted as having that single
pattern. Note that this absence of sparse patterns is different from a
present list of no patterns. The latter is a valid state and means
that no paths are included in the sparse checkout.
2022-04-26 14:52:17 -07:00
Martin von Zweigbergk
ed2d2f8a4f working_copy: extract function for updating the working copy files (#52)
Updating the working copy with new sparse patterns is very similar to
updating it with a new tree. We're going to reuse this extracted
function soon.
2022-04-26 14:52:17 -07:00
Martin von Zweigbergk
cb0ab6b360 matchers: add composite matcher for differences (#52)
This adds a matcher that takes two input matchers and creates a new
matcher from them. The composite matcher matches paths matched by the
first matcher but not matched by the second matcher. I plan to use
this for sparse checkouts. They'll also be useful if we add support
for negative patterns to filter e.g. `jj files` by.
2022-04-26 14:52:17 -07:00
Martin von Zweigbergk
4c2c1fedff matchers: add a matcher not matching anything (#52)
It can be useful for at least testing purposes to have a matcher that
doesn't match any paths.
2022-04-26 14:52:17 -07:00