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

4556 commits

Author SHA1 Message Date
Ilya Grigoriev
ebb6b942ac cli new: have --before/--after respect immutable commits
I wasn't very careful to make the function
pretty; I'm planning to refactor it anyway as
part of implementing `rebase --before` and
`rebase --after`.
2023-10-29 21:13:39 -07:00
Ilya Grigoriev
62e0729f41 debug.rs: make one of the imports optional
This removes a warning rust-analyzer otherwise shows me.
2023-10-29 20:19:44 -07:00
Ilya Grigoriev
2571169251 clippy: run cargo clippy --fix --workspace with recent nightly 2023-10-29 20:19:44 -07:00
Ilya Grigoriev
1d918dff08 commands: move rebase code to rebase.rs 2023-10-29 18:19:06 -07:00
Ilya Grigoriev
887e5665d5 commands: move resolve code to resolve.rs
The print_conflicted_paths function could belong either
to `resolve.rs` or `status.rs`; I put it into the former for now.

Cc #2465, #2457
2023-10-29 18:19:06 -07:00
Antoine Cezar
19a658e757 commands: move merge code to merge.rs 2023-10-29 23:28:51 +01:00
Antoine Cezar
92739ebf11 commands: move move code to move.rs 2023-10-29 23:28:51 +01:00
Antoine Cezar
6af13ea89b commands: move new code to new.rs 2023-10-29 23:28:51 +01:00
Antoine Cezar
e43b544a06 commands: move log code to log.rs 2023-10-29 23:28:51 +01:00
Antoine Cezar
e9d7a22fc0 commands: move interdiff code to interdiff.rs 2023-10-29 23:28:51 +01:00
Antoine Cezar
60433583b6 commands: move init code to init.rs 2023-10-29 23:28:51 +01:00
Martin von Zweigbergk
35a23172ec backend: delete unused Phase enum
The idea was to support phases like in hg, but that hasn't happened
yet. We can add back this simple enum if we do add support for phases.
2023-10-29 12:02:40 -07:00
Austin Seipp
e5fa5910f2 chore: nix flake update
Summary: Hopefully #2458 will take over this job in the future.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Change-Id: I68a85a5b73a896e16a6e32014022820a
2023-10-28 19:14:40 -05:00
Martin von Zweigbergk
cfcdd71865 backend: make read_conflict synchronous again
This avoids https://github.com/rust-lang/futures-rs/issues/2090. I
don't think we need to worry about reading legacy conflicts
asynchronously - async is really only useful for Google's backend
right now, and we don't use the legacy format at Google. In
particular, I don't want `MergedTree::value()` to have to be async.
2023-10-28 16:45:40 -07:00
Antoine Cezar
42795898de commands: move files code to files.rs 2023-10-28 19:02:54 +02:00
Antoine Cezar
4257341dbe commands: move edit code to edit.rs 2023-10-28 18:44:35 +02:00
Antoine Cezar
061dc81c22 commands: move duplicate code to duplicate.rs 2023-10-28 17:45:19 +02:00
Antoine Cezar
e4a1af1dda commands: move diffedit code to diffedit.rs 2023-10-28 15:59:08 +02:00
Antoine Cezar
b5e4e67090 commands: move diff code to diff.rs 2023-10-28 15:59:08 +02:00
Antoine Cezar
bc3443291e commands: move describe code to describe.rs 2023-10-28 15:59:08 +02:00
Antoine Cezar
8624d39a6b commands: move config code to config.rs 2023-10-28 15:59:08 +02:00
Antoine Cezar
4d63e0bfa7 commands: move commit code to commit.rs 2023-10-28 15:59:08 +02:00
Antoine Cezar
6badf159fa commands: move chmod code to chmod.rs 2023-10-28 15:59:08 +02:00
Antoine Cezar
3a43b22f96 commands: move checkout code to checkout.rs 2023-10-28 15:59:08 +02:00
Antoine Cezar
e19ac4e385 commands: move cat code to cat.rs 2023-10-28 15:59:08 +02:00
Antoine Cezar
b1ce8d41c1 commands: move backout code to backout.rs 2023-10-28 15:59:08 +02:00
Antoine Cezar
af2d6c67f1 commands: move abandon code to abandon.rs 2023-10-28 15:59:08 +02:00
Yuya Nishihara
0e14a1f04d templater: add local/remote_branches keywords 2023-10-28 11:03:23 +09:00
Yuya Nishihara
5486d72f99 templater: cache list of all remote branches, filter them when requested
New local/remote_branches keywords will be implemented on top.
2023-10-28 11:03:23 +09:00
Yuya Nishihara
817ca7f667 templater: use "git" constant to build HEAD@git ref name 2023-10-28 05:29:50 +09:00
Yuya Nishihara
01d474563e templater: make branches, tags, git_refs, and git_head return list type
I'm not going to change the default output, but this allows us to highlight
or dim only the @remote component.
2023-10-28 05:29:50 +09:00
Yuya Nishihara
2b33a97c35 templater: add types for local/remote ref names
Both local and remote refs are backed by the same value type since we'll need
some kind of runtime abstraction to represent "branches" keyword (which is a
list of local + remote branches.) It's tedious to implement separate
local/remote/both ref types.

