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

4569 commits

Author SHA1 Message Date
Yuya Nishihara
f5aa739c70 git_backend: use .strip_suffix() instead of manual slicing 2023-10-31 06:51:27 +09:00
Yuya Nishihara
9bd84c55e0 git_backend: use file mode extensively in read_tree()
Both filemode() and kind() are calculated from the same underlying data,
and kind() is libgit2-specific API.
2023-10-31 06:51:27 +09:00
Yuya Nishihara
b3c9cab12d git_backend: handle read_tree() lookup/encoding errors gracefully 2023-10-31 06:51:27 +09:00
Yuya Nishihara
847adc832f git_backend: use lossy conversion to decode non-UTF-8 commit message
If message() returned None, it doesn't mean the commit message is empty. I
originally mapped it to an error, but that made import of linux repo fail.

https://docs.rs/git2/latest/git2/struct.Commit.html#method.message
2023-10-31 06:51:27 +09:00
Yuya Nishihara
06c254e742 git_backend: use non-owned str::from_utf8() to decode symlink target
Just for consistency with the other changes. str::Utf8Error is 2 words long,
so I removed the boxing.
2023-10-31 06:51:27 +09:00
Yuya Nishihara
d1c71c05c9 git_backend: remove redundant error handling for invalid hash length
The only error that could be returned by libgit2 is invalid hash length, and
we check that explicitly. If we switch the backends to gitoxide, there will be
panicking constructor.

https://docs.rs/git2/latest/git2/struct.Oid.html#method.from_bytes
2023-10-31 06:51:27 +09:00
Ilya Grigoriev
8bc3f5fd67 cli rebase: Allow jj rebase -r to rebase a commit onto a descendant
#1188

There are some additional test changes because children and descendants are now
rebased before the commit itself.
2023-10-30 10:56:27 -07:00
Antoine Cezar
1d6b883406 commands: move obslog code to obslog.rs 2023-10-30 18:35:08 +01:00
Antoine Cezar
b24a85f879 commands: move prev code to prev.rs 2023-10-30 18:35:08 +01:00
Antoine Cezar
d1135917b0 commands: move next code to next.rs 2023-10-30 18:35:08 +01:00
Martin von Zweigbergk
23a0baba14 cli: make jj workspace add preserve all parents of current workspace 2023-10-29 21:53:29 -07:00
Yuya Nishihara
2d3fe7eee2 rewrite: replace use of "lift"ed function application with try_collect()
Also removed redundant borrow + clone.
2023-10-30 13:50:37 +09:00
Ilya Grigoriev
b482898924 immutable commits: remove the hint if trying to edit the root commit
The hint is a bit misleading in this case. I also changed the message slightly.
2023-10-29 21:13:39 -07:00
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