Commit graph

3109 commits

Author SHA1 Message Date
Yuya Nishihara
7dc35b82b0 revset: evaluate ancestors without using RevsetExpression builder API
I'm thinking of transforming RevsetExpression to a enum dedicated for
the evaluation stage. To help the migration, I want to remove the use of
the RevsetExpression builder API from the evaluation engine.

Fewer virtual dispatch is also better.
2023-04-08 12:13:30 +09:00
Martin von Zweigbergk
ed0b23d009 cli: include commit id from build in version
This changes the version number reported by `jj version` from "0.7.0"
to something like
"0.7.0-24a512683bc921699575b6a953624b05c068d544a". The hash is added
if running in a jj repo or a git repo.
2023-04-07 17:33:44 -07:00
dependabot[bot]
cfdfc452dc github: bump github/codeql-action from 2.2.10 to 2.2.11
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.2.10 to 2.2.11.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](8c8d71dde4...d186a2a36c)

---
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>
2023-04-07 10:02:55 -07:00
Martin von Zweigbergk
24a512683b revset: add a revset function for finding commits with conflicts
This adds `conflict()` revset that selects commits with conflicts. We
may want to extend it later to consider only conflicts at certain
paths.
2023-04-06 16:46:21 -07:00
dependabot[bot]
f0cc4c3ae2 github: bump github/codeql-action from 2.2.9 to 2.2.10
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.2.9 to 2.2.10.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](04df1262e6...8c8d71dde4)

