ok/jj
1
0
Fork 0
forked from mirrors/jj
Commit graph

3476 commits

Author SHA1 Message Date
Ilya Grigoriev
bdb6db88e1 cli: new jj chmod command to set executable bit 2023-06-24 13:28:01 -07:00
Ilya Grigoriev
d01ecc5c46 branch list: more detailed message describing deleted branches
Fixes #1537
2023-06-24 09:23:14 -07:00
Ilya Grigoriev
e41d672cc0 branch forget: allow forgetting deleted branches
Partially fixes #1537
2023-06-24 09:23:14 -07:00
Ilya Grigoriev
89a3f8db76 test_branch_command: demo inability to forget deleted branch 2023-06-24 09:23:14 -07:00
Ilya Grigoriev
d217fe069b test_branch_command: test fetching a forgotten branch 2023-06-24 09:23:14 -07:00
Ilya Grigoriev
ee4f8f2876 test_git_fetch: move a fetch test from test_git_import_export 2023-06-24 09:23:14 -07:00
Ilya Grigoriev
08d147be32 test_git_import_export.rs: rename test and modernize terminology 2023-06-24 09:23:14 -07:00
Waleed Khan
24ea8478cb feat(config): add jj config get for scripting
The motivating use-case was this `jj signoff` script: https://gist.github.com/thoughtpolice/8f2fd36ae17cd11b8e7bd93a70e31ad6

Which includes lines like this:

```sh
NAME=$(jj config list user.name | awk '{split($0, a, "="); print a[2];}' | tr -d '"')
MAIL=$(jj config list user.email | awk '{split($0, a, "="); print a[2];}' | tr -d '"')
```

