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

2654 commits

Author SHA1 Message Date
Yuya Nishihara
d1281ef48e templater: ensure "template" node is passed to parse_commit_template_rule()
Assertion will be added by the next commit.
2023-01-29 08:54:14 +09:00
Yuya Nishihara
bf66beab36 templater: fix parsing of parenthesized expression
A "list" is a sequence of more than one "term" nodes, so it shouldn't contain
a single parenthesized node.

Also, a parenthesized "term" rule wasn't handled.
2023-01-29 08:54:14 +09:00
Yuya Nishihara
f7993f0fe9 templater: eliminate whitespace nodes from parse tree 2023-01-29 08:54:14 +09:00
Yuya Nishihara
a85488b11d cli: pretty-print "debug template" output
Since a parsed tree is deeply nested, it's difficult to read as a one-line
string.
2023-01-29 08:54:14 +09:00
Martin von Zweigbergk
aaf75b4793 repo: inline single-caller, and surprising, Commit::is_empty()
I would expect `Commit::is_empty()` to check if the commit is empty in
our usual sense, i.e. that there are no changes compared to the
auto-merged parents. However, it would return `false` for any merge
commit (and for the root commit). Since we only use it in one place,
let's inline it there. The use there does seem reasonable, because
it's about abandoning an "uninteresting" working-copy commit.
2023-01-28 15:54:03 -08:00
Samuel Tardieu
615862dde8 ci: add codespell to the workflow 2023-01-28 07:23:45 -08:00
Samuel Tardieu
a7aed0171d style: fix typos found by codespell 2023-01-28 07:23:45 -08:00
Michael Forster
567a05d7ec nix: use default list of systems
Most notably this removes the `i686-linux` target, which wasn't added
deliberately and is also not tested.
2023-01-28 07:10:12 +01:00
Michael Forster
3a139e81dc nix: re-enable the .envrc file
With #1095 fixed, let's try enabling `.envrc` again.
2023-01-28 07:10:12 +01:00
Michael Forster
3ca26974e6 nix: filter source files
This speeds up the nix build by reducing the number of files that are copied to
the nix store.

Hopefully fixes #1095.
2023-01-28 07:10:12 +01:00
Michael Forster
29db607e10 nix: replace manual system iteration by flake-utils
Let's not reinvent the wheel. This makes the flake more readable, and also would
detect typos in the system list.
2023-01-28 07:10:12 +01:00
Michael Forster
3c0eb21ed1 nix: refactor flake to avoid building jj for the dev shell
We don't actually need `jj` itself in the development shell. But having it in
the overlay significantly increases the time it takes to build the shell.
2023-01-28 07:10:12 +01:00
Martin von Zweigbergk
388fb0ffc1 readme: add --locked to cargo install step
Our installation instructions don't currently work with Rust < 1.64
because `clap` updated their MSRV to 1.64, and `cargo install` without
`--locked` bypasses `Cargo.lock` and selects the version of `clap`
that needs Rust 1.64.
2023-01-27 18:42:09 -08:00
Yuya Nishihara
29eb7a16b8 templater: process method chaining from left to right
A method call is typically left associative, and LTR processing is simpler.
2023-01-28 10:53:03 +09:00
Yuya Nishihara
2ae892efab templater: reuse function rule to represent a method chain
A method call is typically parsed as (obj.meth)(), not as obj.(meth()),
but the latter is good enough for our needs. It's unlikely we'll add a
first-class function support.

.into_inner().next().unwrap() mess will be cleaned up by the next commit.
2023-01-28 10:53:03 +09:00
Martin von Zweigbergk
9ac4fdb11c docs: describe color configuration 2023-01-27 13:16:26 -08:00
Martin von Zweigbergk
d8942d5f96 cli: rename ui.graph.format to ui.graph.style
I think of it more as style than a format, so using `style` in the
config key makes sense to me.

I didn't bother making upgrades easy by supporting the old name since
this was just released and only a few developers probably have it set.
2023-01-27 10:36:26 -08:00
Martin von Zweigbergk
8248d6e8f6 graphlog: remove use of PhantomData 2023-01-27 10:36:26 -08:00
Martin von Zweigbergk
0b99e5b16e graphlog: enable Sapling's graph styles by default
I would also rename the feature, but I hope we can instead soon make
it a non-optional dependency and delete the feature.
2023-01-27 09:46:57 -08:00
Martin von Zweigbergk
06348807f0 cargo: get renderdag from crates.io
Now that the `renderdag` crate is available on crates.io (thanks,
@quark-zju!), let's get it from there.

