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

4806 commits

Author SHA1 Message Date
Antoine Cezar
5d45bd194a commands: move workspace code to workspace.rs 2023-11-03 04:45:55 +01:00
Antoine Cezar
9e462509f8 commands: move version code to version.rs 2023-11-03 04:45:55 +01:00
Antoine Cezar
04eddc666c commands: move untrack code to untrack.rs 2023-11-03 04:45:55 +01:00
Antoine Cezar
9d72fa2a51 commands: move unsquash code to unsquash.rs 2023-11-03 04:45:55 +01:00
Antoine Cezar
8bb0383ad5 commands: move util code to util.rs 2023-11-03 04:45:55 +01:00
Antoine Cezar
abe658d966 commands: move status code to status.rs 2023-11-03 04:45:55 +01:00
Antoine Cezar
116214a79d commands: move squash code to squash.rs 2023-11-03 04:45:55 +01:00
Antoine Cezar
38898336a0 commands: move split code to split.rs 2023-11-03 04:45:55 +01:00
Antoine Cezar
6d0633443b commands: move sparse code to sparse.rs 2023-11-03 04:45:55 +01:00
Antoine Cezar
8f09fcc434 commands: move show code to show.rs 2023-11-03 04:45:55 +01:00
Antoine Cezar
6ae2e4c54f commands: move run code to run.rs 2023-11-03 04:45:55 +01:00
Antoine Cezar
e2336728da commands: move restore code to restore.rs 2023-11-03 04:45:55 +01:00
Austin Seipp
37d6e71f76 github: fix codespell skip syntax for directories
Summary: Codespell actually matches local files at the root of the repo with the
`./` prefix, so without it the `skip` field won't match. Fix this for `./target`
and `./.jj` directories.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Change-Id: Ibeafd7e400ff3bca9187d62241296060
2023-11-02 15:37:26 -05:00
Philip Metzger
c783bbce6d FAQ: Add an entry on how Jujutsu saves changes in the working-copy.
This was brought up as a common point of confusion in a Discord discussion ~2 
months ago.
2023-11-02 20:29:06 +01:00
Martin von Zweigbergk
3a378dc234 cli: add a function for restoring part of a tree from another tree
We had similar code in two places for restoring paths from one tree to
another. Let's reuse it instead.

I put the new function in the `rewrite` module. I'm not sure if that's
right place. Maybe it belongs in `tree`?
2023-11-02 06:07:45 -07:00
Yuya Nishihara
162dcd49b4 cli: rewrite base GitIgnoreFile lookup to use gitoxide instead of libgit2
Since gix::Repository::config_snapshot() borrows the repo instance, it has to
be allocated in caller's stack. That's why GitBackend::git_config() is removed.
2023-11-02 19:33:06 +09:00
Yuya Nishihara
c88e69ad6f git_backend: replace git2::Repository with gix::Repository
My gut feeling is that gitoxide aims to be more transparent than libgit2. We'll
need to know more about the underlying Git data model.

Random comments on gix API:

 * gix::Repository provides API similar to git2::Repository, but has less
   "convenient" functions. For example, we need to use .find_object() +
   .try_to/into_<kind>() instead of .find_<kind>().
 * gix::Object, Blob, etc. own raw data as bytes. gix::object and gix::objs
   types provide high-level views on such data.
 * Tree building is pretty low-level compared to git2.
 * gix leverages bstr (i.e. bytes) extensively.

It's probably not difficult to migrate git::import/export_refs(). It might
help eliminate the startup overhead of libssl initialization. The gix-based
GitBackend appears to be a bit faster, but that wouldn't practically matter.

#2316
2023-11-02 19:33:06 +09:00
Yuya Nishihara
9a86b77e38 tests: force gitoxide to not load config nor use "main" as default branch
AFAIK, there's no global config state for gitoxide. We can use
Config::isolated() in tests, but GitBackend should load config files in a
normal way.

