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

6114 commits

Author SHA1 Message Date
Martin von Zweigbergk
0a758e7024 cleanup: propagate errors from Commit::parents()
The function now returns an iterator over `Result`s, matching
`Operation::parents()`.

I updated callers to also propagate the error where it was trivial.
2024-05-13 07:39:14 -07:00
Martin von Zweigbergk
677081ef71 rebase: avoid an unnecessary lookup of parent commits 2024-05-13 07:39:14 -07:00
Martin von Zweigbergk
256988de65 repo: add a workaround for merging repo views with Google's index
We do a 3-way merge of repo views in a few different
scenarios. Perhaps the most obvious one is when merging concurrent
operations. Another case is when undoing an operation.

One step of the 3-way repo view merge is to find which added commits
are rewrites of which removed commits (by comparing change IDs). With
the high commit rate in the Google repo (combined with storing the
commits on a server), this step can get extremely slow.

This patch adds a hack to disable the slow step when using a
non-standard `Index` implementation. The Google index is the only
non-standard implementation I'm aware of, so I don't think this will
affect anyone else. The patch is also small enough that I don't think
it will cause much maintenance overhead for the project.
2024-05-12 08:59:44 -07:00
Yuya Nishihara
728e9e0772 cli: reuse ConfigLevelArgs for "config list --user/--repo"
This is a bit tricky, but we can reconfigure group attributes by using
mut_group().

