Commit graph

6079 commits

Author SHA1 Message Date
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
Martin von Zweigbergk
2e44741e02 repo: move new commit ids into RewriteType enum
`RewriteType::Rewritten` must have exactly one replacement. I think
it's better to encode that in the type by attaching the value to the
enum variant. I also renamed the type to just `Rewrite` since it now
has attached data and `Type` sounds like a traditional data-free enum
to me.
2024-05-06 12:58:40 -07:00
Martin von Zweigbergk
c6bb94de42 repo: make RewriteType private
Looks like I forgot this in some recent refactoring.

I don't really see any harm in making the type public later. I might
want to make `rebase_descendants()` not clear `parent_mapping` and
instead provide a way of accessing it afterwards (removing the need
for the `_return_map()` flavors).  We'll see if that ends up
happening. For now it can be private anyway.
2024-05-06 12:58:40 -07:00
Austin Seipp
029a6002ad chore: nix flake update 2024-05-06 14:43:41 -05:00
dploch
20af8c79ef revset: support custom filter extensions 2024-05-06 10:42:01 -04:00
dploch
387ae9bce1 revset: support defining custom revset functions 2024-05-06 10:42:01 -04:00
dploch
cfa595199a revset: make a bunch of parsing types public 2024-05-06 10:42:01 -04:00
dploch
4e0abf0631 revset: make RevsetParseContext opaque 2024-05-06 10:42:01 -04:00
Ilya Grigoriev
3cf521fb41 fixup to 70b517c: remove errant conflict marker 2024-05-05 19:24:37 -07:00
Ilya Grigoriev
70b517ca64 conflicts.rs: label conflict number and sides next to conflict markers
For example, 

```
<<<<<<< Conflict 1 of 3
+++++++ Contents of side #1
left 3.1
left 3.2
left 3.3
%%%%%%% Changes from base to side #2
-line 3
+right 3.1
>>>>>>>
```

or

```
<<<<<<< Conflict 1 of 1
%%%%%%% Changes from base to side #1
-line 3
+right 3.1
+++++++ Contents of side #2
left 3.1
left 3.2
left 3.3
>>>>>>>
```

Currently, there is no way to disable these, this is TODO for a future
PR. Other TODOs for future PRs: make these labels configurable. After
that, we could support a `diff3/git`-like conflict format as well, in
principle.

Counting conflicts helps with knowing whether you fixed all the
conflicts while you are in the editor.

While labeling "side #1", etc, does not tell you the commit id or
description as requested in #1176, I still think it's an improvement.
Most importantly, I hope this will make `jj`'s conflict format less
scary-looking for new users.

I've used this for a bit, and I like it. Without the labels, I would see
that the two conflicts have a different order of conflict markers, but I
wouldn't be able to remember what that means. For longer diffs, it can
be tricky for me to quickly tell that it's a diff as opposed to one of
the sides. This also creates some hope of being able to navigate a
conflict with more than 2 sides.

Another not-so-secret goal for this is explained in
https://github.com/martinvonz/jj/pull/3109#issuecomment-2014140627. The
idea is a little weird, but I *think* it could be helpful, and I'd like
to experiment with it.
2024-05-05 18:42:14 -07:00
Ilya Grigoriev
2f48f76e85 test_resolve_command: use diff --git for readability 2024-05-05 18:42:14 -07:00
Ilya Grigoriev
f43a810fe0 conflicts.rs: Teach jj to parse conflict markers that are followed by a label
The format is 7 characters of the separator followed by a space and arbitrary
text, followed by a newline. Separator followed by a newline is also allowed.
E.g.:

<<<<<<< Random text
%%%%%%% Random text
 line 2
-line 3
+left
 line 4
+++++++ Random text
right
%%%%%%% Random text
 line 2
+forward
 line 3
 line 4
>>>>>>> Random text

This commit only allows reading such conflicts.

I considered allowing longer separators (`<<<<<<<<<<<<<< Random text`), but we
wouldn't currently write them, so let's be strict for now.

7 characters if they are followed by a space and arbitrary text
2024-05-05 18:42:14 -07:00
Ilya Grigoriev
04158c3744 External merge tools: better error message for unsupported usage
I've heard of one instance of a person being confused by the error.

Previously, the error was:

```
Error: Failed to load tool configuration
Caused by: To use `diffedit3` as a merge tool, the config `merge-tools.diffedit3.merge-args` must be defined (see docs for details)

```

Now, it is:

```
Error: The tool `diffedit3` cannot be used as a merge tool with `jj resolve`.
Hint: To use `diffedit3` as a merge tool, the config `merge-tools.diffedit3.merge-args` must be defined (see docs for details)
```

