Commit graph

3130 commits

Author SHA1 Message Date
dependabot[bot]
a26bf965a5 cargo: bump serde from 1.0.153 to 1.0.154
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.153 to 1.0.154.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.153...v1.0.154)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-09 08:23:54 -08:00
dependabot[bot]
87c44f454d cargo: bump libc from 0.2.139 to 0.2.140
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.139 to 0.2.140.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.139...0.2.140)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-09 08:23:37 -08:00
dependabot[bot]
f422068d62 cargo: bump serde from 1.0.152 to 1.0.153
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.152 to 1.0.153.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.152...v1.0.153)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-08 09:20:54 -08:00
Yuya Nishihara
6af265a388 templater: move Box::new() wrapping to language.wrap_() functions
Now all callers do wrap_<type>(Box::new(...)), so its responsibility can be
moved to the callee without extra boxing.
2023-03-08 16:14:24 +09:00
Yuya Nishihara
96f4d8798c templater: remove redundant TemplateProperty wrapping from method chaining
TemplateFunction takes a property and a function to apply to the property
value. That's exactly what a method call does.
2023-03-08 16:14:24 +09:00
dependabot[bot]
4e7430a81a cargo: bump pest_derive from 2.5.5 to 2.5.6
Bumps [pest_derive](https://github.com/pest-parser/pest) from 2.5.5 to 2.5.6.
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.5.5...v2.5.6)

---
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-03-07 17:32:21 +01:00
Martin von Zweigbergk
e509a299e5 cli: print commands in alphabetical order
Until https://github.com/clap-rs/clap/issues/1553 is fixed, I don't
think we can do better than alphabetical order (without a lot of
work).
2023-03-06 21:35:34 -08:00
Yuya Nishihara
4984e611f4 templater: add "parent_commit_ids" keyword
A list type isn't so useful without a map operation, but List<CommitId>
is at least printable. Maybe we can experiment with it to craft a map
operation.

If a map operation is introduced, this keyword might be replaced with
"parents.map(|commit| commit.commit_id)", where parents is of List<Commit>
type, and the .map() method will probably return List<Template>.
2023-03-07 11:33:15 +09:00
Yuya Nishihara
0b27f8371a templater: make Literal(str) or str usable as a template 2023-03-07 11:33:15 +09:00
Yuya Nishihara
7b206e6fb5 templater: add helper to format template properties with separator
contents will be an Iterator<Item = &P> where P is a Template<()>.
2023-03-07 11:33:15 +09:00
dependabot[bot]
7da0994d58 cargo: bump thiserror from 1.0.38 to 1.0.39
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.38 to 1.0.39.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.38...1.0.39)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-06 18:48:04 +00:00
dependabot[bot]
ee7b9dc030 cargo: bump serde_json from 1.0.93 to 1.0.94
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.93 to 1.0.94.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.93...v1.0.94)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-06 10:26:35 -08:00
dependabot[bot]
1656117e6a cargo: bump pest from 2.5.5 to 2.5.6
Bumps [pest](https://github.com/pest-parser/pest) from 2.5.5 to 2.5.6.
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.5.5...v2.5.6)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-06 10:20:09 -08:00
tp-woven
39cbabf58e Clarify that files() is relative 2023-03-06 13:54:38 +09:00
Samuel Tardieu
decca920c7 git push: do not consider @- if @ has non-empty content or description 2023-03-05 23:50:20 +01:00
Samuel Tardieu
616058c2fa lib: add Commit::is_discardable() 2023-03-05 23:50:20 +01:00
Yuya Nishihara
5d184e6694 cli: in "show" template, indent description like Git does 2023-03-04 12:10:53 +09:00
Yuya Nishihara
8f8a9c91bc templater: add indent(prefix, content) function
The argument order is different from Mercurial's indent() function. I think
indent(prefix, content) is more readable for lengthy content. However,
indent(content, prefix, ...) might be better if we want to add an optional
firstline_prefix argument.
2023-03-04 12:10:53 +09:00
Yuya Nishihara
558aa15e6e templater: remove Template::has_content() superseded by FormatRecorder 2023-03-04 12:10:53 +09:00
Yuya Nishihara
974a5145e0 templater: reimplement separate() by using buffered formatter
template.format(context, &mut recorder) wouldn't fail right now, but we
might add a runtime template error in future. So I added error handling there.
2023-03-04 12:10:53 +09:00
Yuya Nishihara
233d37f678 formatter: add buffer that records both data and push/pop_label() calls
Template functions like indent() or fill() need to manipulate labeled
output. Since indent() is line oriented, it could be implemented as a
post-processing filter. OTOH, fill()/wrap() inserts additional "\n"s. If we
do that as a post process, colorized text could be split into multiple lines,
and would mess up graph log output. By using FormatRecorder, we can apply
text formatting in between labels.

