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

486 commits

Author SHA1 Message Date
Martin von Zweigbergk
e1d8705546 release: release version 0.17.1
This release includes a fix for a performance regression in `jj
status`.
2024-05-07 08:39:54 -07:00
Eric Roshan-Eisner
b67e198cde cli: status: only scan through mutable changes to find conflicts
Fixes #3628
2024-05-06 17:32:50 -07:00
Martin von Zweigbergk
19563fee74 release: release version 0.17.0
Thanks to everyone who's contributed!

Unlike previous releases, I went through the changelog entries and
reorganized them a bit.

We didn't have anything under "Deprecations" this time, but I moved
the heading after "Breaking changes" for next release. I think
breaking changes are more important because deprecations are just
about giving a heads up before it actually breaks.
2024-05-01 10:10:01 -07:00
Martin von Zweigbergk
09b960538a squash: don't rewrite commits that didn't change
Closes #3334
2024-04-30 20:03:57 -07:00
Yuya Nishihara
6a208e7af7 doc: fix typo of contained_in() template method 2024-04-29 22:56:44 +09: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
Benjamin Tan
6752402113 rebase: allow -r to accept multiple revisions 2024-04-26 23:51:52 +08:00
Martin von Zweigbergk
d13be927a8 cli: add global --ignore-immutable
Closes #3576
2024-04-26 06:13:15 -07:00
Yuya Nishihara
2bd6983003 templates: reimplement builtin_change_id_with_hidden_and_divergent_info alias
This helps extract commit_summary template as an alias function.
2024-04-26 16:56:35 +09: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
Austin Seipp
ddfdf5e357 cli: allow snapshot.max-new-file-size to be a raw u64
Previously, this command would work:

    jj --config-toml='snapshot.max-new-file-size="1"' st

And is equivalent to this:

    jj --config-toml='snapshot.max-new-file-size="1B"' st

But this would not work, despite looking like it should:

    jj --config-toml='snapshot.max-new-file-size=1' st

This is extremely confusing for users.

This config value is deserialized via serde; and while the `HumanByteSize`
struct allegedly implemented Serde's `visit_u64` method, it was not called by
the deserialize visitor. Strangely, adding an `visit_i64` method *did* work, but
then requires handling of overflow, etc. This is likely because TOML integers
are naturally specified in `i64`.

Instead, just don't bother with any of that; implement a `TryFrom<String>`
instance for `HumanByteSize` that uses `u64::from_str` to try parsing the string
immediately; *then* fall back to `parse_human_byte_size` if that doesn't work.
This not only fixes the behavior but, IMO, is much simpler to reason about; we
get our `Deserialize` instance for free from the `TryFrom` instance.

Finally, this adjusts the test for `max-new-file-size` to now use a raw integer
literal, to ensure it doesn't regress. (There are already in-crate tests for
parsing the human readable strings.)

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Change-Id: I8dafa2358d039ad1c07e9a512c1d10fed5845738
2024-04-19 13:03:24 -05:00
Evan Mesterhazy
fc49d35daa Fix empty files can't be selected in the builtin diff editor
This fixes several issues that made working with empty files difficult using
the builtin diff editor.

1. The scm-record library used for the editor expects each file to have at
least one section. For new empty files this should be a file mode section. jj
wasn't rendering this mode section, which prevented empty files from being
selected at all.

2. The scm-record library returns `SelectedContents::Absent` if the file has no
contents after the diff editor is invoked. This can be because of several
reasons: 1) the file is new and empty; 2) the file was empty before and is
still empty; 3) the file has been deleted. Perhaps this is a bug in scm-record
and it should return `SelectedContents::Unchanged` or
`SelectedContents::Present` if the file hasn't been deleted. Until this is
patched upstream, we can work around it by disambiguating these cases.

See https://github.com/arxanas/scm-record/issues/26 for the upstream bug.


Fixes #3016
2024-04-15 23:28:06 -04: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
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
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
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
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
Yuya Nishihara
d442cd872f revset: backport \-escapes parsing from templater 2024-04-08 00:37:25 +09:00
Yuya Nishihara
07d027193b cli: add support for file kind:pattern syntax
This is basically the same as string kind:pattern syntax in CLI. This will
hopefully be superseded by filesets, but I'm not sure if that will work out.
A file name is more likely to contain whitespaces, which will have to be
quoted as '"Documents and Settings"'.
2024-04-07 19:43:29 +09:00
Scott Olson
e22370c485 cli: support filtering by paths in status 2024-04-05 20:41:44 +01:00
Evan Mesterhazy
64e242ab3a Implement jj parallelize
Parallelize revisions by making them siblings

Running `jj parallelize 1::2` will transform the history like this:
```text
3
|             3
2            / \
|    ->     1   2
1            \ /
|             0
0
```

Each of the target revisions is rebased onto the parents of the root(s) of
the target revset (not to be confused with the repo root). The children of
the head(s) of the target revset are rebased onto the target revisions.

The target revset is the union of the REVISIONS arguments.