TODO for future PR: allow setting `merge-tools.TOOL.edit-args = false` so that
attempting to use TOOL as a diff editor fails. This would be helpful, for
example, for the `vscode` tool.
2024-05-05 18:33:53 -07:00
Ilya Grigoriev
638649b435 tutorial: edits to the diff editor explanation
Follows up on #3599. I also moved the discussion of other diff editors to a
footnote, as it didn't seem to fit well into the flow of the text.
2024-05-05 18:17:38 -07:00
Martin von Zweigbergk
3dab92d2e9 cli: move revsets.log default to config file 2024-05-05 09:08:14 -07:00
Martin von Zweigbergk
f958957f9e cli: drop support for old ui.default-revset config
We replaced it by `revsets.log` in 0.8.0, which is long enough that
users should have been able to switch.
2024-05-05 09:08:14 -07:00
Eidolon
3d898d0a06 Add default value of revsets.log to config docs
I wanted to have a reference point for the built-in revsets,
but `jj config get revsets.log` doesn't turn anything up since
it has special handling for the legacy config key
`ui.default-revset`. So I had to dig into the source code of jj
to get it.

I think it might help others to be able to reason about revsets
to have the log default shown in the settings documentation.
2024-05-05 07:17:32 -07:00
Yuya Nishihara
f1fd1d8071 cli: show hint for inner fileset/revset/template errors
Note that find_source_parse_error_hint() has recursion, but it should terminate
because err.source() shouldn't have a cycle.
2024-05-05 11:16:17 +09:00
Yuya Nishihara
34fce3ca9d cli: extract functions that map fileset/revset/template errors to hints 2024-05-05 11:16:17 +09:00
Ilya Grigoriev
5322c1d2bf cli --ignore-immutable help: remove double negative 2024-05-03 15:50:17 -07:00
Charles Crete
4b215a3405 docs: update obslog description 2024-05-03 12:06:32 -04:00
Charles Crete
c1de6eaa81 docs: mention origin of obslog name 2024-05-03 12:06:32 -04:00
Yuya Nishihara
0d630ac1bc cli: show commit summary in "tag list"
This is basically a template version of print_branch_target().
2024-05-03 15:16:52 +09:00
Yuya Nishihara
4db068e7f7 templater: expose RefTarget methods through RefName type
I considered adding RefTarget template type, but some of the methods naturally
fit to RefName. For example, a conflicted branch name is decorated as "??", so
it makes sense to add branch.conflict() instead of branch.target().conflict().

I'm not pretty sure how many RefName methods we'll need to add to port the
current branch listing, but there will be .tracked(), .tracking_local_present(),
.ahead_by(), and .behind_by().
2024-05-03 15:16:52 +09:00
Yuya Nishihara
520b4db919 cli: colorize tag name in "tag list" output
"working_copy tag" wouldn't be needed, but is added for consistency.
2024-05-03 15:16:52 +09:00
Yuya Nishihara
1ce3e9fe44 cli: migrate "tag list" to template
I'm going to add more detailed output there. This is a step towards "branch
list" template. "tag list -T" wouldn't be that useful, but it shares primitives
with "branch list -T".
2024-05-03 15:16:52 +09:00
Yuya Nishihara
d1458b55d2 tests: simplify local repo setup in test_tag_list()
I'll update the test to include conflicted tag, which can't be easily set up
by fetching from remote.
2024-05-03 15:16:52 +09:00
Yuya Nishihara
8abcbd659a templater: add RefName::local_only() constructor
It will be called from cmd_tag_list().
2024-05-03 15:16:52 +09:00
Yuya Nishihara
35e550e863 templater: store associated RefTarget in RefName struct
I'm going to add ref_name.target*() template methods so the commit templater
can be reused for branches/tags templates. RefTarget could be looked up by
(name, kind) pair, but it's simpler to store it in RefName.
2024-05-03 15:16:52 +09:00
Charles Crete
d9d60118a3 docs: update tutorial to include :builtin diff editor instructions 2024-05-02 23:04:40 -04:00
dependabot[bot]
7083530727 cargo: bump serde in the cargo-dependencies group
Bumps the cargo-dependencies group with 1 update: [serde](https://github.com/serde-rs/serde).


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

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-02 15:31:35 -07:00
Martin von Zweigbergk
19563fee74 release: release version 0.17.0
Thanks to everyone who's contributed!

Unlike previous releases, I went through the changelog entries and
reorganized them a bit.

We didn't have anything under "Deprecations" this time, but I moved
the heading after "Breaking changes" for next release. I think
breaking changes are more important because deprecations are just
about giving a heads up before it actually breaks.
2024-05-01 10:10:01 -07:00
dependabot[bot]
28e3751250 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.9 to 2.7.10
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.7.9...v2.7.10)

Updates `pest_derive` from 2.7.9 to 2.7.10
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.7.9...v2.7.10)

---
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-05-01 19:07:23 +02:00
Alexis (Poliorcetics) Bourget
52e494dcf2 cli: status: when current change has conflicts, display instructions to resolve them 2024-05-01 15:59:12 +02:00
Martin von Zweigbergk
0d1ff8a150 merged_tree: propagate errors from TreeEntriesIterator
We shouldn't panic if we fail to read a tree from the backend.
2024-05-01 06:10:08 -07:00
Martin von Zweigbergk
7093d5d359 squash: don't use unchanged source commit as predecessor 2024-04-30 20:03:57 -07:00