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

2665 commits

Author SHA1 Message Date
dependabot[bot]
67c7c27043 cargo: bump pest_derive from 2.5.4 to 2.5.5
Bumps [pest_derive](https://github.com/pest-parser/pest) from 2.5.4 to 2.5.5.
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.5.4...v2.5.5)

---
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-02-09 16:32:54 +01:00
dependabot[bot]
123d677aed github: bump github/codeql-action from 2.2.2 to 2.2.3
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.2.2 to 2.2.3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](39d8d7e78f...8775e86802)

---
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-02-09 16:32:36 +01:00
Yuya Nishihara
038497638f revset: parse keyword arguments, accept remote_branches(remote=needle)
The syntax is identical to Mercurial's revset, which is derived from Python.
2023-02-09 12:11:58 +09:00
Yuya Nishihara
b2825c22d7 revset: move whitespace rule out of expression
There's a subtle difference between
 - 'expression = { whitespace* ... whitespace* }', and
 - '_{ whitespace* ~ expression ~ whitespace* }'.

The former includes surrounding whitespace in an "expression", the latter
doesn't. This affects the span of error indication.
2023-02-09 12:11:58 +09:00
Yuya Nishihara
78227dc7bc revset: consolidate argument parsing functions
The added expect_arguments() is basically a copy from the template_parser.
I'll reimplement it to support keyword arguments, so I don't care much about
the current implementation.

I leave expect_no/one_argument() as wrappers because parsing 0/1 arguments
is pretty common.

Error messages are slightly changed. I personally prefer not to add extra
code for singular/plural handling, but if we do, I'll add 'if N == 1' case.
2023-02-09 12:11:58 +09:00
dependabot[bot]
9791152cb9 cargo: bump pest from 2.5.4 to 2.5.5
Bumps [pest](https://github.com/pest-parser/pest) from 2.5.4 to 2.5.5.
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.5.4...v2.5.5)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-08 08:24:00 -08:00
Martin von Zweigbergk
d1dc22d957 backend: let backend decide length of change id
As mentioned in the previous commit, our internal backend at Google
uses a 32-byte long change id. This commit will make us able to use
that.
2023-02-07 22:31:34 -08:00
Martin von Zweigbergk
e6693d0f68 backend: let backend choose root change id
Our internal backend at Google uses a 32-byte change id, so I'd like
to make the backend able to decide the length. To start with, let's
make the backend able to decide what the root change id should
be. That's consistent with how we already let the backend decide what
the root commit id should be.
2023-02-07 22:31:34 -08:00
Martin von Zweigbergk
98259346df backend: make hash_length() specifically about commit IDs
The function is currently only about the length of commit IDs, so
let's clarify that. I'm going to add another function for the length
of change IDs next. I don't know if we're going to care about lengths
of other hashes in the future. We might even be able to remove the
current restriction that all commit IDs and all change IDs have the
same length.
2023-02-07 22:31:34 -08:00
Martin von Zweigbergk
29a48ebde7 cargo: upgrade openssl-src to make cargo deny happy 2023-02-07 22:18:34 -08:00
dependabot[bot]
e7c9493506 github: bump github/codeql-action from 2.2.1 to 2.2.2
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.2.1 to 2.2.2.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](3ebbd71c74...39d8d7e78f)

---
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-02-07 08:24:19 -08:00
Yuya Nishihara
fa045d632c revset: allow trailing comma
It's unlikely we would write multi-line function call in revset, but let's
allow trailing comma for consistency.
2023-02-07 23:19:36 +09:00
Yuya Nishihara
686c1fb522 templater: allow trailing comma
While rewriting the default log template, I find it's annoying that I have
to remove "," from the last line.
2023-02-07 23:19:36 +09:00
Yuya Nishihara
ba1c4f5fe5 cli: replace all $variable matches found in edit/merge-args 2023-02-07 18:32:57 +09:00
Yuya Nishihara
a1bfe33a08 cli: expand $left/$right parameters in merge-tools.<name>.edit-args
And set edit_args = ["$left", "$right"] by default.
2023-02-07 18:32:57 +09:00
Yuya Nishihara
449e84d7ea cli: rename interpolate_mergetool_filename_patterns(), inline caller
I'll add string interpolation support to edit-args.
2023-02-07 18:32:57 +09:00
Yuya Nishihara
baa67fe1db cli: make interpolate_mergetool_filename_patterns() simply work with strings
The assumption here is temp_dir wouldn't contain invalid utf-8 bytes. If it
can contain invalid bytes, maybe we can remove temp_dir from arguments, and
chdir(temp_dir) instead.

