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

468 commits

Author SHA1 Message Date
Ilya Grigoriev
0d0f8af05d docs CLI reference: explain that argument help is truncated
Perhaps this will help with issues like
https://github.com/martinvonz/jj/issues/3667
2024-05-15 09:45:40 -07:00
Ilya Grigoriev
c9b44f3828 docs: ask MkDocs to fail on links to non-existent sections
This also requires anchors to be lower-cased: https://github.com/mkdocs/mkdocs/issues/3703
2024-05-14 13:14:27 -07:00
tinger
d0a29a831d cli: add ui.color = "debug"
When using `ui.color = "debug"`, changes in the output style
additionally include delimiters << and >>, as well as all active labels
at this point separated by ::. The output is otherwise unformatted and
the delimiters and labels inherit the style of the content they apply
to.
2024-05-11 10:16:09 +02:00
Yuya Nishihara
8e4f75552d templater: add tracking methods to remote RefName
More tests will be added later as "branch list" templates.

In "log" template, we might want to see the number of "local" commits ahead
of any tracked remotes. It can be implemented later in a similar way (or as a
nested remote_refs list.)
2024-05-10 08:36:38 +09:00
Yuya Nishihara
9a5b001d58 templater: add SizeHint type to represent revset.count_estimate() value
We'll probably add binary comparison operators at some point, but this patch
also adds size_hint.zero() method. Otherwise, we'll have to write
"if(x.upper() && x.upper() == 0, ..)" to deal with None.

The resulting "branch list" template will look like:
```
separate(", ",
  if(!ref.tracking_ahead_count().zero(),
    if(ref.tracking_ahead_count().exact(),
      "ahead by " ++ ref.tracking_ahead_count().exact() ++ " commits",
      "ahead by at least " ++ ref.tracking_ahead_count().lower() ++ " commits")),
  if(!ref.tracking_behind_count().zero(),
    if(ref.tracking_behind_count().exact(),
      "behind by " ++ ref.tracking_behind_count().exact() ++ " commits",
      "behind by at least " ++ ref.tracking_behind_count().lower() ++ " commits")),
)
```
2024-05-09 08:51:34 +09:00
Ilya Grigoriev
9be159342c config.md: advertise diffedit3 as an alternative to meld-3 diff editor
This is instead of https://github.com/martinvonz/jj/pull/3292, which would make
`diffedit3` built into `jj`. I still have some hope of eventually making
`diffedit3` into the default diff editor that is available without any
configuration, which probably requires building it into `jj`, but this may not
happen, and it wouldn't hurt to test `diffedit3` first. Some examples of
concerns (see also the discussion in that PR):

- It is only a guess on my part that this would make a good default. The editor
might not be polished enough, and most users are not used to 3-pane diff
editing. I think most users would like it if they tried it, but this might be
plain wrong.

- There are concerns about adding a heavyweight dependency on `jj`. While I
tried to make it as lightweight as possible, it still unavoidably includes a web
server.

- There may be ways to bundle `diffedit3` with `jj` without combining them in a
single binary.
2024-05-08 11:38:41 -07:00
Ilya Grigoriev
638649b435 tutorial: edits to the diff editor explanation
Follows up on #3599. I also moved the discussion of other diff editors to a
footnote, as it didn't seem to fit well into the flow of the text.
2024-05-05 18:17:38 -07:00
Eidolon
3d898d0a06 Add default value of revsets.log to config docs
I wanted to have a reference point for the built-in revsets,
but `jj config get revsets.log` doesn't turn anything up since
it has special handling for the legacy config key
`ui.default-revset`. So I had to dig into the source code of jj
to get it.

I think it might help others to be able to reason about revsets
to have the log default shown in the settings documentation.
2024-05-05 07:17:32 -07:00
Yuya Nishihara
4db068e7f7 templater: expose RefTarget methods through RefName type
I considered adding RefTarget template type, but some of the methods naturally
fit to RefName. For example, a conflicted branch name is decorated as "??", so
it makes sense to add branch.conflict() instead of branch.target().conflict().

I'm not pretty sure how many RefName methods we'll need to add to port the
current branch listing, but there will be .tracked(), .tracking_local_present(),
.ahead_by(), and .behind_by().
2024-05-03 15:16:52 +09:00
Charles Crete
d9d60118a3 docs: update tutorial to include :builtin diff editor instructions 2024-05-02 23:04:40 -04:00
Jonathan Lorimer
e54e83b0f5 docs: Add information about configuring delta pager
docs: Add information about configuring delta pager

docs: only mention pager, not diff
2024-04-29 10:22:05 -07:00
Charles Crete
c8123e1555 docs: mention obslog in tutorial 2024-04-29 08:40:05 -07:00
Noah Mayr
dc693e7b8f template: add contained_in method to commit object in templates
this allows to conditionally display or label elements depending on 
whether the given commit is contained within the revset
2024-04-29 12:16:42 +02:00
Benjamin Tan
f75461efc1 rebase: add --insert-after and --insert-before options for --revisions 2024-04-29 14:19:09 +08:00
Théo Daron
2f45a482a6 fixed usage of old "checkout" command in contributing docs 2024-04-25 09:11:52 -07:00
Yuya Nishihara
5b769c5c9e fileset, revset, templater: add support for single-quoted raw string literals
Since fileset/revset/template expressions are specified as command-line
arguments, it's sometimes convenient to use single quotes instead of double
quotes. Various scripting languages parse single-quoted strings in various ways,
but I choose the TOML rule because it's simple and practically useful. TOML is
our config language, so copying the TOML syntax would be less surprising than
borrowing it from another language.

