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

7077 commits

Author SHA1 Message Date
Yuya Nishihara
0a8d8dad67 cli: make default log revset work without working-copy commit
Spotted while adding an error propagation path from IdPrefixContext.
2024-10-01 20:04:06 +09:00
Yuya Nishihara
1f5835c267 cli: simplify help about default "log -r"
Since we've moved the default log revset to config/*.toml at 3dab92d2, we don't
have to repeat the default value. It can be queried by "jj config list". I also
split the help paragraphs.
2024-10-01 20:04:06 +09:00
Yuya Nishihara
0ac6df7073 revset: make present(unknown@) recover from missing working copy error
Missing working-copy commit is similar situation to unknown ref, and should
be caught by present().
2024-10-01 20:04:06 +09:00
Yuya Nishihara
68176d965e diff: do not translate word-range indices by collect_unchanged_ranges()
Intersection of unchanged ranges becomes a simple merge-join loop, so I've
removed the existing tests. I also added a fast path for the common 2-way
diffs in which we don't have to build vec![(pos, vec![pos])].

One source of confusion introduced by this change is that WordPosition means
both global and local indices. This is covered by the added tests, but I might
add separate local/global types later.
2024-10-01 06:31:22 +09:00
Yuya Nishihara
483db9d7d2 diff: reuse result vec when recurse into unchanged_ranges()
It's silly that we build new Vec for each recursion stack and merge elements
back. I don't see a measurable performance difference in the diff bench, but
this change will help simplify the next patch. If a result vec were created for
each unchanged_ranges() invocation, it would probably make more sense to return
a list of "local" word positions. Then, callers would have to translate the
returned positions to the caller's local positions.
2024-10-01 06:31:22 +09:00
Yuya Nishihara
f6277bbdb8 diff: remove redundant check for empty ranges from unchanged_ranges() recursion
It's cheap to create an empty Vec, and I'm going to remove it anyway.
2024-10-01 06:31:22 +09:00
dependabot[bot]
fd2c377a4a 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.9 to 3.26.10
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](461ef6c76d...e2b3eafc8d)

---
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-09-30 18:49:51 +02:00
dependabot[bot]
0021744203 cargo: bump the cargo-dependencies group with 4 updates
Bumps the cargo-dependencies group with 4 updates: [once_cell](https://github.com/matklad/once_cell), [regex](https://github.com/rust-lang/regex), [syn](https://github.com/dtolnay/syn) and [tempfile](https://github.com/Stebalien/tempfile).


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

Updates `regex` from 1.10.6 to 1.11.0
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.10.6...1.11.0)

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

