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

6209 commits

Author SHA1 Message Date
Yuya Nishihara
7be4a0a560 dsl_util: add visitor-like API primarily designed for alias substitution
The templater implementation of FoldableExpression is a stripped-down version
of expand_node(). It's visitor-like because I'm going to write generic alias
substitution rules over abstract expression types (template, revset, fileset.)

Naming comes from rustc.
https://rust-unofficial.github.io/patterns/patterns/creational/fold.html
2024-05-26 11:21:45 +09:00
Yuya Nishihara
5061d4b831 dsl_util: add trait for alias substitution errors
This is basically the same as the previous patch, but for error types. Some
of these functions could be encoded as "E: From<AliasExpandError<'i>>", but
alias substitution logic is recursive, so it would have to convert E back and
force.
2024-05-26 11:21:45 +09:00
Yuya Nishihara
cf6357459d dsl_util: add trait that constructs ExpressionKind of basic AST node types
This isn't fancy, but we'll need some generic way to return either original
or substituted expression node. I think this is the simplest abstraction.
2024-05-26 11:21:45 +09:00
Ilya Grigoriev
b0913342b1 cargo update time, required for recent nightlies
Without this, the `time` crate fails to compile on today's
nightly.

Unfortunately, a full `cargo update` seems to break Watchman
on Windows:

https://github.com/martinvonz/jj/actions/runs/9233007115/job/25404996847?pr=3755
2024-05-24 22:11:28 -07:00
Martin von Zweigbergk
5dea2a9b9b cli: add space around = in jj config list output
I think this makes it more readable. It seems to be how most people
write TOML.
2024-05-24 19:35:45 -07:00
Yuya Nishihara
4478055e1d cli: don't abandon non-discardable old wc commit by import_git_head()
Perhaps, the original intent was to abandon non-empty working-copy commit
assuming it was rewritten by git (therefore it should be superseded by the
current working-copy content.) However, there are other reasons that could
make the HEAD out of sync (including concurrent jj operations), and abandoning
non-empty commit can be a disaster. This patch turns it to safer side, and let
user abandon non-empty commit manually.

Fixes #3747
2024-05-25 10:29:30 +09:00
dependabot[bot]
90565fd2f6 cargo: bump syn from 2.0.65 to 2.0.66 in the cargo-dependencies group
Bumps the cargo-dependencies group with 1 update: [syn](https://github.com/dtolnay/syn).


Updates `syn` from 2.0.65 to 2.0.66
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.65...2.0.66)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-24 20:15:05 +02:00
Yuya Nishihara
2e0dde81a6 github: silence codespell false-positive "NotIn"
Appears that the new version is stricter about CamelCase identifiers?

https://github.com/martinvonz/jj/actions/runs/9217071832/job/25358450632
2024-05-24 11:34:03 +09:00
Yuya Nishihara
f54aca7e67 docs: s/socio-economics/socioeconomics/ per codespell suggestion 2024-05-24 11:34:03 +09:00
Yuya Nishihara
68160a4e77 git_backend: forcibly invalidate in-memory packed-refs cache on gc()
gix 0.63 is now available.

#3537
2024-05-24 10:09:44 +09:00
Yuya Nishihara
02eb164dae config: migrate "config get"/"set" to TOML-based name argument parsing 2024-05-23 12:22:12 +09:00
Yuya Nishihara
97023b8da6 fileset, templater: extract basic AST node types
I'm going to extract generic alias substitution functions, and these AST types
will be accessed there. Revset parsing will also be migrated to the generic
functions.
2024-05-23 10:18:36 +09:00
Yuya Nishihara
0c05c541a1 fileset, templater: insert intermediate InvalidArguments error type
This will help extract common FunctionCallNode<'i, T> type. We don't need
freedom of arbitrary error type choices, but implementing From<_> is the
easiest option I can think of. Another option is to constrain error type by
the expression type T through "T::ParseError: ArgumentsParseError" or
something, but it seemed a bit weird that we have to use trait just for that.
2024-05-23 10:18:36 +09:00
Yuya Nishihara
82b0e88a21 config: add workaround for config path expression parsing
As of config 0.13.4, the path Expression type is private, and there's no escape
syntax. This patch adds a fallback to nested HashMap<String, Value> lookup.

https://github.com/mehcode/config-rs/blob/v0.13.4/src/path/mod.rs#L10
https://github.com/mehcode/config-rs/blob/v0.13.4/src/path/parser.rs

Fixes #1723
2024-05-23 10:18:17 +09:00
Yuya Nishihara
a127fd9c5d config: introduce newtype for dotted config name path
"config list NAME" argument is now parsed as TOML key, but it's still broken
since config.get() expects a query expression in different syntax.

