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

7136 commits

Author SHA1 Message Date
dependabot[bot]
bb92ab21d0 cargo: bump the cargo-dependencies group with 3 updates
Bumps the cargo-dependencies group with 3 updates: [clap](https://github.com/clap-rs/clap), [clap_complete](https://github.com/clap-rs/clap) and [clap_complete_nushell](https://github.com/clap-rs/clap).


Updates `clap` from 4.5.19 to 4.5.20
- [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-v4.5.19...clap_complete-v4.5.20)

Updates `clap_complete` from 4.5.32 to 4.5.33
- [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-v4.5.32...clap_complete-v4.5.33)

Updates `clap_complete_nushell` from 4.5.3 to 4.5.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/clap_complete_nushell-v4.5.3...clap_complete_nushell-v4.5.4)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-08 19:00:48 +02:00
Yuya Nishihara
760134f9c1 revset: error out on unindexed commit ID instead of panicking
It no longer makes sense to handle missing root commit by the revset frontend,
but panicking wouldn't be good either. Let's make it error out.
2024-10-08 13:21:03 +09:00
Yuya Nishihara
ae62b5b946 repo: teach OpStore about the root commit id
This removes an invalid View state from the root operation.

Note that the root index will have to be reindexed in order to resolve "root()"
in the root operation. I don't think this would practically matter, so this
patch doesn't bump the index version to invalidate the existing indexes.

See also 48a9f9ef56 "repo: use Transaction for creating repo-init operation."
2024-10-08 13:21:03 +09:00
Yuya Nishihara
2df442299d repo: plumbing to initialize root view with root commit id
See the next patch for why. It might look odd that OpStore depends on the root
CommitId, but that seems okay because OpStore manages Views, and a View is
basically a set of CommitIds.
2024-10-08 13:21:03 +09:00
Yuya Nishihara
33f0472fcf repo: add convenient methods to load operation object
It's hosted by RepoLoader for now. I'm not sure if we'll need a higher-level
abstraction like Store.
2024-10-08 13:21:03 +09:00
Yuya Nishihara
30a348344b repo: pack common ReadonlyRepo fields into RepoLoader
I'll add a few helper methods to RepoLoader. It seems also nicer that
repo.loader() doesn't allocate new RepoLoader.
2024-10-08 13:21:03 +09:00
Yuya Nishihara
47ff6f18aa repo: fix type name in ReadonlyRepo debug output, show ellipsis 2024-10-08 13:21:03 +09:00
Yuya Nishihara
f4df996242 changelog: fix conflict resolution error in 95344f9e 2024-10-08 09:58:06 +09:00
dploch
eb09a3e965 bookmarks-list: fix typo 2024-10-07 20:37:14 -04:00
dploch
95344f9e05 simplify-parents: add a command to remove redundant parents 2024-10-07 20:15:33 -04:00
Martin von Zweigbergk
b2e4854a43 docs: explain a bit about good commit messages
We didn't have any guidelines about what to include in a commit
message. Others have already written good guides for that. This commit
adds a link to one. I also added a sentence about explaining the
reason for a change, since I think that's particularly often missed
(I'm sure I also miss it sometimes - don't hesitate to point out when
that happens).
2024-10-07 17:02:49 -07:00
Martin von Zweigbergk
71b60a3102 docs: clarify that commit messages start with a topic, not a component
It's generally more useful to say something like "revset: use Self to
refer to expressions of the same type" than "lib: use Self to refer to
revset expressions of the same type ", so let's try to clarify that.
2024-10-07 17:02:49 -07:00
dependabot[bot]
9f578c4f10 cargo: bump the cargo-dependencies group with 3 updates
Bumps the cargo-dependencies group with 3 updates: [futures](https://github.com/rust-lang/futures-rs), [once_cell](https://github.com/matklad/once_cell) and [proc-macro2](https://github.com/dtolnay/proc-macro2).


Updates `futures` from 0.3.30 to 0.3.31
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.30...0.3.31)

Updates `once_cell` from 1.20.1 to 1.20.2
- [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md)
- [Commits](https://github.com/matklad/once_cell/compare/v1.20.1...v1.20.2)

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

---
updated-dependencies:
- dependency-name: futures
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: once_cell
  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
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-08 08:47:48 +09:00
dploch
0c7357ec5f ui: write prompt messages to stderr
This enables more scripting use cases where the caller may wish to parse stdout for programmatic purposes.
2024-10-07 19:47:18 -04:00
dploch
7b8df5d8fd ui: simplify stripping logic and get rid of warning 2024-10-07 19:47:18 -04:00
Matt Stark
a524f1f996 refactor: Allow the aliases map to map to arbitrary types.
For #3673, we will have aliases such as:
```toml
'upload(revision)' = [
  ["fix", "-r", "$revision"],
  ["lint", "-r", "$revision"],
  ["git", "push", "-r", "$revision"],
]
```

Template aliases:
1) Start as Config::Value
2) Are converted to String
3) Are placed in the alias map
4) Expand to a TemplateExpression type via expand_defn.