https://docs.rs/clap/latest/clap/struct.Command.html#method.mut_group
2024-05-12 23:15:58 +09:00
Yuya Nishihara
717b42245c cli: rename ConfigArgs to ConfigLevelArgs 2024-05-12 23:15:58 +09:00
Yuya Nishihara
95593598d5 cli: use command(flatten) instead of deprecated clap(..) 2024-05-12 23:15:58 +09:00
Yuya Nishihara
db75e19751 cli: insert tracing at editor/pager invocation
This should help debug Windows mess.
2024-05-12 23:06:14 +09:00
Yuya Nishihara
e3b3b5586f ui: add per-type FormatterFactory constructors, inline selection
This should be better than passing (bool, bool, bool) arguments.
2024-05-12 09:21:18 +09:00
Yuya Nishihara
46246a7734 ui: inline debug_color() and use_color() 2024-05-12 09:21:18 +09:00
Yuya Nishihara
46226a4c44 ui: forward .color() to FormatterFactory
This helps eliminate use_color() function.
2024-05-12 09:21:18 +09:00
Yuya Nishihara
0423e3e1ee ui: add helper function that sets up FormatterFactory
I'm going to split FormatterFactory::prepare() which takes 3 bool arguments,
and prepare() will be inlined there.
2024-05-12 09:21:18 +09:00
tinger
d0a29a831d cli: add ui.color = "debug"
When using `ui.color = "debug"`, changes in the output style
additionally include delimiters << and >>, as well as all active labels
at this point separated by ::. The output is otherwise unformatted and
the delimiters and labels inherit the style of the content they apply
to.
2024-05-11 10:16:09 +02:00
Yuya Nishihara
de4ea5bc5a revset: move basic argument helpers to separate module
parse_function_argument_to_file/string_pattern() functions aren't moved.
They are more like functions that transform parsed tree to intermediate
representation.
2024-05-11 16:50:14 +09:00
Yuya Nishihara
f82c946ebe revset: move parsing functions to separate module
These functions will be reimplemented, and they will return a parsed tree
instead of RevsetExpression tree.
2024-05-11 16:50:14 +09:00
Yuya Nishihara
e6aa8906f7 revset: move alias types to separate module
Alias expansion is purely substitution of parsed tree, which should belong to
the first parsing stage.
2024-05-11 16:50:14 +09:00
Yuya Nishihara
68db9c142c revset: extract parser types to separate module
I'm planning to rewrite the parser in a similar way to fileset/template parsing,
and the revset_parser module will host functions and types for the first stage.
I haven't started the rewrite, but it seems good to split the revset module
even if we reject the idea.
2024-05-11 16:50:14 +09:00
Yuya Nishihara
cfc18b0432 revset: make RevsetParser type private
It's unlikely that client codes and integration tests have to use the pest
API directly.
2024-05-11 16:50:14 +09:00
Yuya Nishihara
d6613304c9 cli: print deleted branch hints at end of "branch list" output
These hints shouldn't be interleaved in the template output. The new output
might look a little bit worse, but I don't think it's unacceptably bad.
2024-05-11 09:43:53 +09:00
Yuya Nishihara
2f3ac4e4d7 tests: snapshot both stdout and stderr in "branch list" tests 2024-05-11 09:43:53 +09:00
Yuya Nishihara
60825c4591 tests: use get_branch_output() at a few more places
Not all "branch list --all-remotes" callers are replaced because I'm going to
make get_branch_output() suppress hints by default, and there should be tests
for the hints.
2024-05-11 09:43:53 +09:00
Alexander Potashev
07559f24ec Refuse to split an empty commit with jj split.
Rationale: The user may be confused by the empty diff in the diff editor
tool if they accidentally run `jj split` on a wrong (empty) commit.
2024-05-10 19:37:28 +02:00
dependabot[bot]
f3519e4c2e github: bump the github-dependencies group with 3 updates
Bumps the github-dependencies group with 3 updates: [DeterminateSystems/nix-installer-action](https://github.com/determinatesystems/nix-installer-action), [DeterminateSystems/magic-nix-cache-action](https://github.com/determinatesystems/magic-nix-cache-action) and [ossf/scorecard-action](https://github.com/ossf/scorecard-action).


Updates `DeterminateSystems/nix-installer-action` from 10 to 11
- [Release notes](https://github.com/determinatesystems/nix-installer-action/releases)
- [Commits](de22e16c47...8cdf194da9)

Updates `DeterminateSystems/magic-nix-cache-action` from 4 to 6
- [Release notes](https://github.com/determinatesystems/magic-nix-cache-action/releases)
- [Commits](fc6aaceb40...87e8236f46)

Updates `ossf/scorecard-action` from 2.3.1 to 2.3.3
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](0864cf1902...dc50aa9510)

---
updated-dependencies:
- dependency-name: DeterminateSystems/nix-installer-action
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-dependencies
- dependency-name: DeterminateSystems/magic-nix-cache-action
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-dependencies
- dependency-name: ossf/scorecard-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-10 10:59:40 -05:00
dploch
3a0929b876 index_store: add more scope to write_index()
This is more consistent with the other method and it makes some extension operations easier, by giving access to the OpStore and other relevant context for custom index extensions.
2024-05-10 09:22:09 -04:00
Yuya Nishihara
3307696ba8 cli: parse out redundant "all:" revset modifier in arguments and templates
This also means "all:" is allowed in default revsets (such as "revsets.log"),
but that seems okay. In revset aliases, "all:" isn't allowed because aliases
may be expanded to sub-expression position.

Closes #3654
2024-05-10 15:28:18 +09:00
Yuya Nishihara
ba73accac6 cli: use command helper to check if path argument is parsable as revset
There should be no reason to use low-level API.
2024-05-10 15:28:18 +09:00
Yuya Nishihara
12b873e1ef cli: port "branch list" to template
Perhaps, this can be used to generate parsable branches list.

The hint for deleted branches isn't migrated to the template. I'm thinking of
moving it out of the loop and printed once at the end. If we want to generate
a hint in template, we'll probably need local_ref.tracking_remote_refs(), etc.
that return a list of RefNames.
2024-05-10 08:36:38 +09:00
Yuya Nishihara
af9f9ba1e4 cli: filter out synced remote branches early
Perhaps, this make it a bit clearer when "deleted" local branches should be
displayed. In practice, this change is noop since remote_ref.target should
never be absent.
2024-05-10 08:36:38 +09:00
Yuya Nishihara
8e4f75552d templater: add tracking methods to remote RefName
More tests will be added later as "branch list" templates.

In "log" template, we might want to see the number of "local" commits ahead
of any tracked remotes. It can be implemented later in a similar way (or as a
nested remote_refs list.)
2024-05-10 08:36:38 +09:00
Yuya Nishihara
ccabb11890 templater: wrap RefName with Rc to copy OnceCell around
Because template is declarative language, and is evaluated as a tree, there
will be multiple copies of the same RefName object. This patch allows us to
cache ahead/behind counts which will be lazily calculated.
2024-05-10 08:36:38 +09:00
Yuya Nishihara
cb0964b1d0 templater: extract remote-only RefName constructor as well
I'm going to make these constructors return Rc<RefName>, and it seems better
to consolidate Rc wrapping functions.
2024-05-10 08:36:38 +09:00
Yuya Nishihara
e27421d2bd templater: extract trackable RefName constructors
They'll be called from cmd_branch_list().
2024-05-10 08:36:38 +09:00
Yuya Nishihara
9a5b001d58 templater: add SizeHint type to represent revset.count_estimate() value
We'll probably add binary comparison operators at some point, but this patch
also adds size_hint.zero() method. Otherwise, we'll have to write
"if(x.upper() && x.upper() == 0, ..)" to deal with None.

The resulting "branch list" template will look like:
```
separate(", ",
  if(!ref.tracking_ahead_count().zero(),
    if(ref.tracking_ahead_count().exact(),
      "ahead by " ++ ref.tracking_ahead_count().exact() ++ " commits",
      "ahead by at least " ++ ref.tracking_ahead_count().lower() ++ " commits")),
  if(!ref.tracking_behind_count().zero(),
    if(ref.tracking_behind_count().exact(),
      "behind by " ++ ref.tracking_behind_count().exact() ++ " commits",
      "behind by at least " ++ ref.tracking_behind_count().lower() ++ " commits")),
)
```
2024-05-09 08:51:34 +09:00
Yuya Nishihara
62decb76bc templater: add optional integer type
In order to port "branch list" to template, we need to somehow represent
revset.count_estimate() result as a template property. I'm going to add
SizeHint template type for that, and its .upper() and .exact() methods will
have to return optional integers.

Fortunately, the Integer type has no implicit conversion to bool, so
"if(optional_integer, ..)" is not ambiguous.
2024-05-09 08:51:34 +09:00
Yuya Nishihara
c2c160f635 templater: add helper method that unwraps Option<T> property
I'll add a few more optional property types, and I don't want to duplicate the
error message. Type names are capitalized for consistency.
2024-05-09 08:51:34 +09:00
Yuya Nishihara
04063a0efd templater: remove IntoTemplate abstraction, use extension method instead
This is a remainder of the previous refactoring series. into_template() could be
implemented as a non-extension method, which allows us to get rid of .clone()
from Literal property extraction. However, there wasn't measurable difference.
Let's not try to overly optimize things. It's probably simpler to switch to
Rc<str> if .clone() really matters.
2024-05-09 08:51:34 +09:00
Ilya Grigoriev
2760b23f8d cli jj util completion --help: Make the terminal output a bit prettier
Cc: https://github.com/martinvonz/jj/pull/2949#issuecomment-2098710774
2024-05-08 11:40:54 -07:00
Ilya Grigoriev
9be159342c config.md: advertise diffedit3 as an alternative to meld-3 diff editor
This is instead of https://github.com/martinvonz/jj/pull/3292, which would make
`diffedit3` built into `jj`. I still have some hope of eventually making
`diffedit3` into the default diff editor that is available without any
configuration, which probably requires building it into `jj`, but this may not
happen, and it wouldn't hurt to test `diffedit3` first. Some examples of
concerns (see also the discussion in that PR):

- It is only a guess on my part that this would make a good default. The editor
might not be polished enough, and most users are not used to 3-pane diff
editing. I think most users would like it if they tried it, but this might be
plain wrong.

- There are concerns about adding a heavyweight dependency on `jj`. While I
tried to make it as lightweight as possible, it still unavoidably includes a web
server.

- There may be ways to bundle `diffedit3` with `jj` without combining them in a
single binary.
2024-05-08 11:38:41 -07:00
dependabot[bot]
7a03325f4e cargo: bump the cargo-dependencies group with 2 updates
Bumps the cargo-dependencies group with 2 updates: [serde](https://github.com/serde-rs/serde) and [serde_json](https://github.com/serde-rs/json).


Updates `serde` from 1.0.200 to 1.0.201
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.200...v1.0.201)

Updates `serde_json` from 1.0.116 to 1.0.117
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.116...v1.0.117)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-08 12:05:01 -05:00
Martin von Zweigbergk
dbba2edc57 commit: add a helper for returning parent tree of Commit
The pattern of getting the parent tree of a commit gets repeated a
bit. Let's add a helper on `Commit`.
2024-05-07 19:35:03 -07:00
Martin von Zweigbergk
428e209304 cleanup: consistently use BackendResult
We have the type alias so we should use it consistently.
2024-05-07 19:35:03 -07:00
dependabot[bot]
47c010fce4 cargo: bump the cargo-dependencies group with 5 updates
Bumps the cargo-dependencies group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [anyhow](https://github.com/dtolnay/anyhow) | `1.0.82` | `1.0.83` |
| [proc-macro2](https://github.com/dtolnay/proc-macro2) | `1.0.81` | `1.0.82` |
| [ref-cast](https://github.com/dtolnay/ref-cast) | `1.0.22` | `1.0.23` |
| [syn](https://github.com/dtolnay/syn) | `2.0.60` | `2.0.61` |
| [thiserror](https://github.com/dtolnay/thiserror) | `1.0.59` | `1.0.60` |


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

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

Updates `ref-cast` from 1.0.22 to 1.0.23
- [Release notes](https://github.com/dtolnay/ref-cast/releases)
- [Commits](https://github.com/dtolnay/ref-cast/compare/1.0.22...1.0.23)

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

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

---
updated-dependencies:
- dependency-name: anyhow
  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: ref-cast
  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-07 16:18:56 +00:00
dependabot[bot]
9b7d44a93b github: bump actions/checkout in the github-dependencies group
Bumps the github-dependencies group with 1 update: [actions/checkout](https://github.com/actions/checkout).


Updates `actions/checkout` from 4.1.4 to 4.1.5
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](0ad4b8fada...44c2b7a8a4)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-07 11:13:26 -05:00
Ilya Grigoriev
60ee462369 docs: downgrade mkdocs-material
I'm hoping this will fix version switching.

https://github.com/squidfunk/mkdocs-material/issues/7160
2024-05-07 09:03:21 -07:00
Martin von Zweigbergk
61e4e3627c
branching: merge v0.17.1 into main 2024-05-07 08:54:35 -07:00
Martin von Zweigbergk
e1d8705546 release: release version 0.17.1
This release includes a fix for a performance regression in `jj
status`.
2024-05-07 08:39:54 -07:00
Yuya Nishihara
0a5c98d9fe cli: status: exclude working-copy commit from conflicts revset by ancestry
This should be cheaper than using a generic difference expression.
2024-05-07 22:10:50 +09:00
Yuya Nishihara
c1d934a08a cli: status: evaluate conflicts revset as a user expression
Otherwise, it would panic if immutable_heads() contained unresolved symbols.
2024-05-07 22:10:50 +09:00
Yuya Nishihara
76b6d031d7 cleanup: rustfmt cli/src/commands/status.rs 2024-05-07 22:10:50 +09:00
Eric Roshan-Eisner
b67e198cde cli: status: only scan through mutable changes to find conflicts
Fixes #3628
2024-05-06 17:32:50 -07:00
dependabot[bot]
3345e409fc build(deps-dev): bump jinja2 from 3.1.3 to 3.1.4
Bumps [jinja2](https://github.com/pallets/jinja) from 3.1.3 to 3.1.4.
- [Release notes](https://github.com/pallets/jinja/releases)
- [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst)
- [Commits](https://github.com/pallets/jinja/compare/3.1.3...3.1.4)

---
updated-dependencies:
- dependency-name: jinja2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-06 16:29:50 -05:00