The other config commands will be migrated later.
2024-05-23 10:18:17 +09:00
Yuya Nishihara
f65ba88109 tree: take sub_tree_recursive() argument as &RepoPath
Since RepoPath is now a slice type, it can be constructed without cloning the
backing buffer. Let's simply use it instead of the iterator type.
2024-05-23 10:14:48 +09:00
Martin von Zweigbergk
cd5e82d0d3 tree: make sub_tree_recursive() public
These functions (in `Tree` and `MergedTree`) are safe to use. We have
a duplicate of these functions at Google, which would be nice to
avoid.
2024-05-22 11:21:18 -07:00
Martin von Zweigbergk
50dd78eb8f cargo: upgrade gix to version 0.63 2024-05-22 11:20:57 -07:00
Martin von Zweigbergk
aecee1d6cc tree: make MergedTreeVal::to_merge() public
I don't think there's any harm in this function being public. We have
a duplicate of it at Google.
2024-05-22 11:20:43 -07:00
Martin von Zweigbergk
ff4ea73ac0 cli: move a few functions in commands/config.rs to public places
Turns out we use some of the functions in `commands/config.rs` at
Google. (We use them for writing name and email if the user hasn't set
them.)
2024-05-22 07:47:57 -07:00
Martin von Zweigbergk
b227dde787 conflicts: indicate executable conflict in git-format diff 2024-05-22 06:46:58 -07:00
Martin von Zweigbergk
07bb1d81b7 tree_builder: propagate errors from write_tree() 2024-05-22 06:46:38 -07:00
Martin von Zweigbergk
1970ddef15 tree: propagate errors from sub_tree()/path_value() 2024-05-22 06:46:38 -07:00
Martin von Zweigbergk
facfb71f7b test_merged_tree: reduce duplication and wrapping with helper lambdas
I'm about to make `[Merged]Tree::path_value()` return a `Result`. This
will help even more then.
2024-05-22 06:46:38 -07:00
Yuya Nishihara
2143cc3686 fileset: consolidate signature of invalid arguments error constructors
For the same reason as the templater changes. These FunctionCallNode types will
be extracted as utility type.
2024-05-22 10:18:05 +09:00
Yuya Nishihara
7a230395c2 fileset: implement expect_no_arguments() as method 2024-05-22 10:18:05 +09:00
Yuya Nishihara
c9b088c795 templater: let caller specify function name and span of invalid arguments error
This will help extract interface of the error constructor without depending on
T: ExpressionKind type.
2024-05-22 10:18:05 +09:00
Yuya Nishihara
e5fca8fadd templater: add helper that maps FunctionCallNode to error 2024-05-22 10:18:05 +09:00
Yuya Nishihara
da005444e1 templater: forward expect_no_arguments() to expect_exact_arguments() 2024-05-22 10:18:05 +09:00
Yuya Nishihara
04efac3a51 templater: implement expect_*_arguments() as methods
I'm thinking of moving them to dsl_util, but we'll probably want to avoid
importing dsl_util at call sites.
2024-05-22 10:18:05 +09:00
Yuya Nishihara
06f488a8f6 cli: config: update default template for multi-line overridden values 2024-05-22 10:17:37 +09:00
Yuya Nishihara
ef8038f60f cli: config: leverage toml_edit::Value to serialize values
I use ValueKind::Ty(ref v) here because (*v).into() looked rather noisy.

Fixes #3374
2024-05-22 10:17:37 +09:00
Yuya Nishihara
d38c366a98 cli: config: use str.parse() to remove "use FromStr" 2024-05-22 10:17:37 +09:00
Yuya Nishihara
7b72e04206 cli: config: move helper functions to commands.config module
There are no external callers, so let's make them private.
2024-05-22 10:17:37 +09:00
Matt Stark
fa6f5e3880 Add the revsets mutable and immutable.
I add them as aliases, since a user may instead choose to define `immutable_heads()`, for example, as `heads(immutable())`, and the define `immutable()` instead.
2024-05-22 09:19:46 +10:00
Ilya Grigoriev
77cf968316 docs: replace redirects with copies of files
This means that <https://martinvonz.github.io/jj/latest/index.html> will
not longer redirect to
<https://martinvonz.github.io/jj/v0.18.0/index.html> (or similar) after
the next release, as requested by @jyn514 on Discord. Instead, it will
be a copy.

Originally, the plan was to use mike's symlink functionality and make
`latest` a symlink. See a comment inline for how that didn't work; we
could do that after changing how GitHub Pages are built.

Before the next `jj` release, and after this PR is merged, you can play
with this by going to <https://martinvonz.github.io/jj/main/> which is
an alias for <https://martinvonz.github.io/jj/prerelease/>.

Because of previous commits in this PR, the latest version will be
marked in the version selector as "latest", so hopefully this won't
confuse users.

Due to the parent commit, the "latest" URL will be considered canonical.
2024-05-21 16:19:04 -07:00
Ilya Grigoriev
864869abd5 docs: set canonical_version to latest
Currently, https://www.google.com/search?q=jj+revsets has problematic
results, one of the top links for me is
https://martinvonz.github.io/jj/v0.14.0/github/ (we are currently on
v0.17.1).

I hope this will help them all point to `latest` instead.
2024-05-21 16:19:04 -07:00
Ilya Grigoriev
ff810c6097 docs: show version alias in version selector
See https://github.com/martinvonz/jj/pull/3723 for a screenshot.