https://docs.rs/gix/0.55.2/gix/open/permissions/struct.Config.html#method.isolated
https://docs.rs/gix/0.55.2/gix/init/constant.DEFAULT_BRANCH_NAME.html
2023-11-02 19:33:06 +09:00
Yuya Nishihara
f5a61dc2b7 git_backend: open just-initialized repo with canonicalized path
Otherwise, the initialized repo could have a different work-dir path than the
load()-ed one. libgit2 appears to do some normalization somewhere, but gix
won't.
2023-11-02 19:33:06 +09:00
Yuya Nishihara
fd187d266f git_backend: box GitBackendInit/LoadError up front
These error enums will wrap gix error types, and will become bigger enough for
clippy to complain.
2023-11-02 19:33:06 +09:00
Yuya Nishihara
b48569b104 cargo: add gitoxide (or gix) dependency
I've enabled the "index" component from the "basic" feature set, which would
be needed to implement colocated repo functionality. The doc suggests that
a library shouldn't activate "max-performance-safe", but our crate is also
an application so it would be okay to enable the feature. We'll need "parallel"
anyway to make GitBackend Sync.

https://docs.rs/gix/latest/gix/#feature-flags
2023-11-02 19:33:06 +09:00
Martin von Zweigbergk
46a8afe144 formatter: reset colors on early drop
If we create a `ColorFormatter`, add some labels to it, print
something using the configured style, and then return early because of
an error, we would leave the terminal in a bad state. I think many
shells reset color codes after a command returns, but let's still do
our best.
2023-11-01 21:41:25 -07:00
Ilya Grigoriev
2f6cce1e4f Fix 0.11 title in CHANGELOG.md
As reported by several people on Discord.
2023-11-01 19:05:25 -07:00
Martin von Zweigbergk
f00f7527dd release: release version 0.11.0
Thanks to everyone who's contributed!
2023-11-01 11:08:44 -07:00
dependabot[bot]
9e523cd218 cargo: bump the cargo-dependencies group with 1 update
Bumps the cargo-dependencies group with 1 update: [indexmap](https://github.com/bluss/indexmap).

- [Changelog](https://github.com/bluss/indexmap/blob/master/RELEASES.md)
- [Commits](https://github.com/bluss/indexmap/compare/2.0.2...2.1.0)

---
updated-dependencies:
- dependency-name: indexmap
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-01 08:39:59 -07:00
Yuya Nishihara
f89f2f9e7d cli: add "branch list [NAMES]..." filter
Like "jj log PATHS...", unmatched name isn't an error. I don't think
"jj branch list glob:'push-*'" should fail just because there are no in-flight
PR branches.
2023-11-01 08:38:55 -07:00
Isabella Basso
749d8bb15a git: preserve HEAD when possible
Closes: #2210
2023-11-01 08:23:52 -03:00
Tal Pressman
6b1217ec6d add FAQ for divergent changes 2023-11-01 16:55:57 +09:00
Ilya Grigoriev
0df851e6e2 glossary.md: Add a stub for "Hidden commits, Abandoned commits" 2023-10-31 23:41:41 -07:00
Ilya Grigoriev
c79920095b glossary.md: Clarify description of "visible commits" 2023-10-31 23:41:41 -07:00
Ilya Grigoriev
4c490d2ca9 revsets.md: correct description of "visible commits" 2023-10-31 23:41:41 -07:00
Ilya Grigoriev
d2c2c270f8 cli rebase: Move misplaced paragraph, fixup to 8bc3f5fd67 2023-10-31 18:57:02 -07:00
Ilya Grigoriev
a3f21f7a9d revsets.md: clarify string patterns and file patterns
I had to increase indent on two list items for multiple paragraphs to work in
MkDocs.
2023-10-31 17:49:49 -07:00
dependabot[bot]
02f728277f cargo: bump the cargo-dependencies group with 1 update
Bumps the cargo-dependencies group with 1 update: [serde_json](https://github.com/serde-rs/json).

- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.107...v1.0.108)

---
updated-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>
2023-10-31 15:54:17 +00:00
Ilya Grigoriev
38daa9abe3 install-and-setup.md: Document binary installation with cargo-binstall
I also mentioned this in the changelog, since people reading it are more likely
to use `binstall` than most.
2023-10-30 15:12:23 -07:00
Ilya Grigoriev
2cd262def3 install-and-setup.md: Make headings more consistent 2023-10-30 15:12:23 -07:00
Yuya Nishihara
1788b5014e git_backend: remove redundant copy back of author timestamp
Only the committer timestamp can be updated inside a loop.
2023-10-31 06:51:27 +09:00
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