The target revset being parallelized must satisfy several conditions,
otherwise the command will fail.

1. The heads of the target revset must not have different children.
2. The roots of the target revset must not have different parents.
3. The parents of all target revisions except the roots must also be
   parallelized. This means that the target revisions must be connected.
2024-04-05 12:43:10 -04: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
Yuya Nishihara
69d38fbf96 docs: move new changelog entry to the unreleased section 2024-04-04 13:21:20 +09:00
Benjamin Tan
7e46cc13dc cli: print conflicted paths whenever the working copy is changed
This is disabled when the global `--quiet` flag is used.
2024-04-04 11:24:09 +08:00
Martin von Zweigbergk
2dcdc7fb3f release: release version 0.16.0
Thanks to everyone who's contributed!
2024-04-03 12:46:23 -07: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
Ilya Grigoriev
670e6ac62b cmd squash: alias --to for the --into flag
I keep typing `--to` since I'm used to `jj move` interface. It is
also shorter.

Currently, if I type `--to`, clap unhelpfully suggests whether I
meant `--tool`.
2024-04-02 18:32:39 -07:00
Yuya Nishihara
acf8a8e1b2 cli: unblock "branch list --all-remotes" with name patterns
Like -r/--revisions, it should be okay to filter synced/non-tracking remote
branches by name.

conflicts_with_all = "tracked" is redundant, so removed as well. The tracked
field declares that it conflicts with --all-remotes.
2024-04-03 08:59:29 +09: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
Evan Mesterhazy
976320726d Add a --siblings option to the jj split command
If the --siblings option is used, the target commit is split into two sibling
commits instead of parent and child commits. Any children of the original
commit will have both siblings as their new parents.


#2274
2024-04-01 19:22:47 -04:00
Martin von Zweigbergk
adf3b50209 cli: add a global --quiet flag, which silences status messages
Note that `jj resolve` already had its own `--quiet` flag. The output
with `--quiet` for that command got a lot quieter with the global
`--quiet` also taking effect. That seems reasonable to me.
2024-04-01 13:00:27 -07:00
Simon Wollwage
320f50e00f cli: rename --all to --all-remotes for branch list 2024-04-01 10:12:13 +09:00
Simon Wollwage
8eed08b8b6 cli: allow branch list to combine -r and -a 2024-03-31 23:37:22 +09:00
Yuya Nishihara
dcf75788e0 sparse: extract "set --reset" to subcommand
Since --reset conflicts with the other flags, "set --reset" seems odd.
2024-03-29 11:02:31 +09:00
Yuya Nishihara
28e4331787 sparse: extract "set --edit" to subcommand
Even though --edit can be combined with --add/--remove/--clear/--reset, I don't
think it's practically useful.
2024-03-29 11:02:31 +09:00
Yuya Nishihara
fff852f136 sparse: parse and print patterns as workspace-relative paths
Per comment in
https://github.com/martinvonz/jj/pull/3379#pullrequestreview-1963841604

Though cwd-relative path might be useful for --remove, I don't think that's
the common use case. The new behavior is consistent with --edit.
2024-03-29 11:02:31 +09:00
Austin Seipp
2d0b6560e8 cli: allow multiple -r options for duplicate/abandon
Commands like `new`, `duplicate`, and `abandon` can take multiple revset
arguments which results in their collective union. They take the revisions
directly as arguments. But for consistency with many other commands, they can
also take the `-r` argument, which is a no-op. However, due to the flag being
specified as a `bool`, the `-r` option can only be specified once, so e.g.
`abandon -r x -r y` often fails. I normally use `-r` for consistency and muscle
memory, so this bites me often.

Instead, use `clap::ArgAction::Count` in order to allow `-r` to be specified
multiple times. It remains unused, of course.

With this change, all the following invocations are equivalent. Before this
change, the second example would fail due to  giving `-r` multiple times.

    jj abandon x y
    jj abandon -r x -r y
    jj abandon -r 'x | y'

Note: `jj new` already supported this exact case actually, but it used an
awkward trick where it used `.overrides_with()` in order to override *itself* so
it could be specified multiple times. I believe this is a bit clearer.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Change-Id: Ib36cf81d46dae4f698f06d0a32e8fd3120bfb4a4
2024-03-28 15:29:47 -05: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
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
Simon Wollwage
63771d6e84 cli: add option to list only conflicted branches
As requested in #1471, I added a new flag for `jj branch list` to only show branches that are conflicted.

Adds a unit test to check for listing only conflicted branches and regenerates the cli output to incorporate the new flag.

Closes #1471

reformat
2024-03-23 22:04:14 +09:00
Benjamin Tan
3034dbba3f git-push: Display messages from remote
The implementation of sideband progress message printing is aligned with
Git's implementation. See
43072b4ca1/sideband.c (L178).

Closes #3236.
2024-03-23 20:17:04 +08:00
Aleksey Kuznetsov
011b20fdac changelog: fix a typo move than -> more than 2024-03-22 22:56:11 +05:00