https://github.com/toml-lang/toml/issues/188
2024-04-25 11:14:33 +09:00
Martin von Zweigbergk
3dad9d4a98 docs: make "Arch Linux" a subheading under "Linux"
I think this is how it was supposed to be. The "From Source" section
applies to non-Arch Linuxes too.
2024-04-24 09:22:51 -07:00
Rowan Walsh
16ffe9408c Fixes grammar issues in docs 2024-04-24 09:12:37 -07:00
Rowan Walsh
1490c0a196 Fixes typo in docs 2024-04-24 09:12:37 -07:00
Yuya Nishihara
528ccb318e fileset: fall back to bare pattern/string if no operator-like character found
While I like strict parsing, it's not uncommon that we have to deal with file
names containing spaces, and doubly-quoted strings such as '"Foo Bar"' look
ugly. So, this patch adds an exception that accepts top-level bare strings.
This parsing rule is specific to command arguments, and won't be enabled when
loading fileset aliases.
2024-04-24 12:02:07 +09:00
Ilya Grigoriev
77eaf67f96 revsets.md: document the all: prefix modifier for revsets
While this is arguably not part of the revset language, this
is a likely place for a user to look.

See https://discord.com/channels/968932220549103686/968932220549103689/1228065431281995837
2024-04-20 14:12:26 -07:00
Austin Seipp
493020c0a6 docs: add an entry for snapshot.max-new-file-size
This was not documented, for some reason.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Change-Id: I01a86a2d62b225c0175ed690fe9966ed22c92745
2024-04-19 13:03:24 -05:00
Philip Metzger
3ac61a4984 docs: Replace some mentions of jj co with jj new.
Also move some sentences away from "check out" to "create a new revision ...",
even if it isn't the phrasing we want.

Fixes #3487
2024-04-19 18:03:22 +02:00
Yuya Nishihara
4474577ceb fileset: parse cwd/root-glob patterns
Mercurial appears to resolve cwd-relative path first, so "glob:*.c" could be
parsed as "**/*.c" if cwd was literally "**". It wouldn't practically matter,
but isn't correct. Instead, jj's parser first splits glob into literal part
and pattern. That's mainly because we want to parse the user input texts into
type-safe objects, and (RepoPathBuf, glob::Pattern) pairs are the simplest
ones. The current parser can't handle patterns like "foo/*/.." (= "foo" ?),
and errors out. I believe this restriction is acceptable.

Unlike literal paths, the 'glob:' pattern anchors to the whole file path. I
don't think "prefix"-matching glob is useful, and making it the default would
be rather confusing.
2024-04-18 11:09:54 +09:00
Martin von Zweigbergk
0525dc9d86 politics: delete references to Pijul
The Pijul maintainer has opinions that I don't understand about how we
mention Pijul (they consider the current mentions offensive as
"bashing Pijul"). Let's just remove the references so we don't have to
deal with it. I think the references to Darcs we already had in most
of these places are sufficient.
2024-04-14 13:16:08 -07:00
Yuya Nishihara
30984dae4a cli: if enabled, parse path arguments as fileset expressions
If this doesn't work out, maybe we can try one of these:
 a. fall back to bare file name if expression doesn't contain any operator-like
    characters (e.g. "f(x" is an error, but "f x" can be parsed as bare string)
 b. introduce command-line flag to opt in (e.g. -e FILESET)
 c. introduce pattern prefix to opt in (e.g. set:FILESET)

Closes #3239, #2915, #2286
2024-04-12 11:36:40 +09:00
Yuya Nishihara
a9694cba27 cli: add ui.allow-filesets to experiment with fileset/pattern syntax
The pattern syntax could be enabled unconditionally, but I want to fully
replace the ad-hoc pattern parsing function.
2024-04-12 11:36:40 +09:00
Ilya Grigoriev
8fa256ebac New jj debug watchman status command
This command checks not only whether Watchman works, but also whether
it's enabled in the config. Also, the output is easier to understand
than that of the other `jj debug watchman` commands.