I thought we could disallow text wrapping of labeled template fragments, but
the example in #1043 suggests that we do want to wrap(whole_template_output)
rather than simple description.wrap().
2023-03-04 12:10:53 +09:00
Yuya Nishihara
8f9bc4e7a6 revset: ignore all ascii whitespace characters 2023-03-04 00:01:54 +09:00
Yuya Nishihara
39d3420694 templater: ignore all ascii whitespace characters
Per Rust/WhatWG definition.
https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_whitespace
2023-03-04 00:01:54 +09:00
Yuya Nishihara
224edd73ee templater: parse "\t" and "\r" as escape sequence 2023-03-04 00:01:54 +09:00
Yuya Nishihara
d9ed2895db templater: rewrite syntax tests to not build evaluation object
Now we have AST objects, so we don't need to evaluate integer literal to
test parsing results.
2023-03-04 00:01:54 +09:00
Vamsi Avula
33aad56464 template: allow tab as whitespace (along with the current space and newline)
My jjconfig is otherwise all indented with tabs and it helps for my
template-aliases to be indented the same way too.
2023-03-03 12:06:13 +05:30
Martin von Zweigbergk
ba94f58d7e index_store: remove unused reinit() function 2023-03-02 12:33:11 -08:00
Martin von Zweigbergk
94bdbb7ff7 index: make IndexStore factory functions take &Path
This is just for consistency with the other backends.
2023-03-02 12:33:11 -08:00
Martin von Zweigbergk
da1c259211 index_store: use custom error type for write errors
Public APIs should use custom error types (not `io::Error` as
here). The caller isn't affected by this commit because it just
unwraps the error.
2023-03-02 12:33:11 -08:00
Martin von Zweigbergk
2cc15f40ef store: remove obsolete comment about root commit
The commit backends are responsible defining the root commit since
5ab2854df6.
2023-03-02 12:33:11 -08:00
Samuel Tardieu
d4b13d7495 git: use our own default refspec 2023-03-02 10:09:08 +01:00
Samuel Tardieu
5ecdeed606 git: only consider references matching globs when fetching 2023-03-02 10:09:08 +01:00
Samuel Tardieu
182919ff6f git: add function to import a selection of the git refs 2023-03-02 10:09:08 +01:00
Samuel Tardieu
0ca4e2dad2 git: absence of globs is None rather than &[]
In `git_fetch()`, any glob present in `globs` is an "allow" mark. Using
`&[]` to represent an "allow-all" may be misleading, as it could
indicate that no branch (only the git HEAD) should be fetched.