---
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>
2023-04-06 16:27:50 -07:00
dependabot[bot]
dc9658159b github: bump EmbarkStudios/cargo-deny-action from 1.5.0 to 1.5.1
Bumps [EmbarkStudios/cargo-deny-action](https://github.com/EmbarkStudios/cargo-deny-action) from 1.5.0 to 1.5.1.
- [Release notes](https://github.com/EmbarkStudios/cargo-deny-action/releases)
- [Commits](8af37f5d0c...3d26fd4e2a)

---
updated-dependencies:
- dependency-name: EmbarkStudios/cargo-deny-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-06 16:27:29 -07:00
David Barnett
22306af17a Add docs on how to use GitHub CLI in repos that aren't co-located 2023-04-05 21:22:49 -06:00
Martin von Zweigbergk
ac27cdea69 cli: include total downloaded size in progress output
With this change, the output looks like this:

```
  3% 165.9 Mi at  13.4 MiB/s [█▋                                                   ]
```

Closes #1483.
2023-04-05 06:21:32 -07:00
Yuya Nishihara
308a5b9eae revset: make empty()/file(".") not load root tree for liner history
TreeDiffIterator wouldn't load identical subtrees, but it's up to caller to
optimize out the root tree loading.
2023-04-05 21:53:24 +09:00
dependabot[bot]
feeb83dc0f cargo: bump libc from 0.2.140 to 0.2.141
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.140 to 0.2.141.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.140...0.2.141)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-04 10:02:26 -07:00
Ilya Grigoriev
233dda1057 cmd: prohibit creating branches at the root commit
Such branches lead to confusing errors on git expoert or push.
2023-04-03 23:51:47 -07:00
Ilya Grigoriev
31f7c806e2 squash/amend: Add -m argument to set description
This prevents an editor opening, and is useful in scripts/tests.
2023-04-03 23:51:15 -07:00
Martin von Zweigbergk
e1c57338a1 revset: split out no-args head() to visible_heads()
The `heads()` revset function with one argument is the counterpart to
`roots()`. Without arguments, it returns the visible heads in the
repo, i.e. `heads(all())`. The two use cases are quite different, and
I think it would be good to clarify that the no-arg form returns the
visible heads, so let's split that out to a new `visible_heads()`
function.
2023-04-03 23:46:34 -07:00
Yuya Nishihara
982062bd75 revset: do not always evaluate filter node to InternalRevset
This basically removes hidden 'all() &' from union/negation of filters. To
achieve that, I have two options: 1. add separate evaluation path (like the
one this commit introduced), or 2. wrap "all()" revset to override predicate
as Box::new(|_| true) function. I took the former since it's less ad-hoc.

We can add an explicit RevsetExpression node to branch between evaluate()
and evaluate_predicate(), but I don't think it would simplify the
implementation at this point. We might need such node if we want to resolve
"all()" at resolve_symbols(). It might be even better to extract a subset of
RevsetExpression enum, which only contains evaluatable nodes.

The cost of 'all() &' isn't significant for most filters. '~merges()' is
the exception. For jj repo,

    revsets/:v0.3.0 & (author(martinvonz) | committer(martinvonz))
    --------------------------------------------------------------
    base     1.06      11.2±0.04m
    new      1.00      10.5±0.05m

    revsets/~merges()
    -----------------
    base     1.69     750.0±8.47µ
    new      1.00     444.1±3.50µ
2023-04-04 15:21:21 +09:00
Yuya Nishihara
69794f2585 revset: add method to upcast InternalRevset to ToPredicateFn 2023-04-04 15:21:21 +09:00
Yuya Nishihara
426f3e4e0a revset: simplify evaluation of "all()"
I think this is more readable, and apparently it produces slightly better code
maybe because the compiler can determine that there are no unwanted markers.
2023-04-04 15:21:21 +09:00
Yuya Nishihara
0bfdbcaa1e revset: don't rewrite '~set & filter' as difference
Since filter is slow in general, its input set should be minimized. This has
measurable impact on artificial query like '~(v0.4.0..) & author(_)'. If it
were evaluated as a difference of sets, all commits would have to be loaded.
2023-04-04 15:21:21 +09:00
Glen Choo
707d82245f docs/technical: add aspirational Git submodules doc
This document is meant to be a record of how we think about Git
submodules (and not a _current_ implementation of submodules). We will
fill it out incrementally as we get a clearer idea of what we want
submodules to look like.

As an initial version, I started with (IMO) the least controversial
points:

- We want to support most workflows Git submodules users are accustomed
  to.

- A roadmap that allows us to incrementally roll out Git submodule
  functionality (instead of having to boil the ocean).
2023-04-03 12:58:17 -07:00
dependabot[bot]
663f0ef697 cargo: bump pest_derive from 2.5.6 to 2.5.7
Bumps [pest_derive](https://github.com/pest-parser/pest) from 2.5.6 to 2.5.7.
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.5.6...v2.5.7)

---
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-04-03 09:29:53 -07:00
dependabot[bot]
658423dc78 cargo: bump test-case from 3.0.0 to 3.1.0
Bumps [test-case](https://github.com/frondeus/test-case) from 3.0.0 to 3.1.0.
- [Release notes](https://github.com/frondeus/test-case/releases)
- [Changelog](https://github.com/frondeus/test-case/blob/master/CHANGELOG.md)
- [Commits](https://github.com/frondeus/test-case/compare/v3.0.0...v3.1.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-03 09:29:29 -07:00
dependabot[bot]
fb27885c5d cargo: bump git2 from 0.16.1 to 0.17.0
Bumps [git2](https://github.com/rust-lang/git2-rs) from 0.16.1 to 0.17.0.
- [Release notes](https://github.com/rust-lang/git2-rs/releases)
- [Changelog](https://github.com/rust-lang/git2-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/git2-rs/compare/0.16.1...git2-curl-0.17.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-03 09:24:05 -07:00
Ilya Grigoriev
0e2579ee6a Switch graph node to use for commit instead of
This follows up on 5c703aeb03.

The only reason for this change is that, subjectively, the result looks better to me. I'm not sure why, but I couldn't get used to the old symbol in spite of its seeming reasonableness. It felt really bold and heavy.

If people agree, we can wait until we need to update the screenshots for some other reason before merging this. Sorry I didn't figure this out while the discussion about the referenced commit was going on.

I'm not 100% certain how many fonts support each symbol. Please try it out and let me know if it doesn't work for you.

Compare after:

![image](https://user-images.githubusercontent.com/4123047/229251383-563b889d-7233-42e2-a3c5-bf9368a4d1fd.png)

and before:

![image](https://user-images.githubusercontent.com/4123047/229251695-7fd0ff2c-2832-4262-ade5-5120288cccdf.png)
2023-04-02 23:15:37 -07:00
Yuya Nishihara
3927c01d08 revset: make error type opaque to try_transform_expression()
It no longer handles RevsetResolutionError.
2023-04-03 10:55:03 +09:00
Yuya Nishihara
f1e2d19d57 revset: fully consume Present(_) node by resolve_symbols()
Since resolve_symbols() now removes Present(_) node, it make sense to
handle symbol resolution error there. That's why I added a "pre" callback
to try_transform_expression().

Perhaps, "operation" scope (#1283) can be implemented in a similar way,
(but somehow need to resolve operation id and call repo.reload_at(op).)
2023-04-03 10:55:03 +09:00
Yuya Nishihara
aeb93c7591 revset: insert pre-order callback that can terminate transformation early
This will be a hook for resolve_symbols() to transform Present(_) subtree.
2023-04-03 10:55:03 +09:00
Yuya Nishihara
feaad6b5fa revset: add type alias for Option<Rc<RevsetExpression>>
I'm going to parameterize error type of TransformResult, and the result type
will be replaced with Result<TransformedExpression, E>.
2023-04-03 10:55:03 +09:00
Yuya Nishihara
c28d2d7784 revset: split RevsetError into RevsetResolution/EvaluationError
This makes it clear that RevsetExpression::Present node is noop at the
evaluation stage.

RevsetEvaluationError::StoreError is unused right now, but I'm not sure if
it should be removed. It makes some sense that evaluate() can propagate
StoreError as it has access to the store.
2023-04-03 10:55:03 +09:00
Yuya Nishihara
f2e0836b1e cli: map RevsetError to CommandError early
I'm going to split RevsetError into symbol resolution and evaluation errors,
and evaluate_revset() is the only place where CLI crate explicitly specifies
RevsetError type.
2023-04-03 10:55:03 +09:00
Yuya Nishihara
6c5947181d cli: reimplement "debug resolverev" as command to debug print revset
Also removed -r/--revision and the default "@" as it is a debug command.
2023-04-02 22:54:46 +09:00
Yuya Nishihara
429562ca2f revset: implement Debug for RevsetImpl and add trait bound accordingly 2023-04-02 22:54:46 +09:00
Yuya Nishihara
2aab6c7825 revset: implement Debug for InternalRevset objects
Even though predicate function and RevWalk internals can't be debug printed,
it's useful to see an overview of InternalRevset tree.
2023-04-02 22:54:46 +09:00
Yuya Nishihara
b297b7c965 revset: turn PurePredicateFn into newtype struct
This will avoid extra boxing when converting PurePredicateFn to dyn
ToPredicateFn object.
2023-04-02 22:54:46 +09:00
Yuya Nishihara
fbb292f7c9 revset: relax lifetime bound of ToPredicateFn
We don't have to require that the input IndexEntry<'_> has 'index lifetime.
2023-04-02 22:54:46 +09:00
Yuya Nishihara
2404dc8cd3 revset: remove redundant type bound from RevWalkRevset
The "'index: 'a" bound can be removed by bypassing the Box<dyn> indirection
of self.iter().
2023-04-02 22:54:46 +09:00
Ilya Grigoriev
a58af4f19d Work around a couple of false positives for recent nightly clippy
This is likely https://github.com/rust-lang/rust-clippy/issues/10577
2023-04-01 18:35:38 -07:00
Yuya Nishihara
5a771c913b cli: unify "bench revset"/"revsets" commands 2023-04-01 22:52:11 +09:00
Yuya Nishihara
6c6fdae88d cli: allow to run "jj bench revset" for more than one revsets 2023-04-01 11:13:05 +09:00
Yuya Nishihara
a27fb79e96 cli: fix completion of "jj bench revsets FILE" argument 2023-04-01 11:13:05 +09:00
Yuya Nishihara
4ff5c52edc cli: expose some criterion options as bench command args
I want to adjust --sample-size while running slow revset benchmarks. The
baseline option seems also useful.

Short options are derived from Criterion::configure_from_args().
2023-04-01 11:13:05 +09:00
Yuya Nishihara
8a796cd98c cli: copy color output option to Criterion 2023-04-01 11:13:05 +09:00
Yuya Nishihara
9f1dc8f67c cli: remove excessive newline from "jj bench revset(s)" output 2023-04-01 11:13:05 +09:00
dependabot[bot]
0f108e278d cargo: bump pest from 2.5.6 to 2.5.7
Bumps [pest](https://github.com/pest-parser/pest) from 2.5.6 to 2.5.7.
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.5.6...v2.5.7)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-31 09:27:29 -07:00
dependabot[bot]
b62cccf6dc cargo: bump dirs from 4.0.0 to 5.0.0
Bumps [dirs](https://github.com/soc/dirs-rs) from 4.0.0 to 5.0.0.
- [Release notes](https://github.com/soc/dirs-rs/releases)
- [Commits](https://github.com/soc/dirs-rs/commits)

---
updated-dependencies:
- dependency-name: dirs
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-31 09:23:21 -07:00
Martin von Zweigbergk
68ea927c66 cli: move default ui.pager config to misc.toml 2023-03-30 21:16:28 -07:00
Martin von Zweigbergk
5ae6698f81 cli: report invalid ui.pager config value
If you set e.g.`ui.pager = 5`, we currently ignore that and fall back
to the default. It seems better to let the user know that their config
is invalid, as we generally do. This commit does that. With this
change, the error message will look like this:

```
Config error: Invalid `ui.pager`: data did not match any variant of untagged enum CommandNameAndArgs
```

Maybe the key name will be redundant once the `config` crate releases
a version including https://github.com/mehcode/config-rs/pull/413
(thanks, Yuya).
2023-03-30 21:16:28 -07:00
Martin von Zweigbergk
5fe5991ca8 cli: on config error, point to documentation 2023-03-30 21:16:28 -07:00
Martin von Zweigbergk
3546cc1bf6 revset: pass in store, index, and heads instead of whole Repo
The `Repo` is a higher-level type that the index shouldn't have to
know about. With this change, a custom revset implementation should be
able evaluate the revset on a server without knowing which repo it
refers to.
2023-03-30 20:15:45 -07:00
Martin von Zweigbergk
9f9e356f3d revset: use the default index impl more in default revset engine
We already pass a `CompositeIndex` to
`default_revset_engine::evaluate()` so let's use that wherever we
currently use `repo.index()`. That will help us remove the `repo`
argument, and it will also let us internal types (like `IndexEntry`)
in the index methods we call.
2023-03-30 20:15:45 -07:00
Martin von Zweigbergk
002ec1ac68 revset: move internal_evaluate() onto new context type
I'm about to replace the `&dyn Repo` argument by several smaller
types, and it's easier to collect those in a single context type than
to pass them separately as arguments.

I also moved `revset_for_commit_ids()` and `take_latest_revset()` onto
the new type because it was easy. `build_predicate_fn()` and
`has_diff_from_parent()` ran into some lifetime issue when I tried.
2023-03-30 20:15:45 -07:00
Martin von Zweigbergk
3ff1ab520b revset: remove public_heads()
The `public_heads()` revset only contains the root commit in
practice. I'm not sure what we want to do about phases, but since we
don't have any real support for them yet, let's just remove this
revset. I didn't update the changelog because we don't seem to have
documented the revset function (and it seems unlikely that users who
found out about it found it useful enough to use it when they could
just use `root`).
2023-03-30 20:15:45 -07:00