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

2204 commits

Author SHA1 Message Date
dependabot[bot]
1a11679539 github: bump ossf/scorecard-action from 2.1.0 to 2.1.1
Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.1.0 to 2.1.1.
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](937ffa90d7...15c10fcf1c)

---
updated-dependencies:
- dependency-name: ossf/scorecard-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-20 08:43:48 -08:00
dependabot[bot]
e1bf2ea7f4 cargo: bump thiserror from 1.0.37 to 1.0.38
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.37 to 1.0.38.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.37...1.0.38)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-19 09:57:39 -08:00
dependabot[bot]
cee85364eb cargo: bump serde from 1.0.150 to 1.0.151
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.150 to 1.0.151.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.150...v1.0.151)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-19 09:57:28 -08:00
dependabot[bot]
548595ec52 cargo: bump blake2 from 0.10.5 to 0.10.6
Bumps [blake2](https://github.com/RustCrypto/hashes) from 0.10.5 to 0.10.6.
- [Release notes](https://github.com/RustCrypto/hashes/releases)
- [Commits](https://github.com/RustCrypto/hashes/compare/blake2-v0.10.5...blake2-v0.10.6)

---
updated-dependencies:
- dependency-name: blake2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-19 09:57:18 -08:00
dependabot[bot]
cb59948b3c cargo: bump serde_json from 1.0.89 to 1.0.91
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.89 to 1.0.91.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.89...v1.0.91)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-19 09:57:06 -08:00
Martin von Zweigbergk
a2d2da4d48 cli: remove unnecessary (?) ArgAction::Append in $[clap]
I think "append" is the default for `Vec`-type fields.
2022-12-18 17:51:58 -08:00
Ilya Grigoriev
dac80ef88c Rename diff_edit.rs to merge_tools.rs
This is important especially since we're about to rename the `touchup` command into `diffedit`.
2022-12-17 22:26:59 -08:00
Ilya Grigoriev
f96f45125e Rename merge-tools.toml to merge_tool_config.toml
I think this fits in better with the other files in this dir
and is more descriptive.
2022-12-17 22:08:50 -08:00
Ilya Grigoriev
8f9cc3f4e8 Instructions and better config for Vim as a diff editor
After I changed `merge-tools.vimdiff.program` to `vim`, using
`vimdiff` as a diff editor wouldn't work at all. 

Out of the box, it's still not a good experience. I included a
recommendation of a plugin to install to make it better.
2022-12-17 22:08:50 -08:00
Luke Granger-Brown
90ba55bd7b git: cache the extra metadata table
Performance on repositories with many commits is limited somewhat by repeatedly
stating the tablestore directory to work out what the head is. By caching the
table rather than looking it up from disk on every request, we can much more
rapidly satisfy requests. 

This avoids the pathological case in #845 where jj operations take several
minutes to complete.

This patch doesn't change the normal flow of the write path: that will still
always call get_head() on the underlying TableStore, which will stat the
directory before writing out changes. It will however empty the cache when the
metadata has been written.

Fixes #845.
2022-12-17 08:19:14 +00:00
Martin von Zweigbergk
86cd0fa570 docs: touch up contributor guide, mentioning cargo nextest --workspace
It can be confusing that the lib crate is not tested when you run
`cargo test` without `--workspace` from the root directory. Also,
`nextest` is a non-obvious quality-of-life improvement, so let's
suggest that.
2022-12-16 22:08:17 -08:00
Daniel Ploch
e9bd6fbeae op_heads_store: give the OpHeadsStore factory semantics 2022-12-16 10:47:48 -08:00
Daniel Ploch
90a66ec262 op_heads_store: move op_heads into a subdir, to make room for the 'type' marker 2022-12-16 10:47:48 -08:00
Daniel Ploch
2c5b3d0cc7 op_heads_store: convert load() to take &Path like other factories 2022-12-16 10:47:48 -08:00
Daniel Ploch
309a3f91a1 op_heads_store: refactor into an interface and simple implemenation
The implementation has some hoops to jump through because Rust does not allow
`self: &Arc<Self>` on trait methods, and two of the OpHeadsStore functions need
to return cloned selves. This is worked around by making the implementation type
itself a wrapper around Arc<>.

This is not particularly note worthy for the current implementation type where
the only data copied is a PathBuf, but for extensions it is likely to be more
critical that the lifetime management of the OpHeadsStore is properly
maintained.
2022-12-16 10:47:48 -08:00
Yuya Nishihara
af85f552b6 cli: do not unwrap BackendError at resolve_revset() 2022-12-16 13:34:58 +09:00
Yuya Nishihara
4e8f51a983 cleanup: leverage Itertools::try_collect() instead of turbofish
It still requires return type annotation in some places, but should be easier
to type than ::<Result<...

https://docs.rs/itertools/latest/itertools/trait.Itertools.html#method.try_collect
2022-12-16 13:34:58 +09:00
Martin von Zweigbergk
daef30906f protobuf: remove ignored call to out_dir()
Since we call `cargo_out_dir()` - which is the preferred way of using
`protobuf_codegen::Codegen` in `build.rs` - our call to `out_dir()`
has no effect.
2022-12-15 13:02:22 -08:00
Martin von Zweigbergk
fb396e6b45 cleanup: address unnecessary_borrow lints reported by Clippy 1.66
Interestingly, the nightly release doesn't complain about this. One
instance in `test_working_copy.rs` is a bug in Clippy.
2022-12-15 12:38:01 -08:00
dependabot[bot]
af32f0d3c3 github: bump ossf/scorecard-action from 2.0.6 to 2.1.0
Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.0.6 to 2.1.0.
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](99c53751e0...937ffa90d7)

---
updated-dependencies:
- dependency-name: ossf/scorecard-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-15 07:40:37 -08:00
Yuya Nishihara
9158c96202 cli: show hint if e.g. checkout revset resolved to multiple revisions
As suggested at
https://github.com/martinvonz/jj/issues/878#issuecomment-1345466602
2022-12-15 22:55:29 +09:00
Yuya Nishihara
6889d64ffc cli: unnest resolve_single_rev() error handling bits
I'll add more code to (Some, Some) arm, so let's extract the successful
case for readability.
2022-12-15 22:55:29 +09:00
Yuya Nishihara
62a38d3e86 cli: add kdiff3 edit-args to stock config 2022-12-15 15:16:50 +09:00
Yuya Nishihara
52e26a8d9a cli: move merge-tools name to [table] header
Even though we need to repeat "merge-tools", I feel it's a bit better to
group parameters by tool name. Tools are sorted by name.
2022-12-15 15:16:50 +09:00
Yuya Nishihara
c86f7f87e4 cli: add comment why stock config isn't add_source()-d to main config_builder 2022-12-15 15:16:50 +09:00
Yuya Nishihara
0a28b2c508 cli: extract stock merge-tools config to file, embed it in binary
I think a separate .toml file is easier to maintain as the merge-tools
table will grow.
2022-12-15 15:16:50 +09:00
Martin von Zweigbergk
7f9a0a2820 cleanup: let new Clippy move variables into format strings
I ran an upgraded Clippy on the codebase. All the changes seem to be
about using variables directly in format strings instead of passing
them as separate arguments.
2022-12-14 21:30:58 -08:00
Martin von Zweigbergk
c8a04d6f69 cli: use .display() instead of debug format in two errors 2022-12-14 21:30:58 -08:00
Yuya Nishihara
cec4d6c214 cli: allow multiple diff outputs
"jj log -p --summary" now shows summary and color-words diff, like
"hg log -p --stat".

Handling of "-p" is tricky. I first considered "-p" would turn on the default
diff output, but I found it would be confusing if "jj log -p --git" showed
both color-words and git diffs. So the default format is inserted only if
no --git nor --color-words is explicitly specified.
2022-12-15 11:41:42 +09:00
Yuya Nishihara
07cf103ac1 cli: pass from/to_tree in to show_diff() instead of TreeDiffIterator
This allows us to generate diff in different formats. There are various ways
to achieve that:

 a. build TreeDiffIterator for each format (this patch)
 b. make TreeDiffIterator clonable
 c. collect TreeDiffIterator and reuse the resulting vec

(a) and (b) are practically the same. (c) would be more efficient if building
and iterating TreeDiffIterator were expensive, but I don't think it is because
Tree is cached by Store. If we add $GIT_EXTERNAL_DIFF-like feature, we'll
probably need Tree objects to snapshot them to /tmp. So I chose (a).
2022-12-15 11:41:42 +09:00
Yuya Nishihara
69e57daa64 cli: enable diff output by 'log --color-words'
It doesn't make sense that --git implies -p, but --color-words doesn't.
2022-12-15 11:41:42 +09:00
Yuya Nishihara
b4d6c9e8da cli: extract helper that resolves diff arguments for log-like commands 2022-12-15 11:41:42 +09:00
Yuya Nishihara
cdf3bfa55f cli: extract default_diff_format() from diff_format_for()
I'll make "jj log -p --summary" show both summary and diff, where -p will
be resolved to the default diff format.
2022-12-15 11:41:42 +09:00
Yuya Nishihara
f26582d0a3 cli: leverage show_patch() helper to implement show command 2022-12-15 11:41:42 +09:00
Martin von Zweigbergk
b28ff2fbd9 cli: use committer timestamp instead of author timestamp in log output
The author timestamp is rarely useful (in my experience). The
committer timestamp, on the other hand, can be useful for
understanding when a change was most recently modified. IIRC, I
originally picked the author timestamp to match the email (which is
the author's), but it's probably not confusing to use the author email
and the committer timestamp. I suspect few users will even reflect on
it.
2022-12-14 15:48:11 -08:00
Daniel Ploch
bd31bfd2d7 repo: give OpStore factory load semantics 2022-12-14 14:10:30 -08:00
Daniel Ploch
0f62c795d8 repo: move backend loading onto the StoreFactories struct 2022-12-14 14:10:30 -08:00
Daniel Ploch
25c379429c op_store: init/load by &Path, for consistency with other stores 2022-12-14 14:10:30 -08:00
Daniel Ploch
7cbea42a24 repo: rename BackendFactories to StoreFactories 2022-12-14 14:10:30 -08:00
Daniel Ploch
7756cfa61b op_store: op store delegates should not implement the OpStore trait directly 2022-12-14 14:10:30 -08:00
Yuya Nishihara
ffbd6eb945 tree: ensure Tree outlives its iterator on dropping self-referential struct
Just for sanity. It wouldn't matter unless the iterator implements Drop.

https://doc.rust-lang.org/reference/destructors.html
2022-12-15 01:51:25 +09:00
dependabot[bot]
1f3cfcec9d github: bump github/codeql-action from 2.1.36 to 2.1.37
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.1.36 to 2.1.37.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](a669cc5936...959cbb7472)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-14 07:35:59 -08:00
Yuya Nishihara
dce45794df cli: move show_patch() to diff_util
I think this belongs to the same category as show_diff().
2022-12-14 15:24:50 +09:00
Yuya Nishihara
dff53b1200 cli: simplify match arms in diff_format_for() 2022-12-14 15:24:50 +09:00
Yuya Nishihara
5e490f310f cli: extract show_diff*() functions and structs to new module
I think these functions are big enough to be separated from random chunk
of command functions.
2022-12-14 15:24:50 +09:00
Yuya Nishihara
73ea5cd56e cli: parse early args in/after alias properly
Follows up aa2ce88544 'cli: process args to "--help" and "help"'.
2022-12-14 13:51:23 +09:00
Yuya Nishihara
5dc73ab7ad cli: do not raise ClapError from resolve_aliases()
This allows us to process early args after alias resolution.
2022-12-14 13:51:23 +09:00
Glen Choo
aa2ce88544 cli: process args to "--help" and "help"
Clap bails parsing when an "error" is encountered, e.g. a subcommand is missing,
"--help" is passed, or the "help" subcommand is invoked. This means that the
current approach of parsing args does not handle flags like `--no-pager` or
`--color` when an error is encountered.

Fix this by separating early args into their own struct and preprocessing them
using `ignore_errors` (per https://github.com/clap-rs/clap/issues/1880).

The early args are in a new `EarlyArgs` struct because of a known bug where
`ignore_errors` causes default values not to be respected
(https://github.com/clap-rs/clap/issues/4391 specifically calls out bool, but
strings may also be ignored), so when `ignore_errors` is given, the default
values will be missing and parsing will fail unless the right arg types are used
(e.g`. Option`). By parsing only early args (using the new struct) we only need
to adjust `no_pager`, instead of adjusting all args with a default value.
2022-12-14 04:50:14 +08:00
Glen Choo
a31897146f cli: paginate help
This does not respect "--no-pager", support will be added in the next
commit.
2022-12-14 04:50:14 +08:00
dependabot[bot]
ae981ff33a github: bump actions/checkout from 3.1.0 to 3.2.0
Bumps [actions/checkout](https://github.com/actions/checkout) from 3.1.0 to 3.2.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](93ea575cb5...755da8c3cf)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-13 11:35:27 -08:00