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
Yuya Nishihara
b7eb8ee438
cli: include command args in "snapshot working copy" op log
...
Since "import git refs" includes the args, there would be no point to exclude
snapshot_working_copy().
2023-02-28 12:59:30 +09:00
Yuya Nishihara
a81c78cf5a
tests: use template to filter out uninteresting parts from op log
2023-02-28 12:59:30 +09:00
dependabot[bot]
f633534fc7
github: bump github/codeql-action from 2.2.4 to 2.2.5
...
Bumps [github/codeql-action](https://github.com/github/codeql-action ) from 2.2.4 to 2.2.5.
- [Release notes](https://github.com/github/codeql-action/releases )
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md )
- [Commits](17573ee1cc...32dc499307
)
---
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>
2023-02-27 11:08:02 -08:00
dependabot[bot]
2f47934290
cargo: bump crossterm from 0.26.0 to 0.26.1
...
Bumps [crossterm](https://github.com/crossterm-rs/crossterm ) from 0.26.0 to 0.26.1.
- [Release notes](https://github.com/crossterm-rs/crossterm/releases )
- [Changelog](https://github.com/crossterm-rs/crossterm/blob/master/CHANGELOG.md )
- [Commits](https://github.com/crossterm-rs/crossterm/compare/0.26...0.26.1 )
---
updated-dependencies:
- dependency-name: crossterm
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2023-02-27 11:07:41 -08:00
dependabot[bot]
7de17ce4e7
cargo: bump tempfile from 3.3.0 to 3.4.0
...
Bumps [tempfile](https://github.com/Stebalien/tempfile ) from 3.3.0 to 3.4.0.
- [Release notes](https://github.com/Stebalien/tempfile/releases )
- [Changelog](https://github.com/Stebalien/tempfile/blob/master/NEWS )
- [Commits](https://github.com/Stebalien/tempfile/commits )
---
updated-dependencies:
- dependency-name: tempfile
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2023-02-27 11:06:51 -08:00
dependabot[bot]
b34daa9423
cargo: bump prost from 0.11.7 to 0.11.8
...
Bumps [prost](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
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2023-02-27 10:59:19 -08:00
Martin von Zweigbergk
4c5695f0cd
index_store: take OperationId when writing new index
...
By taking an `OperationId` argument to `IndexStore::write_index()`, we
can remove `associate_file_with_operation()` from the trait. That
simplifies the interace a little bit. The reason I noticed this was
that I'm trying to extract a trait for `IndexStore`, and the word
"file" in it is too specific for e.g. a cloud-based implementation.
2023-02-27 09:44:28 -08:00
Martin von Zweigbergk
346e3c849b
repo: propagate error when failing to look up backend type
2023-02-27 09:44:28 -08:00
Martin von Zweigbergk
011d9e3486
workspace: make WorkspaceLoader::load() return WorkspaceLoadError
...
I plan to make `RepoLoader::init()` return a `Result`, which means
that `WorkspaceLoader::load()` will need to return more kinds of
errors. Making it return `WorkspaceLoadError` is a good start. By also
extracting a function for converting `WorkspaceLoadError` to
`CommandError`, we can reuse a the handling of `PathError` in
`cli_util`.
2023-02-27 09:44:28 -08:00
Martin von Zweigbergk
ea6a238c7c
cli: avoid creating new WorkspaceLoader for jj config edit --repo
...
This is mostly about not having to handle errors twice (or document an
`unwrap()` after `WorkspaceLoader::init()`).
2023-02-27 09:44:28 -08:00
Martin von Zweigbergk
37e1ed403a
tests: add test of jj config edit --repo
outside of repo
...
I'm about to change the implementation a bit, so let's have a test for
it.
2023-02-27 09:44:28 -08:00
Martin von Zweigbergk
491ecc6b2e
repo: replace load_at_head() by helper in tests
...
I'm about to make `RepoLoader::init()` return a `Result`, and I don't
want to have to wrap that in a new error in
`ReadonlyRepo::load_at_head()` since that's only used in tests.
2023-02-27 09:44:28 -08:00
Samuel Tardieu
c5e41a99c3
git remote rename: rename git refs as well
2023-02-26 15:22:18 +01:00
Samuel Tardieu
b515d14f18
git_fetch: when removing a remote branch, remove git ref as well
2023-02-26 15:22:18 +01:00
Samuel Tardieu
1056cfa41a
test_git_fetch: make different remotes in test contain different commits
...
Using the same commits (and thus the same commit id) in multiple remotes
makes it harder to see what comes from where.
2023-02-24 20:29:03 +01:00
Yuya Nishihara
0b083b2ddb
conflicts: in materialize_merge_result(), always use adds.get(index)
...
I don't think this is more readable than the original code, but it gives
diff1/right1 and diff2/right2 pairs consistent names.
2023-02-24 19:58:10 +09:00
Yuya Nishihara
410be93339
conflicts: in materialize_merge_result(), borrow both adds/removes sides
...
Just for consistency.
2023-02-24 19:58:10 +09:00
Yuya Nishihara
da16bf340c
conflicts: fix off-by-one error in materialize_merge_result()
...
This should fix #1304 . I think the added test simulates the behavior of
multiple rebase conflicts, but I don't have expertise around this.
add_index could be replaced with a peekable iterator, but the iterator version
wouldn't be as readable as the current implementation.
2023-02-24 19:58:10 +09:00
dependabot[bot]
0224b52ffc
cargo: bump prost-build from 0.11.6 to 0.11.7
...
Bumps [prost-build](https://github.com/tokio-rs/prost ) from 0.11.6 to 0.11.7.
- [Release notes](https://github.com/tokio-rs/prost/releases )
- [Commits](https://github.com/tokio-rs/prost/commits )
---
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-24 11:55:41 +09:00
dependabot[bot]
bd16e96693
cargo: bump prost from 0.11.6 to 0.11.7
...
Bumps [prost](https://github.com/tokio-rs/prost ) from 0.11.6 to 0.11.7.
- [Release notes](https://github.com/tokio-rs/prost/releases )
- [Commits](https://github.com/tokio-rs/prost/commits )
---
updated-dependencies:
- dependency-name: prost
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2023-02-23 15:32:35 +00:00
Yuya Nishihara
bfbb7d1399
cli: on finish_transaction(), print check-out summary by caller
...
This makes sense because the status is also printed by caller.
2023-02-23 14:15:38 +09:00
Yuya Nishihara
1cb473ab2a
cli: on finish_transaction(), look up check-out commit by caller
...
So the caller can print a commit summary.
It's getting less clear why cli_util::update_working_copy() takes a repo
argument. It might be better to extract a helper struct that operates on
repo + workspace (minus CLI stuff), and move it to the lib crate.
2023-02-23 14:15:38 +09:00
Yuya Nishihara
3dd8b9a5f0
cli: extract update_working_copy() from finish_transaction()
...
I'll move some bits from the free update_working_copy() function to
deduplicate parse_commit_summary_template() call.
2023-02-23 14:15:38 +09:00
Yuya Nishihara
61d6604d3d
cli: add workspace_command.get_wc_commit_id() for short
...
We can't replace all callers, but I think it's common enough to add a helper
function.
2023-02-23 14:15:38 +09:00