The "unsynced" flag is inverted just because the positive term is slightly
easier to document.
2023-10-28 05:29:50 +09:00
Yuya Nishihara
f7f08cbe77 templater: consistently use double ?? to denote conflicted refs
I think this is just a remainder of 65de7cb0eb "`jj log`: Change conflicted
branches from `br?` to `br??`."
2023-10-28 05:29:50 +09:00
Yuya Nishihara
b30d5bf1c7 templater: allow implicit list-to-boolean cast
I'm going to change "branches" to return a list instead of formatted string,
and I don't think "if(branches, ..)" should be invalidated by that. Perhaps,
a container type like String, Vec<T>, Option<T> can implement the cast.
2023-10-28 05:29:50 +09:00
Yuya Nishihara
38d60002d1 templater: match exhaustively in boolean cast function
I'm going to change list types to be implicitly cast to boolean. Exhaustive
match will prevent future bugs.
2023-10-28 05:29:50 +09:00
dependabot[bot]
f656d9668b cargo: bump the cargo-dependencies group with 2 updates
Bumps the cargo-dependencies group with 2 updates: [rustix](https://github.com/bytecodealliance/rustix) and [tempfile](https://github.com/Stebalien/tempfile).


Updates `rustix` from 0.38.20 to 0.38.21
- [Release notes](https://github.com/bytecodealliance/rustix/releases)
- [Commits](https://github.com/bytecodealliance/rustix/compare/v0.38.20...v0.38.21)

Updates `tempfile` from 3.8.0 to 3.8.1
- [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Stebalien/tempfile/commits)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-27 16:12:36 +00:00
Ilya Grigoriev
eeb93cc8be cli change id templates: make "hidden" override "divergent"
See the test changes in `test_undo.rs` for motivation. This matters rarely, but
seems to be better.
2023-10-26 17:58:13 -07:00
Ilya Grigoriev
1733ae22c7 cli templates: include info on divergent change ids in short commit template
Fixes #2411
2023-10-26 17:58:13 -07:00
Ilya Grigoriev
a91b6d9dd9 templates: no-op refactor to reduce duplication and simplify next commit 2023-10-26 17:58:13 -07:00
Ilya Grigoriev
6a128f56ed cli: rebase descendants earlier for jj diffedit and jj restore
Makes sure that, at the point the commit summary for the new commit is written,
the original commit that is being rewritten is already abandoned. Otherwise,
once we show divergent change ids (in a subsequent commit) in the short commit
template, the commits would be shown as divergent.

This also has an effect on whether branches are displayed next to the commit;
the changes in test_resotre_command happen because, now, the branch is properly
propagated to the restored commit before its summary is displayed.
2023-10-26 17:58:13 -07:00
Yuya Nishihara
2874a69faf tests: migrate most tests from test_templater.rs
test_templater_alias(), test_templater_alias_override(), and
test_templater_bad_alias_decl() aren't moved since they also test config loading
and error formatting. The first test in test_templater_parse_error() is left for
the same reason. test_templater_upper_lower() depends on the commit templater.
2023-10-27 05:30:53 +09:00
Yuya Nishihara
957360dc83 tests: use color formatter in core template tests
test_templater_label_function() is migrated as example.
2023-10-27 05:30:53 +09:00
Yuya Nishihara
96f8ca5d54 tests: add minimal template language and test helpers
I don't think many of the tests in test_templater.rs should use "jj log" command
as they check very specific template syntax and function behaviors. Let's move
them to in-module tests. We could add a separate test file, but we would have
to export a couple of templater macros.

test_templater_timestamp_method() is migrated as example.
2023-10-27 05:30:53 +09:00
Yuya Nishihara
b455335983 tests: move test_templater_branches() to test_commit_template.rs
It's not testing the core templater functionality.
2023-10-27 05:30:53 +09:00
dependabot[bot]
a3d9c2827e cargo: bump the cargo-dependencies group with 2 updates
Bumps the cargo-dependencies group with 2 updates: [futures](https://github.com/rust-lang/futures-rs) and [serde](https://github.com/serde-rs/serde).


Updates `futures` from 0.3.28 to 0.3.29
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.28...0.3.29)

Updates `serde` from 1.0.189 to 1.0.190
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.189...v1.0.190)

---
updated-dependencies:
- dependency-name: futures
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-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>
2023-10-26 16:00:08 +00:00
Martin von Zweigbergk
a1ef9dc845 merged_tree: propagate backend errors in diff iterator
I want to fix error propagation before I start using async in this
code. This makes the diff iterator propagate errors from reading tree
objects.

Errors include the path and don't stop the iteration. The idea is that
we should be able to show the user an error inline in diff output if
we failed to read a tree. That's going to be especially useful for
backends that can return `BackendError::AccessDenied`. That error
variant doesn't yet exist, but I plan to add it, and use it in
Google's internal backend.
2023-10-26 06:20:56 -07:00
Martin von Zweigbergk
309f1200d6 merge: introduce a type alias for Merge<Option<TreeValue>>
Reasons to introduce this alias:

* Reduces complexity of a type, to silence Clippy warnings in the
  future if we use this type as a type parameter

* The type is used quite frequently, so it makes sense to have a name
  for it

* It's easier to visually scan for the end of the type when you don't
  have to match opening and closing angle brackets
2023-10-26 06:20:56 -07:00
Martin von Zweigbergk
6ad71e658d merged_tree: rename MergedTreeValue to MergedTreeVal
I'm going to add `MergedTreeValue` as an alias for
`Merge<Option<TreeValue>>`, but we already have a type by that name in
`merged_tree`. This patch renames it away, to make room for the new
alias. I used `MergedTreeVal` for this borrowing version to be a bit
like how `str` is a borrowed version of `String`.
2023-10-26 06:20:56 -07:00
Ilya Grigoriev
b6eb00d5ff docs/config.toml: update the default diff editor
It's been changed to `:builtin` some time ago.
2023-10-25 13:05:04 -07:00
Yuya Nishihara
1bfe5b5b56 cli: add string pattern support to "git push --branch"
Since "jj git fetch --branch" supports glob patterns, users would expect that
"jj git push --branch glob:.." also works.

The error handling bits are copied from "branch" sub commands. We might want to
extract it to a common helper function, but I haven't figured out a reasonable
boundary point yet.
2023-10-26 04:51:17 +09:00