Commit graph

5911 commits

Author SHA1 Message Date
Anton Älgmyr
2af590eb54 Add template aliases with node symbol configs. 2024-04-15 22:21:31 +02:00
dependabot[bot]
75a30123b5 cargo: bump the cargo-dependencies group with 4 updates
Bumps the cargo-dependencies group with 4 updates: [chrono](https://github.com/chronotope/chrono), [either](https://github.com/rayon-rs/either), [proc-macro2](https://github.com/dtolnay/proc-macro2) and [syn](https://github.com/dtolnay/syn).


Updates `chrono` from 0.4.37 to 0.4.38
- [Release notes](https://github.com/chronotope/chrono/releases)
- [Changelog](https://github.com/chronotope/chrono/blob/main/CHANGELOG.md)
- [Commits](https://github.com/chronotope/chrono/compare/v0.4.37...v0.4.38)

Updates `either` from 1.10.0 to 1.11.0
- [Commits](https://github.com/rayon-rs/either/compare/1.10.0...1.11.0)

Updates `proc-macro2` from 1.0.79 to 1.0.80
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.79...1.0.80)

Updates `syn` from 2.0.58 to 2.0.59
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.58...2.0.59)

---
updated-dependencies:
- dependency-name: chrono
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: either
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo-dependencies
- dependency-name: proc-macro2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-15 15:56:32 +00:00
Martin von Zweigbergk
0bbebaf4f9 rewrite: move calculation of set to rebase to MutableRepo
This lets us make `parent_mapping` private again.
2024-04-15 07:09:12 -07:00
Martin von Zweigbergk
53a0e23759 rewrite: move functions for updating refs to MutableRepo
The functions now depend only on `MutableRepo`, so I think they belong
on that type. This gets us closer to being able to make
`parent_mapping` private again.
2024-04-15 07:09:12 -07:00
Martin von Zweigbergk
f716116249 rewrite: remove unnecessary assertions
I think the recent refactorings (especially 9c382fd8c6) make it
pretty clear that `DescendantRebaser` will not attempt to rebase the
same commit twice, so I think we can remove the assertions. This
removes some of the places where `DescendantRebaser` reaches into
`MutableRepo`'s internals.
2024-04-15 07:09:12 -07:00
Martin von Zweigbergk
656250d6d0 rewrite: pass UserSettings into update_all_references()
With this change, `update_all_references()` only uses `self` to get to
`mut_repo`. I'll move the function onto `MutableRepo` next.
2024-04-15 07:09:12 -07:00
Martin von Zweigbergk
750002594e rewrite: inline and rewrite ref_target_update()
I rewrote `old_target` and `new_target` to more accurately represent
the change; the old target should be a normal (singleton) ref.
2024-04-15 07:09:12 -07:00
Martin von Zweigbergk
f696f5b727 rewrite: leverage root_id() helper on commit object 2024-04-15 07:09:12 -07:00
Evan Mesterhazy
0ef25bb4b6 Add a --use-destination-message option to jj squash
if `--use-destination-message/-u` is passed to `jj squash`, the resulting
revision will use the description of the destination revision and the
description(s) of the source revision(s) will be discarded.
2024-04-14 16:58:30 -04: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
aaa2025dfc git: on fetch, pin visible untracked remote refs
This implements the other workaround described in 57167cefda "git: on
import_refs(), don't abandon ancestors of newly fetched refs":

> I think there are two ways to fix the problem:
>  a. pin non-tracking remote branches just like local refs
>  b. pin newly fetched refs in addition to local refs
> This patch implements (b) because it's simpler and more obvious that the
> fetched commits would never be abandoned immediately.

The idea of (a) is that untracked remote branches are independent read-only
refs, and read-only branches shouldn't be rewritten implicitly. Once the
branch gets rewritten or abandoned by user, these remote refs will be hidden,
and won't be pinned anymore.

Since (a) effectively supersedes (b), this patch also removes the original
workaround.

Fixes #3495
2024-04-14 11:38:21 +09:00
Ilya Grigoriev
82c85ba754 docs: stop mentioning meld as the default diff editor
The default is now `:builtin`.
2024-04-12 21:47:17 -07:00
dependabot[bot]
d954a1c24c cargo: bump async-trait in the cargo-dependencies group
Bumps the cargo-dependencies group with 1 update: [async-trait](https://github.com/dtolnay/async-trait).


Updates `async-trait` from 0.1.79 to 0.1.80
- [Release notes](https://github.com/dtolnay/async-trait/releases)
- [Commits](https://github.com/dtolnay/async-trait/compare/0.1.79...0.1.80)

---
updated-dependencies:
- dependency-name: async-trait
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-13 11:33:48 +09:00
dploch
57a5d7dd64 cli_util: support multiple extensions consistently
If we ever implement some sort of ABI for dynamic extension loading, we'll need these underlying APIs to support multiple extensions, so we might as well do that first.
2024-04-12 14:07:33 -04:00
dependabot[bot]
35598f49de build(deps-dev): bump idna from 3.6 to 3.7
Bumps [idna](https://github.com/kjd/idna) from 3.6 to 3.7.
- [Release notes](https://github.com/kjd/idna/releases)
- [Changelog](https://github.com/kjd/idna/blob/master/HISTORY.rst)
- [Commits](https://github.com/kjd/idna/compare/v3.6...v3.7)

---
updated-dependencies:
- dependency-name: idna
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-12 21:13:24 +09: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
Evan Mesterhazy
65a525cfd9 Add a test for splitting the parent of a merge commit without --siblings
This is the same as the `test_split_siblings_with_merge_child` added in
https://github.com/martinvonz/jj/pull/3485, but without the siblings flag. I
forgot to add the non-siblings version in that PR.

#3485
2024-04-11 14:58:55 -04: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
Evan Mesterhazy
37be542ebf Fix a bug when the target of jj split has merge commit children
Ilya reported this in https://github.com/martinvonz/jj/issues/3483.

The bug was introduced in 976320726d.

Before this fix, `jj split` dropped any parents what weren't involved in the
split when it rebased the children of the commit being split. This meant that
any children which were merge commits lost their other parents unintentionally.

Fixes #3483
2024-04-11 13:26:07 -04:00
dependabot[bot]
a786802b40 cargo: bump the cargo-dependencies group with 3 updates
Bumps the cargo-dependencies group with 3 updates: [anyhow](https://github.com/dtolnay/anyhow), [clap_complete](https://github.com/clap-rs/clap) and [quote](https://github.com/dtolnay/quote).


Updates `anyhow` from 1.0.81 to 1.0.82
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.81...1.0.82)

Updates `clap_complete` from 4.5.1 to 4.5.2
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.1...clap_complete-v4.5.2)

Updates `quote` from 1.0.35 to 1.0.36
- [Release notes](https://github.com/dtolnay/quote/releases)
- [Commits](https://github.com/dtolnay/quote/compare/1.0.35...1.0.36)

---
updated-dependencies:
- dependency-name: anyhow
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: clap_complete
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: quote
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-10 11:53:42 -05:00
Yuya Nishihara
1bfacea2f9 cli: migrate "chmod" to matcher API, warn unmatched paths 2024-04-11 00:51:19 +09:00
Yuya Nishihara
ae70db843e cli: warn explicit paths not exist in either of diff trees
Maybe we can optimize it to check paths during diffing, but I think it's okay
to add extra lookup cost at the end. The size of the path arguments is usually
small.

Closes #505
2024-04-11 00:51:19 +09:00
Yuya Nishihara
33beb8d456 fileset: add recursive iterator over explicit paths
The primary use case is to warn unmatched paths. I originally thought paths in
negated expressions shouldn't be checked, but doing that seems rather
inconsistent than useful. For example, "~x" in "jj split '~x'" should match at
least one file to split to non-empty revisions.
2024-04-11 00:51:19 +09:00
Jeremy O'Brien
580a90b694 cli: fix typo in 'jj untrack --help' 2024-04-09 09:18:40 -07:00
Yuya Nishihara
05b0fb50f1 cli: add fileset utility functions and debug command
Path parsing will be migrated to parse_union_filesets(), but I haven't decided
how we'll go forward:
 a. migrate everything to fileset
 b. require flag like "-e FILESET" (note -p conflicts with log -p)
 c. require flag like "-e FILESET" and deprecate positional PATHs #2554
 d. require prefix like "set:FILESET" (not consistent with -r REVSET)

I'm currently dogfooding (a). It works for me, but I don't use exotic file
names that would require quoting in zsh.

#3239
2024-04-09 20:42:09 +09:00
Yuya Nishihara
57b423e3d7 fileset: relax identifier rule to accept more path-like strings
Since fileset is primarily used in CLI, it's better to avoid inner quoting if
possible. For example, ".." would have to be quoted in the original grammar
derived from the revset.

This patch also adds a stricter version of an identifier rule. If we add a
symbol alias, it will follow the "strict_identifier" rule.
2024-04-09 20:42:09 +09:00
Yuya Nishihara
653173abad fileset: implement name resolution stage, add all()/none() functions
#3239
2024-04-09 20:42:09 +09:00
Yuya Nishihara
9c28fe954c fileset: add grammar and implement parser (without name resolution)
The fileset grammar is basically a stripped-down version of the revset grammar,
with a few adjustments:

 * extract function call to "function" rule (like templater)
 * inline "symbol" rule (because "identifier" and "string" should be treated
   differently at the early parsing stage.)

The parser will have a separate name resolution stage. This will help to do
alias substitution properly. I'll probably rewrite the revset parser in the
same way. It will also help if we want to embed fileset expression in file()
revset.
2024-04-09 20:42:09 +09:00
Yuya Nishihara
521bcd81ab dsl_util: deduplicate collect_similar() from revset and templater
For convenience, sort and dedup are done by collect_similar().
2024-04-09 20:42:09 +09:00
Evan Mesterhazy
13592ce49e Make jj next work when the working copy is a merge commit 2024-04-08 14:52:11 -04:00
Evan Mesterhazy
d90a0ec246 Make jj prev work when the working copy is a merge commit
Before this commit `jj prev` fails if the current working copy commit is a
merge commit. After this commit it will prompt the user to choose the ancestor
they want to select.

#2126
2024-04-08 14:52:11 -04:00
Evan Mesterhazy
cc6d290679 Fix a few minor issues with the jj prev tests
This commit adds commit graphs to most of the tests for `jj prev` to make it
clearer where `@` points before and after `prev` is run.

In addition, there were a couple of tests where the comments suggested the test
meant to have `@` pointing to a specific commit, but it actually pointed to an
empty child of that commit.

This sort of issue also exists in `test_prev_editing`. The test is supposed to
check that `--edit` is implied if you run `jj prev` on an interior commit, but
it actually caused a new empty commit to be created since `@` was sitting on a
tip commit.
2024-04-08 09:12:19 -04:00
Evan Mesterhazy
379849b4b8 Fix documentation for RevsetExpression::ancestors_at and descendants_at
The current documentation is wrong. This is a follow up for
https://github.com/martinvonz/jj/pull/3461#discussion_r1555011289
2024-04-08 08:29:14 -04:00
Anton Bulakh
feaaa48ed0 templates: Change builtin_log_root to be consistent with other hooks 2024-04-07 19:46:52 +03:00
Anton Bulakh
0f2573abae templates: Split oplog template into hookable functions
This is to allow modifying default templates without completely overriding
them, for example to change the oplog snapshots but keep other defaults
2024-04-07 19:46:52 +03: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
Evan Mesterhazy
f4fb8f18a7 Update the documentation for jj next
This is to match the recent changes made to the docs for `jj prev`.
2024-04-07 12:21:35 -04:00
Evan Mesterhazy
506392703b Make a minor formatting change to the help page for jj parallelize
Per discussion on another PR, we're going to avoid ALL CAPS for argument names
in the documentation even though Clap uses that style for the `--help` output.

- https://github.com/martinvonz/jj/pull/3453#discussion_r1554169975
2024-04-07 12:20:19 -04:00
Evan Mesterhazy
c1920d765f Improve the documentation of jj prev
This will hopefully make it clear that `jj prev` does not
move by [OFFSET] relative to `@`, which is a misconception
that I had and I think others may also have.

I am suggesting this change as a result of the vigorous discussion in
these two issues:

- https://github.com/martinvonz/jj/issues/3426
- https://github.com/martinvonz/jj/pull/3445

We should make similar changes to `jj next` as well since
it follows similar rules.
2024-04-07 12:19:54 -04:00
Yuya Nishihara
73508730aa revset: rewrite identifier rule in common infix-op rule pattern
I don't remember why I made it defined recursively, but it's basically the
same as "primary ~ (infix_op ~ primary)*" rule.
2024-04-08 00:37:25 +09:00
Yuya Nishihara
7f1f73b0fa revset: move whitespace rule to top
The whitespace rule is a bit special, and it seemed weird that the rule is
defined between literals and operator tokens.
2024-04-08 00:37:25 +09:00
Yuya Nishihara
c8f93c50fc revset: remove redundant Result<..> from parse_symbol_rule_as_literal() 2024-04-08 00:37:25 +09:00
Yuya Nishihara
d442cd872f revset: backport \-escapes parsing from templater 2024-04-08 00:37:25 +09:00
Yuya Nishihara
d1ae2d72c8 revset: rename Rule::literal_string to string_literal 2024-04-08 00:37:25 +09:00
Yuya Nishihara
274183fa66 dsl_util: extract helper that parses string literal with \-escapes
The top-level assertion is removed since it's now obvious that the pair
represents a Rule::string_literal.
2024-04-08 00:37:25 +09:00
Yuya Nishihara
46b4c68325 templater: mark string literal as compound atomic, and integer as atomic
They aren't important because we don't use implicit whitespace rule, but let's
clarify they are atomic rules.

https://pest.rs/book/grammars/syntax.html#atomic
2024-04-08 00:37:25 +09:00
Yuya Nishihara
6039e9889c templater: rename string literal rules
This patch adds "string_" prefix to the related rules to discriminate them from
integer_literal. I also renamed "raw_literal" because it sounds like a raw
string literal that preserves backslash characters.
2024-04-08 00:37:25 +09:00
Yuya Nishihara
9b1eb03c73 cli: inline matcher_from_values() in favor of parse_file_patterns() 2024-04-07 19:43:29 +09:00