It has no optional features, so we don't need `default-features =
false`. I should have done that when we switched from the `dag` crate
to the `renderdag` crate.
2023-01-27 09:46:57 -08:00
dependabot[bot]
9336a4518a github: bump github/codeql-action from 2.1.39 to 2.2.1
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.1.39 to 2.2.1.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](a34ca99b46...3ebbd71c74)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-27 08:08:43 -08:00
Yuya Nishihara
a7d02e66de docs: use fenced code blocks and enable syntax highlighting of toml snippets 2023-01-27 13:53:20 +09:00
Martin von Zweigbergk
c5cc2e6d46 tutorial: delete obsolete mention of aliases
The heading says it's going to explain aliases, but it doesn't, and
now that we've documented aliases in config.md, we probably don't need
to mention it in the tutorial.
2023-01-26 18:15:23 -08:00
Martin von Zweigbergk
772d6c47dd docs: document configuration of aliases 2023-01-26 18:15:23 -08:00
Martin von Zweigbergk
d4ed8f32b3 docs: format config.md 2023-01-26 18:15:23 -08:00
Martin von Zweigbergk
780e257b89 docs: fix a typo in config.md and add a missing comma 2023-01-26 18:15:23 -08:00
Martin von Zweigbergk
5ec5f4bb5f config: rename [alias] to [aliases], still supporting old name
The name of the [alias] section is inconsistent with other
table-valued sections ([revset-aliases], [colors], [merge-tools]), so
let's rename it. For comparison, `Cargo.toml` also uses plural names
(e.g. `[dependencies]`).
2023-01-26 18:15:23 -08:00
Martin von Zweigbergk
8af38f0d75 cli: consistently use clap::Command, and avoid unnecessary qualification 2023-01-26 18:15:23 -08:00
Martin von Zweigbergk
4a4aebd3bc cli: don't use clap::Error since it's too generic
It's not obvious when you see `Error`, even in the CLI crate, that
it's a `clap::Error`
2023-01-26 18:15:23 -08:00
Martin von Zweigbergk
3ccdd1f98a tests: pass string instead of bytes to add_config()
I don't think need to write non-UTF8 bytes to our config files. If we
ever do (maybe to test that we give the user a reasonable error
message), we add a custom function for that.
2023-01-26 12:48:30 -08:00
Martin von Zweigbergk
e1d49cc67f tests: use dotted notation in TOML when it saves lines 2023-01-26 12:48:30 -08:00
Yuya Nishihara
d771c12637 index: make HexPrefix accessor simply return "min" prefix as bytes slice
This is low-level function, so I think using &[u8] should be good here.
2023-01-27 03:37:44 +09:00
Yuya Nishihara
770ca72a1f index: use iterator to simplify segment_resolve_prefix() a bit further 2023-01-27 03:37:44 +09:00
Yuya Nishihara
956a2d5f83 index: remove redundant prefix tests from resolve_prefix functions
The "min" prefix guarantees that the first entry matches the hex prefix
if any. Spotted by @ilyagr.
2023-01-27 03:37:44 +09:00
Yuya Nishihara
b4c837fd4a index: simplify segment_resolve_prefix() loop to make both impls look close 2023-01-27 03:37:44 +09:00
dependabot[bot]
5d675f13a2 cargo: bump timeago from 0.4.0 to 0.4.1
Bumps [timeago](https://github.com/vi/timeago) from 0.4.0 to 0.4.1.
- [Release notes](https://github.com/vi/timeago/releases)
- [Commits](https://github.com/vi/timeago/compare/v0.4.0...v0.4.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-26 09:16:03 -08:00
Yuya Nishihara
bfb56614d4 templater: rename TemplateFunction::new() parameter for consistency 2023-01-26 23:42:13 +09:00
Yuya Nishihara
2c4856c47b templater: remove Box<dyn> from generic wrappers, parameterize type
This basically removes 'a lifetime from these wrappers, and add trait bounds
instead. I have no idea which version would look less scary, but let's see.

I also added trait bounds to constructor functions. They aren't strictly
required, but help type inference of closure (and will probably improve
an error message.)
2023-01-26 23:42:13 +09:00
Aleksandr Mikhailov
e7077909c1 cli: fix jj squash on empty commit
Fixes #787
If `jj squash` is run on an empty commit, it fails with "Error: No changes selected"

With this change such squash command will behave like `jj abandon`.
2023-01-26 11:37:20 +01:00
Ilya Grigoriev
5421f5e92d test_obslog_command.rs: stop removing change ids
The regex no longer works and the change ids are no longer random since a few
weeks ago.
2023-01-25 22:07:07 -08:00
Martin von Zweigbergk
d6622e5d42 tests: make fake editor scripts initially empty
I would expect `set_up_fake_[diff_]editor()` to create an empty script
but it turns out they didn't even create the files. That means that
the caller needs to write an empty script to them if they want the
fake editors to not do anything. Let's instead write the empty
scripts, for a less surprising behavior.
2023-01-25 21:58:38 -08:00
Yuya Nishihara
b9fc6d4203 templater: rewrite divergent property by leveraging IdIndex 2023-01-26 14:10:26 +09:00
Yuya Nishihara
824f2106fd repo: migrate revset::resolve_change_id() to use IdIndex for ReadonlyRepo
The MutableRepo implementation is the same as before.
2023-01-26 14:10:26 +09:00
Yuya Nishihara
4f15d1f779 repo: implement method to look up change_id prefix by using IdIndex
revset::resolve_change_id() for ReadonlyRepo will be replaced with this
implementation. This doesn't mean revset query will speed up. A trivial
query will become slower due to the initialization cost of the change id
index. "jj log -r hex" will get faster since we have to pay the cost anyway.

Benchmark numbers (against my "linux" repo):

Command:
    hyperfine --warmup 3 --runs 20 \
      "jj log -r $hex -T '' --no-commit-working-copy --no-graph"

Linear search (e874570947):
    Time (mean ± σ):     223.9 ms ±  16.2 ms    [User: 181.2 ms, System: 42.7 ms]
    Range (min … max):   207.7 ms … 247.6 ms    50 runs

Building IdIndex:
    Time (mean ± σ):     855.0 ms ±  21.7 ms    [User: 788.4 ms, System: 66.6 ms]
    Range (min … max):   822.6 ms … 927.5 ms    50 runs

Building IdIndex, but hacked to store SmallVec<[u8; 20]>:
    Time (mean ± σ):     406.1 ms ±  15.9 ms    [User: 354.1 ms, System: 52.0 ms]
    Range (min … max):   382.2 ms … 428.6 ms    50 runs

For my "jj" work repo, changes are < ~1ms.
2023-01-26 14:10:26 +09:00
Yuya Nishihara
38a9180bb7 repo: generalize IdIndex over key and value types
Though we'll only need IdIndex<ChangeId, IndexPosition>, this allows us to
write unit tests without setting up MutableIndex.
2023-01-26 14:10:26 +09:00
Ilya Grigoriev
8c5a14d28a contributing.md: Add a link to the "Comprehensive Rust" course
This is something I wish I had when I first contributed to `jj`.
2023-01-25 21:10:10 -08:00
Martin von Zweigbergk
10725c095f cleanup: update more "checkout" to "working-copy commit" and similar
I've preferred "working-copy commit" over "checkout" for a while
because I think it's clearer, but there were lots of places still
using "checkout". I've left "checkout" in places where it refers to
the action of updating the working copy or the working-copy commit.
2023-01-25 11:02:59 -08:00
Martin von Zweigbergk
37ba17589d simple_op_heads_store: rename storage directory
`SimpleOpHeadsStore` currently stores its files in
`.jj/repo/op_heads/simple_op_heads/`. The `.jj/repo/op_heads/type`
file indicates the type of op-heads backend. If that contains
"simple_op_head_store", we use the `SimpleOpHeadsStore`
backend. There's no need for the `simple_op_heads` directory to also
indicate the type of backend in its name. I kept just the `heads` in
the name to make it less redundant with the parent directory (which is
`op_heads)`. We could alternatively call the directory `values` or
similar.
2023-01-25 09:22:38 -08:00
Martin von Zweigbergk
0d1ec835c1 repo: rename .jj/repo/store/backend to .jj/repo/store/type
We decided to call the files identifying the backend type `type`. We
already use that name for `OpStore` and `OpHeadsStore`.
2023-01-25 09:22:38 -08:00
dependabot[bot]
7f4e714ffe cargo: bump pest_derive from 2.5.3 to 2.5.4
Bumps [pest_derive](https://github.com/pest-parser/pest) from 2.5.3 to 2.5.4.
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.5.3...v2.5.4)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-25 07:49:05 -08:00