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

1071 commits

Author SHA1 Message Date
dependabot[bot]
70a6798d76 cargo: bump pest_derive from 2.5.1 to 2.5.2
Bumps [pest_derive](https://github.com/pest-parser/pest) from 2.5.1 to 2.5.2.
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.5.1...v2.5.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-26 15:20:38 +00:00
Yuya Nishihara
d89619c9c6 git: diff refs to export without building dummy view 2022-12-25 00:11:14 +09:00
Martin von Zweigbergk
6514ab2e3a cli: when config is invalid, use default config
When we fail to read the user's config, it seems obviously better to
use the default config than to not use it. It doesn't matter yet, but
it will matter when I've moved color configs out of `formatter.rs` and
into a `.toml` file. Without this change, we'd lose the default
coloring of the error message for config errors.
2022-12-24 07:07:37 -08:00
dependabot[bot]
481f87abd3 cargo: bump pest from 2.5.1 to 2.5.2
Bumps [pest](https://github.com/pest-parser/pest) from 2.5.1 to 2.5.2.
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.5.1...v2.5.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-23 09:24:57 -08:00
Yuya Nishihara
587e42d65d backend: deduplicate id type declarations by using declarative macro 2022-12-23 23:52:03 +09:00
Yuya Nishihara
b07c0db56b backend: deduplicate id type impls by using declarative macro
It's unlikely we'll need to customize these impls per type, so let's ensure
that these newtypes have identical implementations. This commit also adds
from_hex() to FileId, SymlinkId, and ConflictId.
2022-12-23 23:52:03 +09:00
Yuya Nishihara
36020a2bbf revset: parse hg/git-like '^' postfix operator and show hint 2022-12-23 00:38:29 +09:00
Yuya Nishihara
7cd01b27a7 revset: parse hg-like '-'/'+' infix operators and show hint
Suggested by @arxanas.

Actually, it's easier to support these infix ops than erroring out, but I
don't want to make revset syntax more cryptic. "x- y" can't be handled by
this rule because "x-" is parsed as a parents expression.
2022-12-23 00:38:29 +09:00
Benjamin Saunders
aaa175eca7 lib: replace protobuf crate with prost 2022-12-22 07:04:35 -08:00
Yuya Nishihara
986649623d commit_builder: relax type of description parameter
The next commit will introduce a newtype for -m/--message argument which
can be converted Into<String>.

Since CommitBuilder is a thin wrapper, code bloat caused by generic parameters
wouldn't matter. I have another set of commits that makes all builder methods
accept Into/IntoIterator, which will remove some of .clone() calls from tests.
2022-12-22 14:59:03 +09:00
dependabot[bot]
80ab49e2f6 cargo: bump num_cpus from 1.14.0 to 1.15.0
Bumps [num_cpus](https://github.com/seanmonstar/num_cpus) from 1.14.0 to 1.15.0.
- [Release notes](https://github.com/seanmonstar/num_cpus/releases)
- [Changelog](https://github.com/seanmonstar/num_cpus/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/num_cpus/compare/v1.14.0...v1.15.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-21 09:06:25 -08:00
Yuya Nishihara
c9ff99d166 cargo: drop or move "rand" to dev-dependencies 2022-12-21 23:48:51 +09:00
Ilya Grigoriev
2f00fcb6b4 jj git push: Make sure each branch is processed at most once 2022-12-21 00:52:17 -08:00
dependabot[bot]
e1bf2ea7f4 cargo: bump thiserror from 1.0.37 to 1.0.38
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.37 to 1.0.38.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.37...1.0.38)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-19 09:57:39 -08:00
dependabot[bot]
548595ec52 cargo: bump blake2 from 0.10.5 to 0.10.6
Bumps [blake2](https://github.com/RustCrypto/hashes) from 0.10.5 to 0.10.6.
- [Release notes](https://github.com/RustCrypto/hashes/releases)
- [Commits](https://github.com/RustCrypto/hashes/compare/blake2-v0.10.5...blake2-v0.10.6)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-19 09:57:18 -08:00
dependabot[bot]
cb59948b3c cargo: bump serde_json from 1.0.89 to 1.0.91
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.89 to 1.0.91.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.89...v1.0.91)

---
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-12-19 09:57:06 -08:00
Luke Granger-Brown
90ba55bd7b git: cache the extra metadata table
Performance on repositories with many commits is limited somewhat by repeatedly
stating the tablestore directory to work out what the head is. By caching the
table rather than looking it up from disk on every request, we can much more
rapidly satisfy requests. 

This avoids the pathological case in #845 where jj operations take several
minutes to complete.

This patch doesn't change the normal flow of the write path: that will still
always call get_head() on the underlying TableStore, which will stat the
directory before writing out changes. It will however empty the cache when the
metadata has been written.

Fixes #845.
2022-12-17 08:19:14 +00:00
Daniel Ploch
e9bd6fbeae op_heads_store: give the OpHeadsStore factory semantics 2022-12-16 10:47:48 -08:00
Daniel Ploch
90a66ec262 op_heads_store: move op_heads into a subdir, to make room for the 'type' marker 2022-12-16 10:47:48 -08:00
Daniel Ploch
2c5b3d0cc7 op_heads_store: convert load() to take &Path like other factories 2022-12-16 10:47:48 -08:00
Daniel Ploch
309a3f91a1 op_heads_store: refactor into an interface and simple implemenation
The implementation has some hoops to jump through because Rust does not allow
`self: &Arc<Self>` on trait methods, and two of the OpHeadsStore functions need
to return cloned selves. This is worked around by making the implementation type
itself a wrapper around Arc<>.

This is not particularly note worthy for the current implementation type where
the only data copied is a PathBuf, but for extensions it is likely to be more
critical that the lifetime management of the OpHeadsStore is properly
maintained.
2022-12-16 10:47:48 -08:00
Yuya Nishihara
4e8f51a983 cleanup: leverage Itertools::try_collect() instead of turbofish
It still requires return type annotation in some places, but should be easier
to type than ::<Result<...

https://docs.rs/itertools/latest/itertools/trait.Itertools.html#method.try_collect
2022-12-16 13:34:58 +09:00
Martin von Zweigbergk
daef30906f protobuf: remove ignored call to out_dir()
Since we call `cargo_out_dir()` - which is the preferred way of using
`protobuf_codegen::Codegen` in `build.rs` - our call to `out_dir()`
has no effect.
2022-12-15 13:02:22 -08:00
Martin von Zweigbergk
fb396e6b45 cleanup: address unnecessary_borrow lints reported by Clippy 1.66
Interestingly, the nightly release doesn't complain about this. One
instance in `test_working_copy.rs` is a bug in Clippy.
2022-12-15 12:38:01 -08:00
Martin von Zweigbergk
7f9a0a2820 cleanup: let new Clippy move variables into format strings
I ran an upgraded Clippy on the codebase. All the changes seem to be
about using variables directly in format strings instead of passing
them as separate arguments.
2022-12-14 21:30:58 -08:00
Daniel Ploch
bd31bfd2d7 repo: give OpStore factory load semantics 2022-12-14 14:10:30 -08:00
Daniel Ploch
0f62c795d8 repo: move backend loading onto the StoreFactories struct 2022-12-14 14:10:30 -08:00
Daniel Ploch
25c379429c op_store: init/load by &Path, for consistency with other stores 2022-12-14 14:10:30 -08:00
Daniel Ploch
7cbea42a24 repo: rename BackendFactories to StoreFactories 2022-12-14 14:10:30 -08:00
Daniel Ploch
7756cfa61b op_store: op store delegates should not implement the OpStore trait directly 2022-12-14 14:10:30 -08:00
Yuya Nishihara
ffbd6eb945 tree: ensure Tree outlives its iterator on dropping self-referential struct
Just for sanity. It wouldn't matter unless the iterator implements Drop.

https://doc.rust-lang.org/reference/destructors.html
2022-12-15 01:51:25 +09:00
dependabot[bot]
2a357ac2df cargo: bump insta from 1.22.0 to 1.23.0
Bumps [insta](https://github.com/mitsuhiko/insta) from 1.22.0 to 1.23.0.
- [Release notes](https://github.com/mitsuhiko/insta/releases)
- [Changelog](https://github.com/mitsuhiko/insta/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mitsuhiko/insta/compare/1.22.0...1.23.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-13 11:32:05 -08:00
Yuya Nishihara
6237f3cdfd revset: fold nested parents expressions
Some other ancestors() expressions can also be substituted. Practically,
this is the rule to fold repeated '-' operators to evaluate them lazily.
2022-12-13 15:55:18 +09:00
Yuya Nishihara
069a8ed9bc revset: reimplement parents() as ancestors() with generation filter
This wouldn't make things any better by itself, but it allows us to merge
nested parents().
2022-12-13 15:55:18 +09:00
Yuya Nishihara
46b1465324 revset: add generation parameter to RevsetExpression::Ancestors/Range
Parents(heads) will be translated to Ancestors(heads, 1..2).
2022-12-13 15:55:18 +09:00
Yuya Nishihara
29a565e3fb revset: add substitution rule for roots..heads
While working on ancestor generation, I noticed Mercurial has this
substitution rule. Since it's easier to deal with Ancestors() than Range {},
'roots..heads' is first decomposed to ':heads & ~:roots'.
2022-12-13 15:55:18 +09:00
Yuya Nishihara
e6229e6d77 revset: turn RevWalkRevset into generic wrapper of cloneable iterator
I failed to solve type puzzle for to_predicate_fn<'a>(&'a self) where
'repo: 'a, so struct RevWalkRevset<'repo, T> is bounded by T to consume
the lifetime parameter.
2022-12-13 15:55:18 +09:00
Yuya Nishihara
4a889b986c index: implement generation filter on RevWalkGenerationRange
This will be a building block of 'parents(base)' revset. 'base---' will
be .filter_by_generation(3..4) for example. I think 'ancestors(base)' can
also have an optional generation parameter, but I haven't considered any
particular syntax yet.
2022-12-11 13:14:19 +09:00
Yuya Nishihara
832cf8d838 index: add RevWalk variant that tracks generation
Even though I couldn't determine if RevWalkGenerationRange has a measurable
cost compared to RevWalk, I'm not comfortable with enabling generation
tracking by default. So this patch adds a separate struct. I duplicated
Iterator::next() method as it seemed rather complicated to extract a common
iterator wrapper.

Actual filtering function and tests will be added by the next commit.
2022-12-11 13:14:19 +09:00
Yuya Nishihara
4740d7fac1 index: add slot to track state of wanted RevWalk items
RevWalkWorkItem<u32> to track generation for example.
2022-12-11 13:14:19 +09:00
Yuya Nishihara
03eff13d52 index: extract a couple of RevWalk helper functions to inner struct 2022-12-11 13:14:19 +09:00
Yuya Nishihara
a124f84949 index: move core RevWalk logic to inner struct
I'll add a RevWalk that can filter entries by generation range.
2022-12-11 13:14:19 +09:00
Yuya Nishihara
a569ac07f6 revset: alias 'empty()' to '~file(*)'
We're more likely to filter out empty commits, so this should be slightly
faster in practice.

The extra Option<> isn't needed, but it should clarify that "prefix([])"
is not "everything".
2022-12-07 23:38:17 +09:00
Yuya Nishihara
1eaa05b6fd revset: remove uninteresting expressions early
Since internalize_filter() should no longer insert redundant 'all() & x'
nodes, it's simpler to clean up uninteresting nodes first.
2022-12-07 23:38:17 +09:00
Yuya Nishihara
75e072b80c revset: remove stale comment about filter intersection with 'all()'
This should have been removed at e17fc89a8d "revset: make filter node unary,
move candidates to outer intersection".
2022-12-07 23:38:17 +09:00
Yuya Nishihara
222d9a6527 revset: rewrite 'x ~ y' to 'x & ~y' first to apply filter optimization
This is remainder of 48d10d648c "revset: add unary negate (or set
complement) operator '~y'".
2022-12-07 23:38:17 +09:00
Yuya Nishihara
951eb0b61a revset: use filter intersection for tree containing filter
This basically transforms 's1 & (f() | s2)' to
's1.iter().filter(all && f || s2)'. Still the predicate part includes "all",
the filter function doesn't need to load commit data for every entry since
's1.iter().filter(all)' is tested first. To optimize "all" predicate out,
maybe we can add a wrapper that returns '|_: &IndexEntry| true'.

Instead of inserting AsFilter(_) node, I could add a recursive is_filter()
function. That would also work so long as the height of RevsetExpression tree
is limited. I chose node insertion just for ease of snapshot testing.
2022-12-07 11:01:59 +09:00
Yuya Nishihara
f2e7a5ad03 revset: introduce trait that turns evaluated revset into predicate function
This allows us to evaluate 's1 & (f() | s2)' as 's1.iter().filter(f || s2)'
instead of 's1 & (all.iter().filter(f) | s2)'.
2022-12-07 11:01:59 +09:00
Yuya Nishihara
f64f96251f revset: add basic tests for revset combinator
I've made MutableIndex::add_commit_data() crate-public since it's convenient
to build an IndexEntry by that function.
2022-12-07 11:01:59 +09:00
dependabot[bot]
5834a1b191 cargo: bump pest_derive from 2.5.0 to 2.5.1
Bumps [pest_derive](https://github.com/pest-parser/pest) from 2.5.0 to 2.5.1.
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.5.0...v2.5.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>
2022-12-06 08:11:18 -08:00