This unblocks the use of Regex. We could use regex::bytes, but it's way
more complex as we would have to go back and forth between str/OsStr and
bytes.
2023-02-07 18:32:57 +09:00
Yuya Nishihara
d5f05b7897 cli: implement Default for MergeTool, do not override it with empty args
The default edit_args will be changed to ["$left", "$right"] to support
variable substitution without breaking the existing configuration too much.

The default merge_args could also be set if we could come up with something
meaningful.
2023-02-07 18:32:57 +09:00
Yuya Nishihara
2d17385d2e config: add merge-tools.<name>.edit-args to schema 2023-02-07 18:32:57 +09:00
Samuel Tardieu
605a39b84f jj new --insert-after 2023-02-07 09:16:48 +01:00
Samuel Tardieu
4119aa44a9 jj new --insert-before 2023-02-07 09:16:48 +01:00
Yuya Nishihara
cd164be762 templater: inline extract_entire_prefix_and_trimmed_tail() and simplify 2023-02-07 11:42:39 +09:00
Yuya Nishihara
ebf9887d65 templater: migrate shortest_prefix_and_brackets() over shortest() 2023-02-07 11:42:39 +09:00
Yuya Nishihara
3ccac9cda5 templater: rename shortest_styled_prefix() to shortest()
Now it is the true "shortest prefix" function with the default parameter,
so let's simply call it "shortest()".
2023-02-07 11:42:39 +09:00
Martin von Zweigbergk
fcda05c69b tests: reduce subprocessing in unique-prefix tests
The unique-prefixe tests are typically the slowest tests. Here's the
end of my `cargo nextest --workspace` output (from an arbitrary run,
not best-of-5 or anything):

PASS [   5.129s] jujutsu::test_log_command test_log_prefix_highlight_brackets
PASS [   5.220s] jujutsu::test_log_command test_log_prefix_highlight_styled
PASS [   8.523s] jujutsu::test_log_command test_log_prefix_highlight_counts_hidden_commits

These tests create 50-100 commits in a loop. I think much of it comes
from the subprocessing and/or the repeated loading of the repository
in the subprocesses. Rewriting them to use `jj duplicate` for creating
many commits at once speeds them up. Here are the timings after:

PASS [   2.323s] jujutsu::test_log_command test_log_prefix_highlight_styled
PASS [   2.330s] jujutsu::test_log_command test_log_prefix_highlight_brackets
PASS [   3.773s] jujutsu::test_log_command test_log_prefix_highlight_counts_hidden_commits
2023-02-06 12:32:23 -08:00
dependabot[bot]
52ff0ae9e6 github: bump cachix/install-nix-action from 18 to 19
Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 18 to 19.
- [Release notes](https://github.com/cachix/install-nix-action/releases)
- [Commits](daddc62a2e...5c11eae19d)

---
updated-dependencies:
- dependency-name: cachix/install-nix-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-06 15:26:46 +00:00
dependabot[bot]
9826f5ce9c cargo: bump serde_json from 1.0.91 to 1.0.92
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.91 to 1.0.92.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.91...v1.0.92)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-06 15:26:01 +00:00
Samuel Tardieu
6377b4f502 style: move unix-specific imports into unix section 2023-02-06 13:16:30 +01:00
Samuel Tardieu
f986415ef7 cargo: remove unused 'test-case' dev dependency 2023-02-06 13:14:43 +01:00
Martin von Zweigbergk
74bff5c916 doc: include diff format in config schema 2023-02-05 23:36:30 -08:00
Martin von Zweigbergk
9cdc202b39 cli: document diff format 2023-02-05 23:36:30 -08:00
Martin von Zweigbergk
8d3d89facc cli: rename diff.format to ui.diff.format
I felt that the config is too narrow to have it's own top-level [diff]
section, and I couldn't think of another good place to have it. I'm
happy to hear other suggestions.
2023-02-05 23:36:30 -08:00
Martin von Zweigbergk
f4374086b3 git_backend: return error when told to write commit without parents
There should be no other commits than the root commit without parents.
2023-02-05 22:52:23 -08:00
Martin von Zweigbergk
8c63fbc4ed git_backend: don't panic if told to write merge with root commit
I think the CLI currently checks that the backend is not told to write
a merge commit with the root as one parent, but we should not panic if
those checks fail.
2023-02-05 22:52:23 -08:00
Martin von Zweigbergk
2b2a9a36d7 git_backend: test conversion of parents, including root
We didn't seem to have any tests showing how we convert the set of
parents, and especially how we handle the root commit, so let's add
some.
2023-02-05 22:52:23 -08:00
Ilya Grigoriev
de163216c0 Templater: make shortest id functions default to 0 length
This makes them print the shortest unique prefix only.
2023-02-05 22:15:27 -08:00
Ilya Grigoriev
f076fae9b5 Document the fact that jj rebase accepts multiple -d
It was already mentioned towards the end of the introductory text, but that's
easy to miss.