By using an `Option<&[&str]>`, it is clearer that `None` means that
all branches are fetched.
2023-03-02 10:09:08 +01:00
Samuel Tardieu
6fd65cca30 git: use &[&str] instead of &[String]
Using &[String] forces the caller to materalize owned strings if they
have only references, which is costly. Using &[&str] makes it cheap
if the caller owns strings as well.
2023-03-02 10:09:08 +01:00
Yuya Nishihara
681944954e docs: document template syntax, keywords and methods
Not all keywords and methods have description, but I think the function
signature should help understand the behavior.
2023-03-02 15:31:19 +09:00
Martin von Zweigbergk
e3a96177f7 docs: Update section about support for .gitignores
Issues #65 and #87 were both fixed almost a year ago.
2023-03-01 18:03:31 -08:00
dependabot[bot]
5321201a8a github: bump cachix/install-nix-action from 19 to 20
Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 19 to 20.
- [Release notes](https://github.com/cachix/install-nix-action/releases)
- [Commits](5c11eae19d...29bd9290ef)

---
updated-dependencies:
- dependency-name: cachix/install-nix-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-02 00:02:57 +01:00
dependabot[bot]
379739a244 cargo: bump toml_edit from 0.19.1 to 0.19.4
Bumps [toml_edit](https://github.com/ordian/toml_edit) from 0.19.1 to 0.19.4.
- [Release notes](https://github.com/ordian/toml_edit/releases)
- [Commits](https://github.com/ordian/toml_edit/compare/v0.19.1...v0.19.4)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-02 00:02:22 +01:00
Yuya Nishihara
66458a097e templater: require infix ++ operator to concatenate expressions
This eliminates ambiguous parsing between "func()" and "expr ()".

I chose "++" as template concatenation operator in case we want to add
bit-wise negate operator. It's also easier to find/replace than "~".
2023-03-01 16:39:23 +09:00
Yuya Nishihara
fd27d228ed templater: add concat(contents..) function, migrate default templates
Multi-line templates looked a bit ugly if I replaced all implicit concats
with ++ operations.
2023-03-01 16:39:23 +09:00
Yuya Nishihara
433623c138 cli: use separate(" ") to concatenate fields in default templates
Here we know each field will never be empty, but separate(" ", foo, bar)
looks slightly better than 'foo ++ " " ++ bar'. Implicit template concatenation
will be disabled soon.
2023-03-01 16:39:23 +09:00
Yuya Nishihara
6bbf4c6fcf tests: extract log template function/variable for code readability
Also rewrites some lengthy templates. That's why the test output slightly
changed.
2023-03-01 16:39:23 +09:00
David Barnett
99cb0ba7c5 Implement "config set" subcommand
Uses toml_edit to support simple config edits like:
  jj config set --repo user.email "somebody@example.com"
2023-02-28 18:18:02 -08:00
Martin von Zweigbergk
bbd6ef0c7b revset: remove filter_by_diff(), have caller intersect expression
To be able to make e.g. `jj log some/path` perform well on cloud-based
repos, a custom revset engine needs to be able to see the paths to
filter by. That way it is able pass those to a server-side index. This
commit helps with that by effectively converting `jj log -r foo
some/path` into `jj log -r 'foo & file(some/path)'`.
2023-02-28 17:45:34 -08:00
dependabot[bot]
26597ba61a cargo: bump prost-build from 0.11.7 to 0.11.8
Bumps [prost-build](https://github.com/tokio-rs/prost) from 0.11.7 to 0.11.8.
- [Release notes](https://github.com/tokio-rs/prost/releases)
- [Commits](https://github.com/tokio-rs/prost/commits/v0.11.8)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-28 16:13:14 +00:00
Martin von Zweigbergk
fd6c7f3bb3 op_heads_store: let caller create initial operation
It makes the APIs much simpler if we don't have to pass in information
about the initial operation when we create the `OpHeadsStore`. It also
makes the alternative `OpHeadsStore` implementations simpler since we
move some logic into a shared location (`ReadonlyRepo::init()`).

This effectively undoes ec07104126. Maybe some further refactoring
made it possible to move it back as I'm doing in this commit?
2023-02-28 08:08:31 -08:00
Yuya Nishihara
bab13e1982 cli: snapshot stale working copy before updating
Since there's no easy API to snapshot the stale working copy without releasing
the lock, we have to compare the tree ids after reacquiring the lock. We could
instead manually snapshot and rebase the working-copy commit, but that would
require more copy-paste codes.

Closes #1310
2023-02-28 12:59:30 +09:00
Yuya Nishihara
34a2b4a46d tests: add test for update-stale without dirty working copy
test_workspaces_updated_by_other() is a simplified version of
test_workspaces_conflicting_edits().
2023-02-28 12:59:30 +09:00
Yuya Nishihara
9dc069eeec tests: include divergence label in update-stale snapshots 2023-02-28 12:59:30 +09:00