It would be nice if `jj debug watchman` called `jj debug watchman
status`, but it's not trivial in `clap` to have a default subcommand.
2024-04-11 10:55:59 -07:00
Ilya Grigoriev
383711fcd8 config docs: document valid fsmonitor values
I was wondering how to disable the watchman in a repo if it's enabled in
the user config.
2024-04-11 10:55:59 -07:00
Yuya Nishihara
653173abad fileset: implement name resolution stage, add all()/none() functions
#3239
2024-04-09 20:42:09 +09:00
Anton Bulakh
29729e844d templater: Add operation.snapshot() boolean
Expose the information we now record, to allow changing the default "snapshot
working copy" message or to make snapshots more compact/less distracting in
the log
2024-04-07 19:46:52 +03:00
Yuya Nishihara
8b32a8a916 revset: add support for file(kind:pattern) syntax
There are no more callers of parse_function_argument_to_string(), so it's
removed. This function was a thin wrapper of literal parser, and can be
easily reintroduced if needed.
2024-04-07 19:43:29 +09:00
Yuya Nishihara
850887cf09 fileset: add basic pattern parsing functions
Naming convention is described in FilePattern::from_str_kind(). It's based
on Mercurial's pattern prefixes, but hopefully fixes some inconsistencies.
https://github.com/martinvonz/jj/issues/2915#issuecomment-1956401114

#3239
2024-04-07 19:43:29 +09:00
Austin Seipp
db14f33170 cli: add ui.always-allow-large-revsets option
This lets users use "large" revsets in commands such as `jj rebase`, without
needing the `all:` modifier.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Change-Id: Ica80927324f3d634413d3cc79fbc73057ccefd8a
2024-04-04 18:38:48 -05:00
Noah Mayr
2cf1c34f58 template: add method mine() to commit type 2024-04-04 22:47:34 +02:00
Martin von Zweigbergk
361b4ca425 docs: use command with argument as example for ui.default-command
Makes it easier to figure out how to pass arguments.
2024-04-04 11:19:07 -07:00
Noah Mayr
88a4a8281f cli: add better error message when immutable_heads() cannot be resolved 2024-04-03 07:58:00 +02:00
Noah Mayr
b79984884d cli: only use default log revset when neither path nor revset is provided 2024-04-03 07:57:06 +02:00
Patric Stout
e5b9e8ff58 docs: "bash" is no longer optional for command-line completion 2024-04-02 09:30:44 -07:00
Christoph Koehler
7bde6ddc29 revset: add working_copies() function
It includes the working copy commit of every workspace of the repo.

Implements #3384
2024-04-01 19:36:53 -06:00
Yuya Nishihara
a2a9b7decb templater: add coalesce() function that selects first non-empty content
This can be used to flatten nested "if()"s. It's not exactly the same as "case"
or "switch" expression, but works reasonably well in template. It's not uncommon
to show placeholder text in place of an empty content, and a nullish value
(e.g. empty string, list, option) is usually rendered as an empty text.
2024-03-28 10:51:47 +09:00
Yuya Nishihara
b363e695e4 commit_templater: make git_head return Option<RefName> instead of Vec<_>
Since we've introduced Option type, it no longer makes sense that git_head
returns a Vec<RefName>.
2024-03-26 00:28:43 +09:00
Yuya Nishihara
96e0bc0bdd templater: turn logical && and || into short-circuiting operators
Since the context (or self) property is no longer passed by argument, it's easy
to implement short-circuiting behavior.
2024-03-25 11:15:18 +09:00
Yuya Nishihara
c311131ee2 log: encode elided node as None
Since elided graph entry has no associated commits, it makes some sense to
represent as None?
2024-03-24 10:32:15 +09:00
Yuya Nishihara
2fc7febaef commit_templater: teach elidable (or optional) commit
I think Option<Commit> is the simplest encoding of the log node.

The behavior of an Option type is closer to nullable types rather than the
Option in Rust. I don't think we would want to write opt.map(|x| x.f()) or
opt.unwrap().f(). We can of course add opt?.f() syntax, but it will be a short
for "if(opt, opt.f())"?
2024-03-24 10:32:15 +09:00
Anton Älgmyr
e2eb5bddf9 Make node symbols templatable in the graphs.
Adds config options
* templates.log_graph_node
* templates.log_graph_node_elided
* templates.op_log_graph_node
2024-03-21 17:41:31 +01:00
Martin von Zweigbergk
e51878f4fd cli: show timestamp in local timezone and without millis and offset
As discussed in #2900, the milliseconds are rarely useful, and it can
be confusing with different timezones because it makes harder to
compare timestamps.

I added an environment variable to control the timestamp in a
cross-platform way. I didn't document because it exists only for tests
(like `JJ_RANDOMNESS_SEED`).

Closes #2900
2024-03-20 07:54:08 -07:00
Matthew Davidson
e4053ead64 docs: Add missing "jj" to swap rebase example
`jj rebase -r C -d A; rebase -s B -d C` is missing the second jj.

Although it would be cool if jj had syntax to chain commands like this, so I could write a "swap" alias.
2024-03-19 05:58:52 -07:00
Tom Ward
933150d819 cli: allow colors in form #rrggbb
Changes the formatter to accept not only existing color names (such as "red" or
"green") but also those in the form #rrggbb, where rr, gg, and bb are two-digit
hexadecimal numbers. This allows much finer control over colors used.
2024-03-18 08:03:31 +00:00
Alexis (Poliorcetics) Bourget
f9f740b263 docs: mention the signing key can be a file path too 2024-03-15 20:34:08 +01:00