However, command aliases:
1) Start as Config::Value
2) Are converted to Vec<Vec<String>>
3) Are placed in an alias map
4) Do not expand

Thus, AliasesMap will need to support non-string values.
2024-10-08 10:19:14 +11:00
Martin von Zweigbergk
b90d60ca1f git: allow both --branch/--bookmark for git fetch/push
`jj git push` has a `--bookmark` argument, which takes a list of
bookmarks to push to the Git remote. They'll become branches on the
Git remote. `jj git fetch` has a `--branch` argument, which takes a
list of Git branches to fetch. They'll become bookmarks once
fetched. So the naming is consistent, but the reasoning is quite
subtle. Let's provide the other name as a hidden alias to help users
who get it wrong.
2024-10-07 10:08:43 -07:00
dependabot[bot]
a560b1ab57 github: bump actions/upload-artifact in the github-dependencies group
Bumps the github-dependencies group with 1 update: [actions/upload-artifact](https://github.com/actions/upload-artifact).


Updates `actions/upload-artifact` from 4.4.0 to 4.4.1
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](50769540e7...604373da63)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-07 18:18:44 +02:00
Yuya Nishihara
24ff802f58 revset: use Self to refer to expressions of the same type
Just because it's shorter.
2024-10-06 23:03:38 +09:00
Yuya Nishihara
68f48605e9 cli: in color-words diffs, highlight word-level hunks in context lines
Since context lines are styled in the same way as diff lines, it makes sense
to highlight words within context lines.
2024-10-06 09:45:27 +09:00
Yuya Nishihara
1eeeb1462a cli: extract helpers from show_color_words_context_lines()
This should make the next patch a bit easier to read.
2024-10-06 09:45:27 +09:00
Yuya Nishihara
6877ec4316 cli: add diff --ignore-all-space/--ignore-space-change flags
These flags only apply to line-based diffs. This is easy, and seems still useful
to highlight whitespace changes (that could be ignored by line diffing.)

I've added short options only to "diff"-like commands. It seemed unclear if
they were added to deeply-nested commands such as "op log".

Closes #3781
2024-10-06 09:45:27 +09:00
Yuya Nishihara
dc954517b9 cli: extract UnifiedDiff/DiffStatOptions structs
UnifiedDiffOptions could be wrapped by GitDiffOptions, but there are no Git-diff
specific options right now.
2024-10-06 09:45:27 +09:00
Yuya Nishihara
df40a09a5d cli: rename ColorWordsOptions to ColorWordsDiffOptions
I'm going to add an options struct for git diff, but GitOptions, UnifiedOptions,
StatOptions, etc. sound odd.
2024-10-06 09:45:27 +09:00
Yuya Nishihara
383cca4c4d diff: return matching hunk contents from all inputs
We're likely to use the right (or new) context lines in rendered diffs, but
it's odd that the hunks iterator choose which context hunk to return. We'll
also need both contents to calculate left/right line numbers.

Since the hunk content types are the same, I also split enum DiffHunk into
{ kind, contents } pair.
2024-10-06 09:45:27 +09:00
Fedor Sheremetyev
cacd6a3fd0 docs: add link to VisualJJ 2024-10-05 01:18:52 -07:00
Yuya Nishihara
c5f926103a diff: use low-level HashTable in Histogram
This change made some diff benches slow, maybe because the generated code
becomes slightly worse due to the added abstraction? I'll revisit the
performance problem later. There are a couple of ways to mitigate it.

```
group                             new                     old
-----                             ---                     ---
bench_diff_git_git_read_tree_c    1.02     61.0±0.23µs    1.00     59.7±0.38µs
bench_diff_lines/modified/10k     1.00     41.6±0.24ms    1.02     42.3±0.22ms
bench_diff_lines/modified/1k      1.00      3.8±0.07ms    1.00      3.8±0.03ms
bench_diff_lines/reversed/10k     1.29     23.4±0.20ms    1.00     18.2±0.26ms
bench_diff_lines/reversed/1k      1.05    517.2±5.55µs    1.00   493.7±59.72µs
bench_diff_lines/unchanged/10k    1.00      3.9±0.10ms    1.08      4.2±0.10ms
bench_diff_lines/unchanged/1k     1.01    356.8±2.33µs    1.00    353.7±1.99µs
```
(I don't get stable results on my noisy machine, so the results would vary.)
2024-10-05 08:12:30 +09:00
Yuya Nishihara
de137c8f9a diff: implement some ignore-space rules
The added comparison functions correspond to --ignore-all-space and
--ignore-space-change. --ignore-space-at-eol can be combined with the other
flags, so it will have to be implemented as a preprocessing function.
--ignore-blank-lines will also require some change in the tokenizer function.
2024-10-05 08:12:30 +09:00
Yuya Nishihara
f672c92509 diff: add trait for bytes comparison
This could be implemented as a newtype `Wrapper<'a>(&'a [u8])`, but a lifetime
of the wrap function couldn't be specified correctly:

  fn diff(left: &[u8], right: &[u8], wrap_fn: F, ..)
  where
    F: for<'a> Fn(&'a [u8]) -> W<'a>, // F::Output<'a> can't be specified
    W: Copy + Eq + Hash