This also clarifies the doc for `--allow-large-revsets`.
2023-02-05 22:07:28 -08:00
Yuya Nishihara
7bb7d2bd35 cli: rename FullCommandArgs to CommandNameAndArgs
Per discussion in #1198.
2023-02-06 15:03:08 +09:00
Yuya Nishihara
eb95b31b78 cli: split command name and args by FullCommandArgs
If FullCommandArgs is renamed to CommandNameAndArgs, the meaning of .args()
will get fuzzy. This also clarifies that the name part exists even if the
source command string is empty.
2023-02-06 15:03:08 +09:00
Ilya Grigoriev
9cc536e9e0 Mention --allow-large-revsets in hint when one revset resolves to multiple revisions 2023-02-05 21:22:18 -08:00
Ilya Grigoriev
db148af019 Move resolve_destination_revs into mod.rs
It's not very general.
2023-02-05 21:22:18 -08:00
Ilya Grigoriev
4183c69238 Refactor & rename resolve_base_revs to extract the more general function
This extracts the more general `resolve_mutliple_nonempty_revsets_flag_guarded`
out of `resolve_base_revs`. This function should be useful for `rebase -s`,
etc.

`resolve_base_revs` is renamed to `resolve_destination_revs`; that's simply a
better name for it. It is also quite specific to the `new` and `rebase -d`
commands.  It will be moved out of general utilities in the next commit
2023-02-05 21:22:18 -08:00
Ilya Grigoriev
1c6c6dbccc jj rebase -d and jj new: Allow several commits per argument with --allow-large-revsets
Eventually, we should be able to rely on `jj op restore` and the `--allow-large-revsets`.
argument should likely be removed. This is a temporary measure until we figure
out https://github.com/martinvonz/jj/issues/922 and the like.

Fixes https://github.com/martinvonz/jj/issues/571
2023-02-05 21:22:18 -08:00
Ilya Grigoriev
d153ced8ba cli_util: Make resolve_base_revs use IndexSet
This will make deduplication easier in the next commit.
The error message becomes slightly less informative, unfortunately.
2023-02-05 21:22:18 -08:00
Ilya Grigoriev
4268c80c84 Refactor and rename rewrite_multiple_rewriteable_revsets to be more general
We'll soon need that functionality without the checking for rewriteable
part.
2023-02-05 21:22:18 -08:00
Ilya Grigoriev
159c474e2c Move resolve_multiple_rewriteable_revsets to cli_utils.rs 2023-02-05 21:22:18 -08:00
Ilya Grigoriev
8c4fa90e2e Add test for error on jj rebase -d large_revset + test of repeats 2023-02-05 21:22:18 -08:00
Ilya Grigoriev
8c1a5539ad cli: Include revset in hint for resolve_single_rev
The revset is already printed in the error message, but it's easy to miss since
the error message is in different color.
2023-02-05 21:22:18 -08:00
Ilya Grigoriev
5fb17925eb jj log: option to specify preferred id length
The new option is `ui.log-id-preferred-length`. Setting it to 6
is quite convenient for the `jj` repo, for example.

Screenshot: https://user-images.githubusercontent.com/4123047/216535699-ad1e2ac8-73dd-44be-b28a-ebdebc00c63c.png
2023-02-05 21:18:42 -08:00
Ilya Grigoriev
b87facff7a Templater: Give short id function a total_len argument
This will be tested in the next commit.
2023-02-05 21:18:42 -08:00