8965 Commits

Author SHA1 Message Date
Martin von Zweigbergk
5ad7ea24d3 repo: propagate erros from update_heads() 2025-04-17 12:20:29 +00:00
Martin von Zweigbergk
4a8cbe43a2 repo: mark view dirty after setting local bookmark target
We were not calling `view.mark_dirty()` after adding heads, which
means that we would not enforce the usual view invariants, such that
ancestors of heads should not also be in the set of heads. This patch
fixes that and updates the test (which actually shows the broken
invariant in its current form).
2025-04-17 03:25:29 +00:00
Winter
af60f3d674 cli: deprecate ui.default-description
Closes https://github.com/jj-vcs/jj/issues/6298.
2025-04-17 02:03:48 +00:00
Austin Seipp
b1576c5c4e github: make dependabot updates weekly
A not-insignificant amount of our PR traffic is from Dependabot, even
with the grouped update feature (something like 20% of all PRs in total
are from Dependabot, last I checked.)

We don't really need daily updates, and with the the current crate
dependency graph we practically get updates *every* day. Bump it to
weekly instead to stem the tide a little.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2025-04-16 21:16:24 +00:00
Winter
001b6df26c docs: add edit link to pages
This leads users directly to GitHub's edit page for the page they're viewing.
2025-04-16 18:30:34 +00:00
Winter
96694a6891 docs: add GitHub repo link to header 2025-04-16 18:30:34 +00:00
dependabot[bot]
bd882fda0e cargo: bump proc-macro2 in the cargo-dependencies group
Bumps the cargo-dependencies group with 1 update: [proc-macro2](https://github.com/dtolnay/proc-macro2).


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

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-16 16:05:55 +00:00
dependabot[bot]
182d276f69 github: bump the github-dependencies group with 2 updates
Bumps the github-dependencies group with 2 updates: [taiki-e/install-action](https://github.com/taiki-e/install-action) and [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv).


Updates `taiki-e/install-action` from 2.49.49 to 2.49.50
- [Release notes](https://github.com/taiki-e/install-action/releases)
- [Changelog](https://github.com/taiki-e/install-action/blob/main/CHANGELOG.md)
- [Commits](be7c31b674...09dc018eee)

Updates `astral-sh/setup-uv` from 5.4.1 to 5.4.2
- [Release notes](https://github.com/astral-sh/setup-uv/releases)
- [Commits](0c5e2b8115...d4b2f3b6ec)

---
updated-dependencies:
- dependency-name: taiki-e/install-action
  dependency-version: 2.49.50
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-dependencies
- dependency-name: astral-sh/setup-uv
  dependency-version: 5.4.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-16 16:05:39 +00:00
Gaëtan Lehmann
5f7159d4b1 commit: add trailer support 2025-04-16 14:21:35 +00:00
dependabot[bot]
bb4d0b9ac2 cargo: bump libc from 0.2.171 to 0.2.172 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.171 to 0.2.172
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Changelog](https://github.com/rust-lang/libc/blob/0.2.172/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.171...0.2.172)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-15 20:58:57 +00:00
Yuya Nishihara
81344e6828 merge: clarify expectation of with_new_file_ids() 2025-04-15 15:08:47 +00:00
Martin von Zweigbergk
7cab444313 repo_path: remove assertion from constructors
We ran into a crash on our server at Google today because we
accidentally called `RepoPathBuf::from_internal_string()` with a
string starting with a '/', which resulted in a the assertion in that
function failing. This patch changes that constructor and its siblings
to return a `Result` instead.
2025-04-15 14:42:23 +00:00
Martin von Zweigbergk
f0545ee25c test: introduce test helpers for creating repo path types
I'm about to make the constructors return a `Result`. The helpers will
hide the unwrapping.
2025-04-15 14:42:23 +00:00
Martin von Zweigbergk
094ab0b2bb tree: delete entries() method, update MergedTree test
`Tree::entries()` was only used in one test case. We can just as well
use `MergedTree::entries()` there.
2025-04-15 13:14:46 +00:00
Martin von Zweigbergk
0f92978231 tree: delete unused entry() method 2025-04-15 13:14:46 +00:00
Gaëtan Lehmann
f6e3f38b94 templates: add commonly used trailers
namely Signed-off-by and Change-Id

`format_signed_off_by_trailer` will be formatted properly if the author
name is not set, but will contain the email placeholder if the author
email is not set, as I haven't found a way to make the template
generation fail.

`format_gerrit_change_id_trailer` is based on jj's change id, but it
needed to be padded to reach 40 characters. Zero-padding is kind of
boring so I've used `6a6a6964`, the hexadecimal representation of `jjid`
in ascii.

Because the trailer value runs up to the end of the line, they are
all terminated with a new line. This way it's also convenient to
define these trailers in the `commit_trailers` template:

  [templates]
  commit_trailers = '''
    format_signed_off_by_trailer(self)
    ++ format_gerrit_change_id_trailer(self)
  '''
2025-04-15 05:16:16 +00:00
dependabot[bot]
49570b3ef0 cargo: bump clap from 4.5.35 to 4.5.36 in the cargo-dependencies group
Bumps the cargo-dependencies group with 1 update: [clap](https://github.com/clap-rs/clap).


Updates `clap` from 4.5.35 to 4.5.36
- [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.35...clap_complete-v4.5.36)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-15 03:10:06 +00:00
dependabot[bot]
bacc609f2b github: bump taiki-e/install-action in the github-dependencies group
Bumps the github-dependencies group with 1 update: [taiki-e/install-action](https://github.com/taiki-e/install-action).


Updates `taiki-e/install-action` from 2.49.47 to 2.49.49
- [Release notes](https://github.com/taiki-e/install-action/releases)
- [Changelog](https://github.com/taiki-e/install-action/blob/main/CHANGELOG.md)
- [Commits](a48a50298f...be7c31b674)

---
updated-dependencies:
- dependency-name: taiki-e/install-action
  dependency-version: 2.49.49
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-15 02:00:13 +00:00
Yuya Nishihara
26ffaf4ac2 repo: reimplement merge of working-copy commits in the same way as other refs
I don't think we need to optimize it for new_id == self_id, so I implemented the
fallback path as precise as the documentation.
2025-04-14 01:07:30 +00:00
Yuya Nishihara
a1d88980a9 revset: compare conflict file contents without materializing as conflicts
The logic is similar to the color-words diff's. We first resolve trivial
conflicts, then compare each hunk of Merge<&BStr> type. We also apply the same
optimization as the resolved case to minimize lines to be merged and diffed.
2025-04-14 01:07:24 +00:00
Winter
f3c4cc2155 cli: duplicate: add setting for templating the new commit descriptions
This allows the customization of the duplicated commit descriptions.

An ideal use case for this is emulating `git cherry-pick -x`, as
illustrated in the tests.
2025-04-13 21:49:47 +00:00
Gaëtan Lehmann
ee0e86fa63 lib: only allow non-trailer when the trailers contain a git generated trailer
namely Signed-off-by and cherry-pick trailers. The cherry-pick trailer
doesn't appear in the parsed trailer though, to match the
`git interpret-trailers` implementation.

see https://github.com/git/git/blob/master/trailer.c for reference
2025-04-13 20:36:11 +00:00
Gaëtan Lehmann
71a0194ad1 describe: add trailer support
Add a new `template.commit_trailer` configuration option. This template
is used to add some trailers to the commit description.

A new trailer paragraph is created if no trailer paragraph is found in
the commit description.
The trailer is not added to the trailer paragraph when the trailer is
already present, or if the commit description is empty.
2025-04-13 20:36:11 +00:00
Gaëtan Lehmann
3c233c0f45 lib: add trailer module for commit trailers
To be used for parsing `Change-Id`, `Signed-off-by` and other
`Co-authored-by` trailers from commits

Co-authored-by: Austin Seipp <aseipp@pobox.com>
2025-04-13 20:36:11 +00:00
Martin von Zweigbergk
c259eb7413 revset: don't crash if revset engine returns non-BackendError
We call `RevsetEvaluationError::expect_backend_error()` in lots of
places. If the revset engine had returned a non-`BackendError`, it
would result in a panic. For example, a revset engine might return
something like `RevsetEvaluationError::Other("not supported".into())`
for some revsets. We shouldn't crash when this happens.

We may want to create some higher-level `RepoError` to return here,
but for now let's just avoid the crash.
2025-04-13 18:50:39 +00:00
Emily
af67d1d8c4 git: work around gix global remote configuration issue
Closes: #6324
2025-04-13 13:55:09 +00:00
Emily
045b17e38e tests: test behaviour of global Git remote configuration 2025-04-13 13:55:09 +00:00
Emily
027350122f tests: allow overriding more environment variables 2025-04-13 13:55:09 +00:00
Yuya Nishihara
a2bd7b30ad merge: remove redundant .clone() from .simplify()
It no longer makes sense that .simplify() requires ownership. It clones values
internally.
2025-04-13 05:18:16 +00:00
Yuya Nishihara
81b2f1a1fb merge-tools: fix builtin merge editor to not ignore executable bit
Exec-bit conflicts are resolved separately, but we still need to copy them to
UI to get back the original state.
2025-04-13 05:18:11 +00:00
Yuya Nishihara
fa00775f94 cli: resolve: do not use .with_new_file_ids() to construct resolved file value
This reverts a01d0bf7738f "cli: resolve: leave executable bit unchanged when
using external tool", and updates handling of resolved content.

Fixes #6250
2025-04-13 02:02:58 +00:00
Yuya Nishihara
ace0a52eb1 cli: resolve: error out early if conflict in exec bit couldn't be resolved
As Martin suggested, "we should instead make it an error to try to resolve the
content-level conflict before resolving the executable-bit-level conflict. I
think we should do the same when merging copy records."

https://github.com/jj-vcs/jj/pull/6288#pullrequestreview-2751367755
2025-04-13 02:02:58 +00:00
Yuya Nishihara
b28bc420ab merge: do not map absent tree entry to non-executable
We're going to make "jj resolve" error out on exec bit conflict. This behavior
should be more consistent with tree::try_resolve_file_conflict(), which exits
early if the tree value had absent entries.

Since unchanged exec bit shouldn't be lost when resolving change-delete content
conflict, the resolution function falls back to the original state if the
exec-bit conflict is resolved to None.
2025-04-13 02:02:58 +00:00
Yuya Nishihara
ecee441fb3 merge: use .try_map() internally to transform Merge<TreeValue>
This seems a bit easier to follow than nesting Option types.
try_resolve_file_conflict() doesn't have this problem, but it is the only caller
of maybe_map(), so I've gone ahead and replaced it, too.

The return type is unchanged because it looked equally bad if to_tree_merge()
returned Result<Result<Merge<Tree>, ()>, BackendError>.
2025-04-13 02:02:58 +00:00
Winter
0c53293a9e nix: fix tests in darwin sandbox 2025-04-12 21:54:58 +00:00
Nils Koch
fbaa51b4ce revset: add signed function 2025-04-12 14:14:26 +00:00
Yuya Nishihara
1e94ee263b cli: resolve: update "not normal files" error message and formatting
try_materialize_file_conflict_value() and to_file_merge() shouldn't fail because
of exec bit changes. And error.to_string() shouldn't include trailing newline.
2025-04-12 08:58:05 +00:00
Yuya Nishihara
d2caf6f1d9 cli: resolve: use try_materialize_file_conflict_value()
The executable bit handling will be a bit more involved in order to get around
#6250.
2025-04-12 08:58:05 +00:00
Yuya Nishihara
e4bbb5b14d conflicts: store unsimplified file ids in MaterializedFileConflictValue 2025-04-12 08:58:05 +00:00
Yuya Nishihara
a856494ab4 conflicts: extract function that materializes file conflict
This will be used in "jj resolve".
2025-04-12 08:58:05 +00:00
Yuya Nishihara
f047addfe0 conflicts: pack MaterializedTreeValue::FileConflict fields into struct
I'll add a function that returns Option<MaterializedFileConflictValue> instead
of MaterializedTreeValue.
2025-04-12 08:58:05 +00:00
Yuya Nishihara
8bcb806eed op_store: attach path context to read/write errors
This will probably help debug weird problem like #6287. File names are a bit
redundant for ReadObject errors (which include ObjectId), but that should be
okay.
2025-04-12 06:56:13 +00:00
Yuya Nishihara
5c6ab172b8 transaction: propagate error from tx.write()
#6287
2025-04-12 06:56:13 +00:00
Yuya Nishihara
3d98f59215 transaction: narrow scope of local variables needed to create Operation object
I feel this is easier to follow.
2025-04-12 06:56:13 +00:00
Yuya Nishihara
f587374d37 transaction: wrap tx.commit() error in enum
This helps propagate error from tx.write(). I made the error variants
non-transparent because it's easier than manually implementing From<> that maps
each inner error to the other inner error.
2025-04-12 06:56:13 +00:00
Yuya Nishihara
1305912fcf git_backend: load "git gc" executable name from settings 2025-04-12 01:43:35 +00:00
Yuya Nishihara
bae809a572 git_backend: pass GitSettings in to GitBackend::new()
The GitSettings object is passed by value as we're going to extract
executable_path from it, and GitBackend::new() is private.
2025-04-12 01:43:35 +00:00
Yuya Nishihara
60b96122f2 cleanup: use new array methods instead of .collect_tuple()/.next_tuple()
It's more obvious that the element types are the same.
2025-04-12 00:58:14 +00:00
Winter
601548061d config-schema: add templates 2025-04-12 00:20:46 +00:00
Caleb White
3efb59426f abandon: convert deleted bookmark warning to hint
Bookmarks are no longer deleted on the next `jj git push` command, so
this updates the language and downgrades the warning to a hint.
2025-04-11 01:35:07 +00:00