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

7055 commits

Author SHA1 Message Date
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
Essien Ita Essien
0f5c5530df cli: Warn if specified remote branch not found for jj git fetch
* First fetch from remote.
* Then check tx.{base_repo(),repo}.view().remote_bookmarks_matching(<branch>, <remote>).
  This has to happen after the fetch has been done so the tx.repo() is updated.
* Warn if a branch is not found in any of the remotes used in the fetch. Note that the remotes
  used in the fetch can be a subset of the remotes configured for the repo, so the language
  of the warning tries to point that out.

Fixes: #4293
2024-09-21 14:09:24 +01:00
Yuya Nishihara
c02fd3103c op_heads_store: don't test "no heads" error without acquiring lock
I recently got random test_commit_parallel*() failures, and this patch appears
to fix the problem.

SimpleOpHeadsStore::update_op_heads() adds new_id file and removes old_ids
files in that order. It ensures that there exists at least one id file, but it
doesn't mean readdir() can observe the added id file.

 1. process A: get_op_heads() -> opendir()
 2. process B: update_op_heads() -> add_op_head(new_id), remove_op_head(old_id)
 3. process A:                -> readdir() (can miss new_id)

update_op_heads() could do rename(old_ids[0], new_id), but I don't remember if
readdir() can always pick up a renamed entry.
2024-09-21 11:24:00 +09:00
dependabot[bot]
cd488009d4 cargo: bump unicode-width in the cargo-dependencies group
Bumps the cargo-dependencies group with 1 update: [unicode-width](https://github.com/unicode-rs/unicode-width).


Updates `unicode-width` from 0.1.13 to 0.1.14
- [Commits](https://github.com/unicode-rs/unicode-width/compare/v0.1.13...v0.1.14)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-20 12:18:17 -05:00
Yuya Nishihara
4533e81957 cli: pass &Ui to parse fileset/revset/template functions
Deprecation warnings will be printed there. auto_tracking_matcher(ui) could
be cached, but there aren't many callers right now, so it should be okay to
parse and emit warnings for each invocation. Other than that, the changes are
straightforward.
2024-09-20 23:01:12 +09:00
Yuya Nishihara
09cedd83a7 cli: add specialized function for pre-validated templates
I'll make parse_<language>_template() require &Ui, but these cached templates
should be re-constructible without access to a Ui.

Maybe we can split a parsed template object into RevsetExpression-like
evaluation tree and interpreter environment, but that'll be a big challenge.
2024-09-20 23:01:12 +09:00
Yuya Nishihara
3c04507097 cli: remove unneeded &mut from edit_multiple_descriptions() 2024-09-20 23:01:12 +09:00
Yuya Nishihara
dd9213a954 cli: leverage parse_operation_template() in cmd_op_show() 2024-09-20 23:01:12 +09:00
Yuya Nishihara
7e04af1729 cli: cache immutable heads revset expression
This will help simplify warning handling in future patches. I'm going to add
deprecation warnings to revset, so Ui will be required in order to parse a user
revset expression.

revset_util::parse_immutable_expression() is inlined as it's a thin wrapper
around parse_immutable_heads_expression().
2024-09-20 06:56:03 +09:00
Yuya Nishihara
1d86e325c6 cli: move check_repo_rewritable() to WorkspaceCommandEnvironment
This ensures that the repo argument is used instead of self.repo(). store() is
now obtained from the repo argument (which shouldn't matter, though.)
2024-09-20 06:56:03 +09:00
dependabot[bot]
a04d092819 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.7 to 3.26.8
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](8214744c54...294a9d9291)

---
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-19 13:12:42 -05:00
dependabot[bot]
b604be2320 cargo: bump the cargo-dependencies group with 2 updates
Bumps the cargo-dependencies group with 2 updates: [pest](https://github.com/pest-parser/pest) and [pest_derive](https://github.com/pest-parser/pest).


Updates `pest` from 2.7.12 to 2.7.13
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.7.12...v2.7.13)

Updates `pest_derive` from 2.7.12 to 2.7.13
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.7.12...v2.7.13)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-19 12:36:53 -05:00
Yuya Nishihara
0c9bc37f10 diff: buffer color-words context lines
I'm testing simple conflicts diffs locally, and we'll probably need to handle
consecutive context hunks when we add some form of unmaterialized conflicts
diffs. Let's buffer context hunks (up to 1 right now.) The new code looks
simpler.
2024-09-19 20:01:51 +09:00
Yuya Nishihara
9f5ce934d2 diff: extract function that prints color-words diff lines
This block is relatively big, and will become even bigger if we add support
for unmaterialized conflicts diffs.
2024-09-19 20:01:51 +09:00
Yuya Nishihara
79e76c5dad diff: extract line number handling from show_color_words_diff_line()
This seems more consistent with !can_inline case, and we can remove extra
vec![] allocation from context line processing.
2024-09-19 20:01:51 +09:00
dependabot[bot]
47323c883a 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.26 to 4.5.28
- [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.26...clap_complete-v4.5.28)

---
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-09-18 11:23:21 -05:00
Samuel Tardieu
726cbbd66c diffedit: separate extra help information in its own paragraph 2024-09-18 09:11:07 +02:00
Vamsi Avula
a2e67bdd9b templates: add .normal_hex() for {Commit,Change}Id
This doesn't do much for CommitId but outputs the "forward" hex for
ChangeId, which can be useful to use as Gerrit Change-Id.
2024-09-17 21:11:00 -05:00
Samuel Tardieu
05c6d62c68 bookmark: add "b" alias
`jj bookmark` is a frequently used command. Its subcommands already have
one letter aliases. Defining `jj b` as an alias for `jj bookmarks` make
bookmarks really easy to use.
2024-09-17 18:24:26 +02:00
Essien Ita Essien
e25ec536ed next/prev: Fetch descendants with more correctness.
See context in [this discussion](https://github.com/martinvonz/jj/pull/3935#discussion_r1649520967)

Fixes #3947
2024-09-17 16:39:29 +01:00
Samuel Tardieu
6d0a092410 cli: remove unused dependency on hex 2024-09-17 12:34:31 +02:00
Samuel Tardieu
c1a032fad6 squash doc: --keep-emptied let the description unchanged 2024-09-17 11:49:48 +02:00
mlcui
4308e1a21e Downgrade once_cell to 1.19.0
1.20.0 was yanked: https://github.com/matklad/once_cell/issues/264
2024-09-17 14:37:07 +10:00