Updates `tempfile` from 3.12.0 to 3.13.0
- [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Stebalien/tempfile/compare/v3.12.0...v3.13.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-30 18:49:39 +02:00
Ilya Grigoriev
d34198d111 docs: update mkdocs-material with bugfix, poetry update
This will hopefully make the version switcher stay
on the same page as it includes
https://github.com/squidfunk/mkdocs-material/pull/7559.
Unfortunately, it might break again for reasons explained
there.
2024-09-29 13:56:08 -07:00
Tyler Goffinet
9f8d936189 cli: color author and commiter names yellow
When `format_short_signature(signature)` is set to `signature.name()` the author names are not yellow like other signature types (eg email and username). When the commit signatures have no colors, they blend in making it hard to distinguish between signatures and commit messages.

If just `name` were set to `yellow`, just like email and username, it affects the colorization of branch names making them also yellow despite them being designated as magenta. Setting `author` and `committer` to `yellow` is specific enough to allow branches to keep their colors while still coloring signature names. This is known to affect signatures in both 'log' and 'show'.
2024-09-28 23:34:26 -07:00
Yuya Nishihara
64e1ae277d diff: remove redundant hash map lookup of uncommon shared words 2024-09-28 07:49:28 +09:00
Yuya Nishihara
5c52b4ec13 diff: omit construction of count-to-words map for right-side histogram
This also allows us to borrow Vec<WordPositions> from &self.
2024-09-28 07:49:28 +09:00
Yuya Nishihara
493f610fd5 diff: build left-right index map without using (word, occurrence) hash keys
We can assign a unique integer to each (word, occurrence) pair instead. As a
bonus, HashMap can be replaced with Vec.

```
group                             new                     old
-----                             ---                     ---
bench_diff_git_git_read_tree_c    1.00     72.5±3.25µs    1.08     78.5±0.48µs
bench_diff_lines/modified/10k     1.00     45.1±1.18ms    1.10     49.8±1.85ms
bench_diff_lines/modified/1k      1.00      4.1±0.07ms    1.11      4.5±0.34ms
bench_diff_lines/reversed/10k     1.00     19.0±0.12ms    1.12     21.2±1.26ms
bench_diff_lines/reversed/1k      1.00   558.5±37.42µs    1.17   655.6±16.27µs
bench_diff_lines/unchanged/10k    1.00      5.3±0.78ms    1.33      7.0±0.89ms
bench_diff_lines/unchanged/1k     1.00   422.0±16.68µs    1.28   540.7±13.96µs
```
2024-09-28 07:49:28 +09:00
Samuel Tardieu
f38c59f734 split: do not prevent all changes from going into the first commit
Let the user select all changes interactively and put them into
the first commit, and create a second commit with the possibility
of preserving the current commit message. This was previously only
possible in non-interactive mode by specifying matching paths, e.g.
".".  In both cases, a warning will be issued indicating that the second
commit is empty.
2024-09-27 13:33:05 +02:00
Samuel Tardieu
98c16c4e19 split: do not reference file paths in warning
jj split warning was potentially wrong in both interactive and
non-interactive modes when everything is put into the child commit:

- Non-interactive mode: "The given paths does not match any file:
  PATHS". The message is misleading, as the PATHS given on the command-line
  may match files but not match files containing changes.
- Interactive mode: "The given paths does not match any file: " while
  if possible that no paths were given on the command line.
2024-09-27 13:33:05 +02:00
Samuel Tardieu
0058c4f451 changelog: make indentation consistent 2024-09-26 20:22:17 +02:00
Samuel Tardieu
07c7d89f85 changelog: warning on jj git fetch is a new feature, not a bugfix 2024-09-26 19:01:47 +02:00
dependabot[bot]
bd82ab3018 github: bump the github-dependencies group with 2 updates
Bumps the github-dependencies group with 2 updates: [actions/checkout](https://github.com/actions/checkout) and [github/codeql-action](https://github.com/github/codeql-action).


Updates `actions/checkout` from 4.1.7 to 4.2.0
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](692973e3d9...d632683dd7)

Updates `github/codeql-action` from 3.26.8 to 3.26.9
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](294a9d9291...461ef6c76d)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-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-09-26 17:31:16 +02:00
Samuel Tardieu
baf25ba482 unsquash: deprecate in favor of squash and diffedit
Everything that could be done with `jj unsquash` can be done with
`jj squash` or `jj diffedit --preserve-descendants`.
2024-09-26 16:34:48 +02:00
dependabot[bot]
68832f4935 cargo: bump async-trait in the cargo-dependencies group
Bumps the cargo-dependencies group with 1 update: [async-trait](https://github.com/dtolnay/async-trait).


Updates `async-trait` from 0.1.82 to 0.1.83
- [Release notes](https://github.com/dtolnay/async-trait/releases)
- [Commits](https://github.com/dtolnay/async-trait/compare/0.1.82...0.1.83)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-25 11:45:05 -05:00
Essien Ita Essien
e99cca8a93 changelog: conflict() and file() deprecations are yet unreleased.
Move this update under `Unreleased`. I started the change before the last
release and after rebasing, forgot to move it. Fixing it now thanks to @yuja
catching this on time.

Issue: #4122
2024-09-25 09:57:53 +01:00
Yuya Nishihara
9551794f19 cli: print operation summary on "op restore" as we do for "undo" 2024-09-25 16:30:22 +09:00
Yuya Nishihara
b30ce36c55 cli: print operation summary before committing transaction
It seemed a bit odd that working-copy update was printed before the "undo"
operation we made earlier.
2024-09-25 16:30:22 +09:00
Yuya Nishihara
6cc76ba543 revset: fix copy-paste error in conflict() deprecation message 2024-09-25 16:26:49 +09:00
dependabot[bot]
d1ced44f24 cargo: bump libc from 0.2.158 to 0.2.159 in the cargo-dependencies group
Bumps the cargo-dependencies group with 1 update: [libc](https://github.com/rust-lang/libc).


Updates `libc` from 0.2.158 to 0.2.159
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Changelog](https://github.com/rust-lang/libc/blob/0.2.159/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.158...0.2.159)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-25 07:40:39 +09:00
Yuya Nishihara
dd93e8f60b diff: introduce newtype that represents word-range index
There are usize text indices/ranges and word-range indices. Let's make them
somewhat distinct.
2024-09-25 07:39:41 +09:00
Yuya Nishihara
739a5d8617 diff: pack (text, ranges) pair in a struct
I'll add a few more helper methods there. It might also make sense to cache
precomputed hash values.

unchanged_ranges() is made private since there are no external callers, and
I'm going to add more private types.
2024-09-25 07:39:41 +09:00
Yuya Nishihara
1b469321e2 diff: sort word occurrences only by positions
Since uncommon_shared_words are unique, their occurrence positions should also
be unique.
2024-09-25 07:39:41 +09:00
Yuya Nishihara
5842267c73 diff: use iter::zip() instead of slice indexing 2024-09-25 07:39:41 +09:00
Essien Ita Essien
2196eb1249 Update CHANGELOG to mention deprecation of file() for files().
I missed this update in #4334.

Issue: #4122
2024-09-24 20:29:28 +01:00
Essien Ita Essien
895d53f395 Rename conflict and file revsets to conflicts and files.
See discussion thread in linked issue.

With this PR, all revset functions in [BUILTIN_FUNCTION_MAP](8d166c7642/lib/src/revset.rs (L570))
that return multiple values are either named in plural or the naming is hard to misunderstand (e.g. `reachable`)

Fixes: #4122
2024-09-24 20:02:49 +01:00
Samuel Tardieu
cf7847d784 restore: add --restore-descendants flag 2024-09-24 14:26:54 +02:00
Samuel Tardieu
e8deb08f78 abandon: add --restore-descendants flag 2024-09-24 10:52:06 +02:00
Samuel Tardieu
f76ee1872f diffedit: add --restore-descendants flag 2024-09-24 09:30:28 +02:00
Samuel Tardieu
90280ad2fd repo: introduce MutableRepo::reparent_descendants() 2024-09-24 09:30:28 +02:00
Samuel Tardieu
736163c8d3 repo: add MutableRepo::rebase_descendants documentation 2024-09-24 09:30:28 +02:00
Yuya Nishihara
05b90390ae cli: get author timestamp of description template in consistent way
There's a subtle difference. If the original commit was discardable, its author
timestamp is updated by CommitBuilder.
2024-09-24 07:17:33 +09:00
Yuya Nishihara
49e5585130 tests: snapshot some editor contents in test_describe_author() 2024-09-24 07:17:33 +09:00
Samuel Tardieu
69d1600d82 Inline variables in format string 2024-09-23 22:34:55 +02:00
dependabot[bot]
e347a40cbd 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 [thiserror](https://github.com/dtolnay/thiserror).


Updates `clap` from 4.5.17 to 4.5.18
- [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.17...clap_complete-v4.5.18)

Updates `clap_complete` from 4.5.28 to 4.5.29
- [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.28...clap_complete-v4.5.29)

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

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-23 17:42:10 +02:00
Yuya Nishihara
49e45cc245 revset, templater: add deprecation warnings 2024-09-23 07:07:07 +09:00
Yuya Nishihara
11286b3072 templater: pass diagnostics receiver around 2024-09-23 07:07:07 +09:00
Yuya Nishihara
8b1760ca5d revset: pass diagnostics receiver around
Stacking at AliasExpanded node looks wonky. If we migrate error handling to
Diagnostics API, it might make sense to remove AliasExpanded node and add
node.aliases: vec![(id, span), ..] field instead.

Some closure arguments are inlined in order to help type inference.
2024-09-23 07:07:07 +09:00
Yuya Nishihara
4b477fa59e fileset: pass diagnostics receiver around, add printing function
CLI tests will be added later.
2024-09-23 07:07:07 +09:00
Yuya Nishihara
df8967970e revset, templater: make context message of nested errors less specific
So that these error variants can be reused as warning contexts.
2024-09-23 07:07:07 +09:00
Yuya Nishihara
6b92305102 dsl_util: add basic diagnostics receiver
This object will be passed around AST processing functions. It's basically a
Vec<ParseError>.
2024-09-23 07:07:07 +09:00
Mateusz Mikuła
8dd3003bec refactor: mark Timestamp struct as Copy 2024-09-22 16:23:53 +02:00
Essien Ita Essien
76f40e5990 cli: reorder updating and reporting for consistency.
* See #4239 for details.
* For now, update working copy before reporting repo changes, so that
  potential errors in reporting changes don't leave the repo in a stale
  state.

Fixes: #4239
2024-09-22 15:02:21 +01:00
Mateusz Mikuła
2e9049b188 cli: add --author argument for commit and describe 2024-09-22 12:40:46 +02:00
Yuya Nishihara
b8f8827914 docs: add some scripting template examples
Closes #4357
2024-09-22 07:19:50 +09:00