There is no reason that we should have to clumsily parse out the config values. This `jj config get` command supports scripting use-cases like this.
2023-06-23 12:07:39 -07:00
Yuya Nishihara
d1701a5d95 git: on import_refs(), avoid loading git commit object if it's known
With my colocated "linux" repo, this appears to save ~50ms startup overhead.
Since the repo has lots of indirect tags, we can't eliminate tag object
loading at all. But still, it's faster than falling back to peel_to_commit().
2023-06-23 16:26:13 +09:00
dependabot[bot]
e6ab3f132f cargo: bump itertools from 0.10.5 to 0.11.0
Bumps [itertools](https://github.com/rust-itertools/itertools) from 0.10.5 to 0.11.0.
- [Changelog](https://github.com/rust-itertools/itertools/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-itertools/itertools/compare/v0.10.5...v0.11.0)

---
updated-dependencies:
- dependency-name: itertools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-22 18:18:48 +02:00
dependabot[bot]
8aa8d84f1e cargo: bump insta from 1.29.0 to 1.30.0
Bumps [insta](https://github.com/mitsuhiko/insta) from 1.29.0 to 1.30.0.
- [Changelog](https://github.com/mitsuhiko/insta/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mitsuhiko/insta/compare/1.29.0...1.30.0)

---
updated-dependencies:
- dependency-name: insta
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-22 18:18:21 +02:00
Martin von Zweigbergk
ea2d5fdba7 backend: drop deprecated fields from local_store.proto
We don't even try to preserve compatibility with old repos using the
local backend.
2023-06-22 13:49:46 +02:00
Martin von Zweigbergk
da5db27bb0 backend: split up store.proto in git and local versions
It was convenient that what the git backend stored in its "extras"
table is exactly a subset of the fields that local backend stores, but
it's bit ugly and limiting. For example, it makes it possible to
populate the `author` field in the git extras, but that would have no
effect. It's better that it's not possible to do that (we store the
author field in the git commit, of course).

What made me notice this now was that I'm working on tree-level
conflicts (#1624) and I'm thinking of adding a field to the git extras
saying "this commit has single tree, but it's still a new-style
commit", so we can know not to walking such trees to find path-level
conflicts. That's only needed for the git backend because we don't
care about compatibility for the local backend.
2023-06-22 13:49:46 +02:00
Martin von Zweigbergk
c33062e8cd cargo: upgrade pest and pest_derive to 2.7.0
Version 2.6.0 and 2.6.1. have been yanked.
2023-06-22 08:16:14 +02:00
dependabot[bot]
083548e976 cargo: bump clap from 4.3.4 to 4.3.5
Bumps [clap](https://github.com/clap-rs/clap) from 4.3.4 to 4.3.5.
- [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/v4.3.4...v4.3.5)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-21 19:57:28 +02:00
Martin von Zweigbergk
dee5dff20d conflicts: preserve diffs when simplfying a conflict
If we allow `Conflict::simplify()` to swap the removes and adds as
freely as we currently do, we may present the user with a conflict
marker with a diff that has never appeared anywhere before the
simplification. That seems very confusing. Let's instead preserve the
diffs when we simplify conflicts.
2023-06-21 06:42:18 +02:00
Martin von Zweigbergk
8f75a8236a conflicts: add test of higher-arity conflict simplificaton changing diffs
It's a bit weird to simplify a conflict like `A B->C D->E C->F` to `A
B->E D->F` because it changes which diffs are in the conflict, but
that's what we currently do. Let's have a test for that.

We actually already have tests showing how `A B->C D->A` gets
simplified to `C B->D`, but those are less obviously weird because
when rendered as `removes = [B], adds = [C, D]`, it doesn't look that
different from the reverse.
2023-06-21 06:42:18 +02:00
dependabot[bot]
e1b4fde5b3 github: bump dtolnay/rust-toolchain
Bumps [dtolnay/rust-toolchain](https://github.com/dtolnay/rust-toolchain) from 52e69531e6f69a396bc9d1226284493a5db969ff to 1f5cdb56c8779e3efa22473ce181ff83143b172c.
- [Release notes](https://github.com/dtolnay/rust-toolchain/releases)
- [Commits](52e69531e6...1f5cdb56c8)

---
updated-dependencies:
- dependency-name: dtolnay/rust-toolchain
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-21 06:19:10 +02:00
dependabot[bot]
2bf65bd3e9 cargo: bump pest_derive from 2.6.0 to 2.6.1
Bumps [pest_derive](https://github.com/pest-parser/pest) from 2.6.0 to 2.6.1.
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.6.0...v2.6.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>
2023-06-21 06:18:50 +02:00
Martin von Zweigbergk
d858964067 docs: describe how to configure scm-diff-editor 2023-06-20 20:48:42 +02:00
Kevin Liao
86b6a11e63 Fix jj init --git-repo fails and leaves broken .jj folder
This commit fixes #1305

Before this commit, running `jj init --git-repo=./` in a folder that
does not have a .git would cause jj to panick and leave an unfinished corrupted jj repo.

This commit fixes that by changing the call chain to return an error
instead of calling .unwrap() and panicking. This commit also adds logic to delete the unfinished jj
repository when the git backend initialization failed.

Before this commit, running the above command would result in the following
```
Running `jj/target/debug/jj init --git-repo=./`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { code: -3, klass: 2, message: "failed to resolve path '/Users/kevincliao/github/jj/test-repo/.jj/repo/store/../../../.git': No such file or directory" }', lib/src/git_backend.rs:83:75
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```

After this commit, the result is the following and the jj repo is deleted:
```
Running `jj/target/debug/jj init --git-repo=./`
Error: Failed to access the repository: Error: Failed to open git repository: failed to resolve path '/Users/kevincliao/github/jj/test-repo/.jj/repo/store/../../../.git': No such file or directory; class=Os (2); code=NotFound (-3)
```
2023-06-20 11:02:06 -07:00
Austin Seipp
d9f661eb8b chore(nix): run 'nix flake update'
While 'nix build .#jj' worked fine, it seems like 'nix develop .' did *not* work
fine, due to a bug in upstream nixpkgs when libgcc_s was linked against the MSRV
(1.64.0). A simple update seems to have fixed that.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Change-Id: Iwqryoplqxzyxwymlsktxnqoqrwvrryln
2023-06-20 11:47:23 -05:00
Martin von Zweigbergk
033b287e54 README: rewrite sections about the working-copy commit and repo-first design
I tried to clarify the benefits of these two features (#1708).
2023-06-20 16:00:21 +02:00
Martin von Zweigbergk
dc98a56119 README: put jj debug completion (jj<=0.7.0) close to jj debug version
Fixes #1711.
2023-06-20 13:20:14 +02:00
dependabot[bot]
8a8b96a448 cargo: bump pest from 2.6.0 to 2.6.1
Bumps [pest](https://github.com/pest-parser/pest) from 2.6.0 to 2.6.1.
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.6.0...v2.6.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-19 22:43:34 +02:00
dependabot[bot]
cb7d96d236 github: bump cachix/install-nix-action from 21 to 22
Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 21 to 22.
- [Release notes](https://github.com/cachix/install-nix-action/releases)
- [Commits](4b933aa7eb...6ed004b9cc)

---
updated-dependencies:
- dependency-name: cachix/install-nix-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-19 22:42:52 +02:00
Glen Choo
6621f261cc repo: add submodule_store, default impl
..and other assorted boilerplate. These are just stubs for now, but now
that we've reserved the `submodule_store` subdirectory, we can start
adding more functionality.
2023-06-19 09:48:58 -07:00
Martin von Zweigbergk
038b64d273 conflicts: add resolve_trivial() and test invariants 2023-06-19 08:30:09 +02:00
Martin von Zweigbergk
3f95dafd67 conflicts: resolve trivial merge of A+A-B+C-C to A
This changes the behavior in one of the cases ilyagr@
[mentioned](https://github.com/martinvonz/jj/pull/1610#discussion_r1199823932)
to match his suggestion. After some more thinking while working on
tree-level conflicts, I now think it's clear that the added `+C-C`
terms should have no effect on the result. A very similar argument is
that `Conflict::simplify()` should not change the result of
`trivial_merge()`. I'll add tests for that next.
2023-06-19 08:30:09 +02:00
Martin von Zweigbergk
82883e648d conflicts: move describe_conflict() etc. onto Conflict
Before we had `conflicts::Conflict`, most of these functions took a
`backend::Conflict`. I think I didn't want to pollute the `backend`
module with this kind of logic, trying to keep it focused on
storage. Now that we have the type in `conflicts`, however, I think it
makes sense to move these functions onto it.
2023-06-19 07:05:02 +02:00
Martin von Zweigbergk
7a8cabafc9 conflicts: remove unused Conflict::set_{add,remove}()
These seem unused since 19fd8a917a.
2023-06-19 07:05:02 +02:00
dependabot[bot]
d67f41e882 cargo: bump serde_json from 1.0.96 to 1.0.97
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.96 to 1.0.97.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.96...v1.0.97)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-19 06:42:19 +02:00
Yuya Nishihara
a67d8b5a65 index: turn CompositeIndex::walk_revs() into position-based API
This gets rid of round-trip conversion from queries like "(main..)-". I have
such expression in my default log/disambiguation revset, and the query could
take ~150ms to convert head positions back and forth if the repository had
tons of unmerged commits.
2023-06-19 13:41:43 +09:00
Yuya Nishihara
8b0c01d1e9 git: return early from import_refs() if no commits to abandon
This saves another 150ms needed to set up binary heap with ~4000 wanted
and unwanted heads.
2023-06-16 09:45:41 +09:00
Yuya Nishihara
5fda093481 git: unify loop that consumes stale/excluded git refs 2023-06-16 09:45:41 +09:00
Yuya Nishihara
aa2359fdec git: rename new_git_heads to pinned_git_heads as it isn't always "new" 2023-06-16 09:45:41 +09:00
Yuya Nishihara
c8eb1a3c9c git: remove uninteresting old refs from list of heads to abandon
Since unchanged refs should be pinned by new_git_heads, we only need to
consider about "changed" old_git_targets. This allows us to return early
if hidable_git_heads.is_empty().
2023-06-16 09:45:41 +09:00
Yuya Nishihara
cf2c14296b git: on import_refs(), don't clobber view's heads with known HEAD@git
In colocated mid-size "linux" repo, this saves ~450ms needed to do
enforce_view_invariants(). We could instead make add_head() to return early,
but the condition would be a bit weird since HEAD@git is typically a parent
of known heads, not a head itself.
2023-06-16 09:45:41 +09:00
dependabot[bot]
5e3913bf56 cargo: bump clap from 4.3.3 to 4.3.4
Bumps [clap](https://github.com/clap-rs/clap) from 4.3.3 to 4.3.4.
- [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/v4.3.3...v4.3.4)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-14 20:16:53 +02:00
Yuya Nishihara
55f93bfa04 tree: reuse caller-provided path in known_sub_tree(), mark it as private 2023-06-15 00:45:07 +09:00
Yuya Nishihara
db7facb78e tree: rewrite sub_tree_recursive() to not use known_sub_tree()
This is the only place where the caller of known_sub_tree() doesn't know
the full repo path.
2023-06-15 00:45:07 +09:00
Yuya Nishihara
589917a53c repo_path: micro-optimize .join() to not reallocate cloned Vec
While playing with perf.data captured with "jj log", I noticed RepoPath::join()
has measurable cost. The first half is small alloc()s for Vec and Strings, and
the latter is realloc() on Vec::push(). Removing realloc() is easy, so let's
do that.
2023-06-15 00:45:07 +09:00
Martin von Zweigbergk
b01d6cdf5d docs: note how our heads() and roots() revsets differ from hg's 2023-06-14 14:08:58 +02:00
Ilya Grigoriev
d13db728ba README: Delete the section on the rust version
We'll rely on `cargo` informing users instead. The previously confusing
error is hopefully obsolete.
2023-06-13 12:50:47 -07:00
Martin von Zweigbergk
d886d8c203 conflicts: extract methods for converting to/from generic legacy form
We already have the new `Conflict::from_backend_conflict()` for
converting from a `backend::Conflict`, but we model conflicts in a
similar way in at least `RefTarget`. I'd like to be able to use
`conflicts::Conflict` there too. To prepare for that, let's extract
generic methods from `Conflict::from_backend_conflict()` and
`Conflict::to_backend_conflict()`.

I'm not sure I'll get around to making `RefTarget` use `Conflict` but
this commit seems like nice cleanup either way. It makes the tests
simpler if nothing else.
2023-06-13 21:48:35 +02:00
Martin von Zweigbergk
bbbae2c172 conflicts: fix a typo (lossy conflict -> lossy conversion) 2023-06-13 21:48:35 +02:00
Yuya Nishihara
eb4f6a2c92 ui: send progress output to stderr
So the snapshot progress can be displayed even if the main output is
redirected to file.
2023-06-13 21:50:01 +09:00
Yuya Nishihara
bea1ef73e6 ui: create separate io wrapper for progress output
I'm going to redirect progress message to stderr, but the current Ui API
makes it less clear whether the underlying streams of .write*()/.flush()/
.output_guard() are related or not.
2023-06-13 21:50:01 +09:00
Yuya Nishihara
dc7f7fb23d ui: extract term_width() helper as static function
I'll add progress output wrapper which will be used in place of ui object.
2023-06-13 21:50:01 +09:00
Yuya Nishihara
dbe8d3fcdc ui: on progress output, also take pager status into account 2023-06-13 21:50:01 +09:00