This will make it clearer to the users that the "latest" and "v0.??.?"
are the same even if the former does not redirect to the latter (but has
identical contents).

MkDocs material lists the *first* alias for each version, so I also
added a "nightly" alias for "prerelease". Otherwise, users would see the
"main" alias, and might get confused whether they should use "latest" or
"main" docs if they don't realize it's named after the "main" branch.

(Upon testing, it still shows "main" for now, but it should be possible
to fix this after this PR is merged by reordering the aliases directly
in `versions.json` on the gh-pages branch)
2024-05-21 16:19:04 -07:00
Ilya Grigoriev
54e04e4ac3 update mkdocs-material & poetry update
The new version supports showing labels in version selector.
2024-05-21 16:19:04 -07:00
Remo Senekowitsch
2a320b324c github: add linux-aarch64 build 2024-05-21 13:49:06 -05:00
dploch
d31edd4ac5 changelog: fix typo and move 'reachable' announcement to correct section 2024-05-21 10:51:48 -05:00
dploch
a49da4ad01 revset: implement a 'reachable(src, domain)' expression
This revset correctly implements "reachability" from a set of source commits following both parent and child edges as far as they can go within a domain set. This type of 'bfs' query is currently impossible to express with existing revset functions.
2024-05-21 10:52:31 -04:00
dploch
5125eab505 union_find: implement a library for the Union-Find algorithm 2024-05-21 10:52:31 -04:00
Thomas Castiglione
13c8f32ceb local_working_copy: fix some clippy lints that only show up on Windows 2024-05-21 14:37:17 +08:00
Thomas Castiglione
59d3a2c866 local_working_copy: when all sides of a conflict are executable, materialise the conflicted file as executable
Fixes #3579 and adds a testcase for an executable conflict treevalue.
2024-05-21 14:37:17 +08:00
dependabot[bot]
5041649cbb ---
updated-dependencies:
- dependency-name: requests
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-21 01:26:34 -05:00
Ilya Grigoriev
84007075d9 jj config list: escape keys
Fixes #1322. There may be more places where keys need escaping, I'm not
completely sure.
2024-05-20 22:39:56 -07:00
Ilya Grigoriev
1f7c4ec60a conflicts: label closing delimeter with conflict number
This follows up on https://github.com/martinvonz/jj/pull/3459 and adds a
label to the closing delimeter of each conflict, e.g.  "Conflict 1 of 3
ends".

I didn't initially put any label at the ending delimeter since the
starting delimeter is already marked with "Conflict 1 of 3". However,
I'm now realizing that when I resolve conflicts, I usually go from top
to bottom. The first thing I do is delete the starting conflict
delimeter. It is when I get to the *end* of the conflict that I wonder
whether there are any more conflicts left in the file.
2024-05-20 18:36:51 -07:00
dependabot[bot]
7812beb087 github: bump github/codeql-action in the github-dependencies group
Bumps the github-dependencies group with 1 update: [github/codeql-action](https://github.com/github/codeql-action).


Updates `github/codeql-action` from 2.13.4 to 3.25.6
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](cdcdbb5797...9fdb3e4972)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-20 16:10:46 +00:00
dependabot[bot]
990c48a9bc cargo: bump the cargo-dependencies group with 7 updates
Bumps the cargo-dependencies group with 7 updates:

| Package | From | To |
| --- | --- | --- |
| [anyhow](https://github.com/dtolnay/anyhow) | `1.0.83` | `1.0.86` |
| [libc](https://github.com/rust-lang/libc) | `0.2.153` | `0.2.155` |
| [proc-macro2](https://github.com/dtolnay/proc-macro2) | `1.0.82` | `1.0.83` |
| [prost](https://github.com/tokio-rs/prost) | `0.12.4` | `0.12.6` |
| [prost-build](https://github.com/tokio-rs/prost) | `0.12.4` | `0.12.6` |
| [syn](https://github.com/dtolnay/syn) | `2.0.64` | `2.0.65` |
| [thiserror](https://github.com/dtolnay/thiserror) | `1.0.60` | `1.0.61` |


Updates `anyhow` from 1.0.83 to 1.0.86
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.83...1.0.86)

Updates `libc` from 0.2.153 to 0.2.155
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.153...0.2.155)

Updates `proc-macro2` from 1.0.82 to 1.0.83
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.82...1.0.83)

Updates `prost` from 0.12.4 to 0.12.6
- [Release notes](https://github.com/tokio-rs/prost/releases)
- [Commits](https://github.com/tokio-rs/prost/compare/v0.12.4...v0.12.6)

Updates `prost-build` from 0.12.4 to 0.12.6
- [Release notes](https://github.com/tokio-rs/prost/releases)
- [Commits](https://github.com/tokio-rs/prost/compare/v0.12.4...v0.12.6)

Updates `syn` from 2.0.64 to 2.0.65
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.64...2.0.65)

Updates `thiserror` from 1.0.60 to 1.0.61
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.60...1.0.61)

---
updated-dependencies:
- dependency-name: anyhow
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: libc
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: proc-macro2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: prost
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: prost-build
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-20 15:54:47 +00:00