Yuya Nishihara
362be5914f
templater: add list.filter(predicate) method
...
If we add generic diff template, we'll probably want to filter diff entries by
status, etc.
Closes #5291
2025-01-24 03:42:39 +00:00
Yuya Nishihara
af05534108
templater: extract helper that builds lambda expression body
...
I also made the helper function accept multiple parameters/arguments as doing
that was easy.
2025-01-24 03:42:39 +00:00
Yuya Nishihara
9683d81f03
templater: load diff parameters from config file
...
It didn't before just because UserSettings wasn't available to the templater.
2025-01-24 03:42:26 +00:00
Yuya Nishihara
3ed77c9bb3
cli: split diff options constructors to not require command args
2025-01-24 03:42:26 +00:00
Yuya Nishihara
fb25e8a4ad
cli: add hint to config error occurred within templater
2025-01-24 03:42:26 +00:00
Ilya Grigoriev
bb74a9eaf5
config.md: document how to install Meld (on a Mac, especially)
...
Installing Meld on a Mac was difficult until quite recently. I also
quickly mentioned how to do it on other OSs.
2025-01-24 02:02:44 +00:00
Ilya Grigoriev
0d55bc56f0
config.md: use meld as example diff editor once more
...
Followup to 4ecf75ef
2025-01-24 02:02:44 +00:00
bsdinis
35440ce1bd
git: spawn a separate git process for network operations
...
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
Reasoning:
`jj` fails to push/fetch over ssh depending on the system.
Issue #4979 lists over 20 related issues on this and proposes spawning
a `git` subprocess for tasks related to the network (in fact, just push/fetch
are enough).
This PR implements this.
Implementation Details:
This PR implements shelling out to `git` via `std::process::Command`.
There are 2 sharp edges with the patch:
- it relies on having to parse out git errors to match the error codes
(and parsing git2's errors in one particular instance to match the
error behaviour). This seems mostly unavoidable
- to ensure matching behaviour with git2, the tests are maintained across the
two implementations. This is done using test_case, as with the rest
of the codebase
Testing:
Run the rust tests:
```
$ cargo test
```
Build:
```
$ cargo build
```
Clone a private repo:
```
$ path/to/jj git clone --config='git.subprocess=true' <REPO_SSH_URL>
```
Create new commit and push
```
$ echo "TEST" > this_is_a_test_file.txt
$ path/to/jj describe -m 'test commit'
$ path/to/jj git push --config='git.subprocess=true' -b <branch>
```
Issues Closed
With a grain of salt, but most of these problems should be fixed (or at least checked if they are fixed). They are the ones listed in #4979 .
SSH:
- https://github.com/jj-vcs/jj/issues/63
- https://github.com/jj-vcs/jj/issues/440
- https://github.com/jj-vcs/jj/issues/1455
- https://github.com/jj-vcs/jj/issues/1507
- https://github.com/jj-vcs/jj/issues/2931
- https://github.com/jj-vcs/jj/issues/2958
- https://github.com/jj-vcs/jj/issues/3322
- https://github.com/jj-vcs/jj/issues/4101
- https://github.com/jj-vcs/jj/issues/4333
- https://github.com/jj-vcs/jj/issues/4386
- https://github.com/jj-vcs/jj/issues/4488
- https://github.com/jj-vcs/jj/issues/4591
- https://github.com/jj-vcs/jj/issues/4802
- https://github.com/jj-vcs/jj/issues/4870
- https://github.com/jj-vcs/jj/issues/4937
- https://github.com/jj-vcs/jj/issues/4978
- https://github.com/jj-vcs/jj/issues/5120
- https://github.com/jj-vcs/jj/issues/5166
Clone/fetch/push/pull:
- https://github.com/jj-vcs/jj/issues/360
- https://github.com/jj-vcs/jj/issues/1278
- https://github.com/jj-vcs/jj/issues/1957
- https://github.com/jj-vcs/jj/issues/2295
- https://github.com/jj-vcs/jj/issues/3851
- https://github.com/jj-vcs/jj/issues/4177
- https://github.com/jj-vcs/jj/issues/4682
- https://github.com/jj-vcs/jj/issues/4719
- https://github.com/jj-vcs/jj/issues/4889
- https://github.com/jj-vcs/jj/discussions/5147
- https://github.com/jj-vcs/jj/issues/5238
Notable Holdouts:
- Interactive HTTP authentication (https://github.com/jj-vcs/jj/issues/401 , https://github.com/jj-vcs/jj/issues/469 )
- libssh2-sys dependency on windows problem (can only be removed if/when we get rid of libgit2): https://github.com/jj-vcs/jj/issues/3984
2025-01-23 16:50:53 +00:00
bsdinis
c773c0296f
git: test git fetch with more than two remotes and branches
...
In some cases, there are non trivial codepaths for fetching multiple
branches explicitly. In particular, it might be the case that fetching
works for n = 2 but not n = 3.
This commit changes a cli test to have 3 remotes and 3 branches, and a
lib test with 3 branches, only one of them succeds.
2025-01-23 16:50:53 +00:00
bsdinis
717ae02f62
lib: add type support for refspecs
...
Fully qualified git refs (e.g., `+refs/head/main:refs/remotes/origin/main`)
are commonly used throughout the git glue code.
It is laborious and error prone to keep parsing refspecs when we need
only a segment of it.
This commits adds a type, `RefSpec`, which does exactly that
2025-01-23 16:50:53 +00:00
Jonathan Frere
55d1c17245
cli: describe: Mark conflicting message/stdin args
2025-01-23 16:11:32 +00:00
Jonathan Frere
e63d1d5114
cli: describe: Add a --edit flag
...
The --edit flag forces the editor to be shown, even if it would have
been hidden due to the --no-edit flag or another flag that implies it
(such as --message or --stdin).
2025-01-23 16:11:32 +00:00
Yuya Nishihara
8eebac54fc
cli: port "file list" to template
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
2025-01-23 02:21:15 +00:00
Yuya Nishihara
7db343ec32
templater: add TreeEntry type
...
I'm going to add "file list" template, and I think it's better to provide a file
path as "path", not "self". This patch also adds some tree value properties
which seemed useful.
Tests will be added later.
2025-01-23 02:21:15 +00:00
Yuya Nishihara
5062ae83d3
templater: add RepoPath types
...
This will be used in "file list" template. Option<RepoPath> type isn't
needed for that, but I think it'll appear somewhere in custom diff template.
The path.parent() method is added mainly for testing Option<RepoPath>.
Tests will be added later.
2025-01-23 02:21:15 +00:00
Yuya Nishihara
ce3100a8cd
cli: reformat config/templates.toml
...
.editorconfig is set to trim trailing whitespace. I also adjusted indent style
and trailing commas.
2025-01-23 02:21:15 +00:00
dependabot[bot]
f264e9556d
cargo: bump rustix in the cargo-dependencies group
...
Bumps the cargo-dependencies group with 1 update: [rustix](https://github.com/bytecodealliance/rustix ).
Updates `rustix` from 0.38.43 to 0.38.44
- [Release notes](https://github.com/bytecodealliance/rustix/releases )
- [Changelog](https://github.com/bytecodealliance/rustix/blob/main/CHANGELOG.md )
- [Commits](https://github.com/bytecodealliance/rustix/compare/v0.38.43...v0.38.44 )
---
updated-dependencies:
- dependency-name: rustix
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: cargo-dependencies
...
Signed-off-by: dependabot[bot] <support@github.com>
2025-01-22 18:51:24 +00:00
dependabot[bot]
e478f0f507
github: bump the github-dependencies group with 3 updates
...
Bumps the github-dependencies group with 3 updates: [DeterminateSystems/magic-nix-cache-action](https://github.com/determinatesystems/magic-nix-cache-action ), [taiki-e/install-action](https://github.com/taiki-e/install-action ) and [github/codeql-action](https://github.com/github/codeql-action ).
Updates `DeterminateSystems/magic-nix-cache-action` from 8 to 9
- [Release notes](https://github.com/determinatesystems/magic-nix-cache-action/releases )
- [Commits](87b14cf437...6221693898
)
Updates `taiki-e/install-action` from 2.47.21 to 2.47.23
- [Release notes](https://github.com/taiki-e/install-action/releases )
- [Changelog](https://github.com/taiki-e/install-action/blob/main/CHANGELOG.md )
- [Commits](da41fb311f...7e1dca9e0c
)
Updates `github/codeql-action` from 3.28.1 to 3.28.2
- [Release notes](https://github.com/github/codeql-action/releases )
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md )
- [Commits](b6a472f63d...d68b2d4edb
)
---
updated-dependencies:
- dependency-name: DeterminateSystems/magic-nix-cache-action
dependency-type: direct:production
update-type: version-update:semver-major
dependency-group: github-dependencies
- dependency-name: taiki-e/install-action
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: github-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>
2025-01-22 18:51:05 +00:00
Yuya Nishihara
2129c8996f
cli: migrate "git remote list" to gix
...
This one is easy, but porting other "jj git remote" sub commands would require
non-trivial work.
The empty [remote "<name>"] case is covered by existing tests.
2025-01-22 12:39:46 +00:00
Yuya Nishihara
721aecb4cc
config: add public ConfigLayer::ensure_table() function
...
It's not uncommon to insert new table at a certain path. This could be modelled
as set_table(name, new_table), but the caller might want to merge items with
the existing table if any. This function can be used for both cases.
2025-01-22 01:01:04 +00:00
Yuya Nishihara
d9e0fb7974
config: add migration type that runs user-specified function
...
This was needed in order to migrate fix.tool-command to [fix.tools] table. We
don't have other use cases right now, but there will be something in future.
2025-01-22 01:01:04 +00:00
Yuya Nishihara
ffaaf89f05
config: add migration type that renames and updates value
...
This will be used in order to migrate boolean value to enum, for example.
2025-01-22 01:01:04 +00:00
Yuya Nishihara
9d77ad5594
config: add separate type for migration error, attach source path
...
Migration can fail because of unexpected value type, etc.
2025-01-22 01:01:04 +00:00
Ilya Grigoriev
231c968f51
dynamic completion: complete jj git push {-r,-c}
...
I had to guess whether to complete all revisions or just mutable ones. I'm
guessing that `-r` is sometimes used with immutable revisions (as part of a
revset, or for creating special-purpose branches), while `-c` is almost always
used to push a mutable revision. We can change it later if my guess is wrong.
2025-01-22 00:45:46 +00:00
Ilya Grigoriev
cf69a36a62
dynamic completion: add revision completion to hidden -r arguments
...
Before this commmit, `jj desc <tab>` resulted in revision completions, but the equivalent `jj desc -r <tab>` didn't.
2025-01-22 00:45:46 +00:00
Yuya Nishihara
a6f20cf42f
graph: make reverse_graph() accept separate node id type
...
Although extra clone/IO wouldn't matter in practice, we can simplify callers
by constructing the edges list to be passed to the graph renderer.
2025-01-22 00:44:42 +00:00
Yuya Nishihara
b70d0c50e1
graph: remove redundant clone from reverse_graph()
...
All input nodes should be unique.
2025-01-22 00:44:42 +00:00
Ilya Grigoriev
5dbc4ae619
actions: fix codespell CI failure
...
It is having a fit for some reason, see e.g.
https://github.com/jj-vcs/jj/actions/runs/12897590111/job/35963026619?pr=5414
Not sure what changed, but here is a quick fix.
A likely cause is
https://github.com/codespell-project/codespell/releases/tag/v2.4.0 .
It'd be cool to fix the version of codespell the action uses, but I
couldn't find a way to do it quickly.
2025-01-22 00:20:33 +00:00
dependabot[bot]
cff86ed5fa
github: bump taiki-e/install-action in the github-dependencies group
...
binaries / Build binary artifacts (push) Has been cancelled
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
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.47.19 to 2.47.21
- [Release notes](https://github.com/taiki-e/install-action/releases )
- [Changelog](https://github.com/taiki-e/install-action/blob/main/CHANGELOG.md )
- [Commits](24758ef6e7...da41fb311f
)
---
updated-dependencies:
- dependency-name: taiki-e/install-action
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: github-dependencies
...
Signed-off-by: dependabot[bot] <support@github.com>
2025-01-21 16:46:20 +00:00
dependabot[bot]
1a2bf50fa1
cargo: bump clap from 4.5.26 to 4.5.27 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.26 to 4.5.27
- [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.27 )
---
updated-dependencies:
- dependency-name: clap
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: cargo-dependencies
...
Signed-off-by: dependabot[bot] <support@github.com>
2025-01-21 16:45:52 +00:00
Martin von Zweigbergk
be32d4e3ef
cli: rebase: say that -r
allows set, clarify -s X
vs -r X::
2025-01-21 06:43:15 +00:00
Yuya Nishihara
4a50a35046
cli: abandon: delete bookmarks pointing to abandoned commits
...
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Based on the discussion in #3505 , I think the sliding behavior isn't favored at
least for "jj abandon". This patch changes the default to delete bookmarks.
"jj rebase --skip-emptied" can also be updated if needed. It might be good for
consistency. However, I'm skeptical about changing the default of the internal
API. It's not easy to add generic reporting mechanism for deleted/abandoned
bookmarks. If we added one in report_repo_changes(), redundant message would be
printed on "jj git fetch". So I think callers should enable the deletion
explicitly.
Closes #3505
2025-01-21 02:37:07 +00:00
Yuya Nishihara
686ab24a5c
cli: abandon: use transform_descendants() to do reparent/rebase conditionally
...
This will help implement "jj abandon --retain-bookmarks".
2025-01-21 02:37:07 +00:00
Yuya Nishihara
c50a70906b
rewrite: add option to delete abandoned bookmarks
...
I'll make "jj abandon" delete bookmarks by default. This could be handled by
cmd_abandon(), but we'll need a repo API if we also want to change the behavior
of "jj rebase --skip-emptied".
2025-01-21 02:37:07 +00:00
Yuya Nishihara
ace041ec96
rewrite: add a few more bookmarks to abandoning test, remove redundant assertion
2025-01-21 02:37:07 +00:00
Yuya Nishihara
a3636d8a83
revset: add subject() predicate that matches first line of descriptions
...
It's generally useful, and we can get by without introducing weird special case
about newline terminator.
Closes #5227
2025-01-21 02:13:04 +00:00
dependabot[bot]
3d7858df26
cargo: bump the cargo-dependencies group with 2 updates
...
Bumps the cargo-dependencies group with 2 updates: [indexmap](https://github.com/indexmap-rs/indexmap ) and [serde_json](https://github.com/serde-rs/json ).
Updates `indexmap` from 2.7.0 to 2.7.1
- [Changelog](https://github.com/indexmap-rs/indexmap/blob/master/RELEASES.md )
- [Commits](https://github.com/indexmap-rs/indexmap/compare/2.7.0...2.7.1 )
Updates `serde_json` from 1.0.135 to 1.0.137
- [Release notes](https://github.com/serde-rs/json/releases )
- [Commits](https://github.com/serde-rs/json/compare/v1.0.135...v1.0.137 )
---
updated-dependencies:
- dependency-name: indexmap
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>
2025-01-21 02:03:44 +00:00
dependabot[bot]
37e2c360cb
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.47.15 to 2.47.19
- [Release notes](https://github.com/taiki-e/install-action/releases )
- [Changelog](https://github.com/taiki-e/install-action/blob/main/CHANGELOG.md )
- [Commits](d125c0a835...24758ef6e7
)
---
updated-dependencies:
- dependency-name: taiki-e/install-action
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: github-dependencies
...
Signed-off-by: dependabot[bot] <support@github.com>
2025-01-21 01:40:53 +00:00
Yuya Nishihara
9663509643
cli: handle remote configuration error on "git clone"
2025-01-21 01:19:15 +00:00
Yuya Nishihara
2415c96cd8
cli: split do_git_clone() function to reduce number of arguments
2025-01-21 01:19:15 +00:00
Yuya Nishihara
5577ffd28d
revset: split author()/committer() into _name()/email() predicates
...
It seemed weird that we don't have primitive functions to query either name or
email field. This also fixes mine() to not match against name.
2025-01-21 01:10:00 +00:00
Yuya Nishihara
206acadd49
revset: remove stale comment about regex pattern
2025-01-21 01:10:00 +00:00
George Christou
9314df9e38
formatter: add support for italic text
2025-01-20 17:46:27 +00:00
Valentin Gatien-Baron
019bd8f757
restore: add --into flag, make --to an alias to it
...
binaries / Build binary artifacts (push) Has been cancelled
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
This is a part of #5394 .
2025-01-19 20:17:44 +00:00
Ilya Grigoriev
027589d199
cleanup: remove WatchmanConfig Default impl
...
binaries / Build binary artifacts (push) Has been cancelled
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
This one was actually used, but only in a debug command.
2025-01-18 07:49:43 +00:00
Ilya Grigoriev
3404085ec4
cleanup: remove Conflict default impl
...
The "default" conflict is not a valid conflict, as it
does not have one more add than removes.
2025-01-18 07:49:43 +00:00
Ilya Grigoriev
5daa138cd7
cleanup: remove a bunch of unused Default impls
...
I noticed that some config structures do not use their "Default" implementation, and have their default specified in a TOML file. I think specifying defaults in TOML is great, and it'd be good to delete those Default implementations, so that it does not diverge from the default in the TOML file.
2025-01-18 07:49:43 +00:00
Yuya Nishihara
83d40d2c42
repo: move rebase_descendants_with_options_return_map() to tests
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
2025-01-18 01:21:28 +00:00
Yuya Nishihara
15f4ac5f12
repo: add rebase_descendants_*() that takes callback instead of returning map
...
There's only one non-test caller who doesn't need a complete map of rebased
commits.
FWIW, I tried to rewrite squash_commits() based on transform_descendants() API,
but it wasn't easy because of A-B+A=A rule. The merge order matters here.
2025-01-18 01:21:28 +00:00
Yuya Nishihara
e3efb0d614
rewrite: pass RebaseOptions by reference
...
Since we've removed DescendantRebaser, it no longer makes sense to pass options
by value. This patch also replaces Default::default() for clarity.
2025-01-18 01:21:28 +00:00