Commit graph

6 commits

Author SHA1 Message Date
Yuya Nishihara
8235e458ed cli: extract primitives for user revset parsing and evaluation
Some of them will be called directly from the commit templater which shouldn't
know WorkspaceCommandHelper. All parameters are passed as function arguments
instead of having a nicer wrapper struct. That's because some resources (e.g.
repo and id prefix context) are also used for different purposes, and it seemed
uneasy to introduce high-level abstraction satisfying all the use cases.
2024-03-14 22:59:43 +09:00
Yuya Nishihara
d0168199f0 templater: add general-purpose template engine for value types
This serves the role of the formatter in Mercurial, but the provided features
are rather restricted compared to mercurial.formatter. That's because both
implementation language "Rust" and jj's template language are statically typed.

The current implementation works well for simple commands like "config list -T",
but it might be not okay for "branch list -T". If we implement branch templating
by using the generic mechanism, the commit summary part would have to be
evaluated as a separate template:

  -T 'branch_name ++ target_commit_summary' (target_commit_summary: Template)

instead of

  -T 'branch_name ++ commit_summary(target_commit)' (target_commit: Commit)

where the branch template language is a superset of the commit template
language.
2024-03-06 11:38:57 +09:00
Yuya Nishihara
97024e5be4 cli: extract CommandError and helper functions to new module
The cli_util module is big enough to slow down Emacs, so let's split it up.
This change is an easy one.
2024-03-03 01:11:46 +09:00
Austin Seipp
bd110307ff cli: move some git utilities to new crate::git_utils
Gerrit also needs to be able to push low-level refs into upstream remotes, just
like `jj git push` does. Doing so requires providing callbacks e.g. for various
password entry mechanisms, which was private to the `git` command module.

Pull these out to a new module `git_utils` so we can reuse it across the two
call sites.

This also moves a few other strictly Git-related functions into `git_utils`
as well, just for the sake of consistency.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2024-01-20 15:58:37 -06:00
Antoine Cezar
afc2382833 cli: move description utils to description_util.rs 2023-11-06 17:49:02 +01:00
Austin Seipp
48fa821e60 cli: move src/ directory to new cli/ directory
Summary: In preparation for unifying all workspace dependencies across all
crates, let's go ahead and move the jj-cli crate into its own new directory.
This will also be a nicer and more uniform layout as we add new `jj-*` crates.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Change-Id: Icf94e7ae5f290dc8e181215727b38ada
2023-08-04 19:00:42 -05:00
Renamed from src/lib.rs (Browse further)