If the wrapper were of `&Wrapper([u8])` type, `Fn(&[u8]) -> &W` works. However,
it means we can no longer set comparison parameter (such as Regex) dynamically.

Another idea is to add some filter function of `Fn(&[u8]) -> Cow<'_, [u8]>`
type, but I don't think we would want to pay the allocation cost in
hashing/comparison code. `Fn(&[u8]) -> impl Iterator<Item = &[u8]>` might work,
but it would be equally complex.
2024-10-05 08:12:30 +09:00
Yuya Nishihara
dfaa52c88a cargo: add hashbrown dependency
We'll use low-level HashTable to customize Eq/Hash without implementing newtype
wrappers.

Unneeded default features are disabled for now. Note that the new default
hasher, foldhash, is released under the Zlib license, which isn't currently
included in the allow list.
2024-10-05 08:12:30 +09:00
Samuel Tardieu
6368544f4f style: use explicit loop instead of .for_each() in simple cases 2024-10-04 22:29:13 +02:00
Samuel Tardieu
43711de61c style: use .filter_map() instead of .flat_map() where appropriate 2024-10-04 22:29:13 +02:00
Samuel Tardieu
12f4d6d17b style: avoid using .to_owned()/.to_vec() on owned objects
`.clone()` is more explicit when we already have an object
of the right type.
2024-10-04 22:29:13 +02:00
Samuel Tardieu
3f2ef2ee04 style: add semicolon at the end of expressions used as statements 2024-10-04 22:29:13 +02:00
Samuel Tardieu
46e2723464 style: inline variables into format strings 2024-10-04 22:29:13 +02:00
Samuel Tardieu
62f582e6ab style: remove useless uses of .iter()
Most collection references implement `.into_iter()` or its mutable version,
so it is possible to iterate over the elements without using an explicit
method to do so.
2024-10-04 22:29:13 +02:00
Samuel Tardieu
3f0703ca2c cargo: inherit lints configuration from workspace 2024-10-04 22:29:13 +02:00
Samuel Tardieu
794db9dae0 style: do not return a Result when this is not needed 2024-10-04 22:29:13 +02:00
Martin von Zweigbergk
801b243678 docs: mention snapshot.auto-track in config.md too
I forgot to add the `snapshot.auto-track` config option to `config.md`
when I added it. This patch copies it from `working-copy.md` and
modifies it slightly.
2024-10-04 12:42:22 -07:00
dependabot[bot]
266b804326 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 3.26.10 to 3.26.11
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](e2b3eafc8d...6db8d6351f)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-04 11:45:53 -05:00
Samuel Tardieu
fb12e48fc9 cli: add short method summary to its documentation 2024-10-04 17:09:54 +02:00
Samuel Tardieu
8ba33b7383 lib: add short method summary to its documentation 2024-10-04 17:09:54 +02:00
Samuel Tardieu
87840a5c2c testutils: add short method summary to its documentation 2024-10-04 17:09:54 +02:00
Samuel Tardieu
ac95a86584 proc-macros: add short method summary to its documentation 2024-10-04 17:09:54 +02:00
Samuel Tardieu
e2408078bf cli: add pointer to the documentation in case of fileset syntax error 2024-10-04 17:09:43 +02:00
Yuya Nishihara
af556aa01c tests: rename test_file_print_command.rs to_file_show_command.rs 2024-10-04 20:52:59 +09:00
Matt Stark
6878b5047b Fix: Disallow revset function names starting with a number. 2024-10-04 15:25:11 +10:00
Theodore Ehrenborg
3d26af876f docs: update stale references to singular file() revset 2024-10-03 22:39:42 +02:00
dependabot[bot]
f23d40ce5e cargo: bump clap_complete in the cargo-dependencies group
Bumps the cargo-dependencies group with 1 update: [clap_complete](https://github.com/clap-rs/clap).


Updates `clap_complete` from 4.5.30 to 4.5.32
- [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-v4.5.30...clap_complete-v4.5.32)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-03 18:07:25 +02:00
Samuel Tardieu
2f9561a4b8 CI: add a last name to the list of spelling exceptions 2024-10-03 00:21:56 +02:00