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

451 commits

Author SHA1 Message Date
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
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
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
Yuya Nishihara
218b1c6c16 commit_templater: add self.immutable() method
I don't know how immutable revisions should be labeled by default, but users
can customize templates whatever they like.
2024-03-14 22:59:43 +09:00
Martin von Zweigbergk
800f0f0347 squash: accept multiple --from revisions
Now you can do e.g. `jj squash --from 'foo+::' --into foo` to squash a
whole series into one commit. It doesn't need to be linear; you can
squash a bunch of siblings into another siblings, for example.
2024-03-13 05:21:05 -07:00
Martin von Zweigbergk
e579bbad0c log: enable synthetic elided nodes by default
We're early in the release cycle, so let's enable this feature and
test it for a while before the next release.
2024-03-11 10:08:28 -07:00
Martin von Zweigbergk
e9655dba13 move: deprecate the command
Per discussion in
https://github.com/martinvonz/jj/discussions/2882. `jj squash` now has
all the functionality.
2024-03-11 09:25:17 -07:00
Martin von Zweigbergk
e6ef217d90 squash: learn --from/--into flags
This was proposed by @Brixy in
https://github.com/martinvonz/jj/discussions/2882 a while ago. There
seems to be pretty strong consensus that it's a good idea.

I've copied the added test cases from `test_move_command.rs`, just
replacing `move` by `squash`, `--to` by `--into`, and deleting the
test of a no-arg invocation (`jj move` fails, `jj squash` does not -
it defaults to squashing into the parent).
2024-03-11 09:25:17 -07:00
Anton Älgmyr
099f06bf71 Add configuration options for node symbols in the graphs. 2024-03-09 21:16:58 +01:00
Martin von Zweigbergk
98baaf23d5 changelog: clarify that commit signing support is partial 2024-03-08 09:00:32 -08:00
Austin Seipp
7e28e19945 changelog: put entry in the right version section
Commit b4c4d911 introduced this entry in the changelog, but put it in the 0.15.0
section rather than the new unreleased section.

This was probably just because the original commit was authored before the
0.15.0 release, but merged after. Such is life.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2024-03-07 23:24:43 -06:00
dploch
b4c4d91190 cli_util: support multiple cli arguments for ui.default-command 2024-03-07 09:34:18 -05:00
Martin von Zweigbergk
bf76080f42 release: release version 0.15.1
This release is just so we can publish the crates to crates.io. We
couldn't publish the 0.15.0 crates because `jj-lib-proc-macros` had
`publish = false`.
2024-03-06 20:35:38 -08:00
Martin von Zweigbergk
462c19736a release: release version 0.15.0
Thanks to everyone who's contributed!
2024-03-06 14:10:58 -08:00
Aleksey Kuznetsov
38d14eafe2 cli: enrich the error about required template value with a hint
Several `jj` commands accept `--template <TEMPLATE>` argument. When the argument
is empty, `jj` will show the list of defined template aliases.
2024-03-06 08:12:40 +05:00
Yuya Nishihara
7ca6744432 cli: add "config list --template" support
There's a caveat: "jj config list -Tname" will concatenate all names in a
single line. That's correct but useless. We might want some option or config
knob to complete missing "\n". This also applies to "log --no-graph".
2024-03-06 11:38:57 +09:00
Thomas Castiglione
d661f59f9d working_copy: implement symlinks on windows with a helper function
enables symlink tests on windows, ignoring failures due to disabled developer mode,
and updates windows.md
2024-03-05 15:16:38 +08:00
Anton Älgmyr
38b27de8e3 Add --context flag for diffs.
Allows specifying the number of lines of context to show around diffs.
The logic was already in place, just some plumbing was needed.
2024-03-05 07:48:23 +01:00
Austin Seipp
6aa2ac34f5 changelog: minor copy edits
Seen while reading over the changelog in preparation for the release this week.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2024-03-04 14:15:13 -06:00
Yuya Nishihara
7ce25f8408 cli: add --tool=<name> option to diff/merge editing commands
I didn't add e2e tests to all commands, but the added tests should cover
diff_editor/diff_selector/merge_editor() calls.

Closes #2575
2024-03-04 01:33:43 +09:00
Yuya Nishihara
8d0414549b cli: unblock "jj git init --colocate" in existing Git repo directory
I'm not sure what's the conclusion in #2747, but I don't think there is a
disagreement on allowing --colocate to import existing Git repo.
2024-02-28 09:03:16 +09:00
Paulo Coelho
e9243a7638 cli branch list: list tracked branches
Add an option to list tracked branches only

This option keeps most of the current `--all` printing logic, but:

- Omits local Git-tracking branches by default (can be extended to
  support filtering by remote).
- Skip over the branch altogether if it doesn't contain tracked remotes
- Don't print the untracked_remote_refs at the end

Usage:

`jj branch list -t`
`jj branch list --tracked`
`jj branch list --tracked <branch name>`
2024-02-26 01:05:07 +00:00
Martin von Zweigbergk
b695fa1d82 cli: make rebase --skip-empty keep already empty commits
I think the user usually wants to abandon only newly empty commits. I
think they should use `jj abandon` if they want to get rid of already
empty commits. By keeping already empty commits, we don't need to
special-case the working copy and merge commits.
2024-02-25 16:39:05 -08:00
Yuya Nishihara
7525fac12a templater: add special "self" variable to refer to top-level object
This allows us to call alias function with the top-level object.

For convenience, all self.<method>()s are available as keywords. I don't think
we'll want to deprecate them. It would be tedious if we had to specify
-T'self.commit_id()' instead of -Tcommit_id.
2024-02-25 09:01:04 +09:00
Yuya Nishihara
62f0cb8c3f cli: change default log revset to not include all tagged heads
The default immutable_heads() includes tags(), which makes sense, but computing
heads(tags()) can be expensive because the tags() set is usually sparse. For
example, "jj bench revset 'heads(tags())'" took 157ms in my linux stable
mirror. We can of course optimize the heads evaluation by using bit set or
segmented index, but the query includes many historical heads if the repository
has per-release branches, which are uninteresting anyway. So, this patch
replaces heads(immutable_heads()) with trunk().

The reason we include heads(immutable_heads()) is to mitigate the following
problem. Suppose trunk() is the branch to be based off, I think using trunk()
here is pretty good.

```
A   B
*---*----* trunk() ⊆ immutable_heads()
     \
      * C
```
https://github.com/martinvonz/jj/pull/2247#discussion_r1335078879
2024-02-23 00:25:58 +09:00
Julien Vincent
431a4effa0 sign: Update CHANGELOG.md 2024-02-20 00:02:08 +00:00
Martin von Zweigbergk
a898847333 cli: make jj rebase not simplify ancestor merges
I think I prefer this behavior because it's less lossy. The user can
manually simplify the history with `jj rebase -s <merge commit> -d
<one of the parents>` afterwards. We can roll this change back later
if we find it annoying.
2024-02-19 14:20:18 -08:00
Martin von Zweigbergk
3f1d75f518 rewrite: default to not simplifying ancestor merges
This means auto-rebase will no longer simplify ancestor merges.
2024-02-19 14:20:18 -08:00
Alexis (Poliorcetics) Bourget
c75230747a completion: Add support for Nushell completions 2024-02-18 19:08:38 +01:00
Alexis (Poliorcetics) Bourget
b533cdc538 feat(cli): Add -f/-t for --from/--to to jj move 2024-02-18 18:58:48 +01:00
Alexis (Poliorcetics) Bourget
0fc5005b8a cli: rename --verbose to --debug to better fit what it does 2024-02-18 18:45:48 +01:00
Vladimir Petrzhikovskii
06d67f02d8 cli: list new remote branches during git fetch 2024-02-18 17:36:01 +01:00
Martin von Zweigbergk
866e862ab0 cli: make new workspace inherit sparse pattern from old workspace 2024-02-17 10:17:38 -08:00
Yuya Nishihara
815437598f revset: disable parsing rules of legacy dag range operator
The legacy parsing rules are turned into compatibility errors. The x:y rule
is temporarily enabled when parsing string patterns. It's weird, but we can't
isolate the parsing function because a string pattern may be defined in an
alias.
2024-02-14 10:04:56 +09:00
Martin von Zweigbergk
27017914e2 log: optionally render elided parts of the graph as a synthetic node
This adds a config to render a synthetic node with a "(elided
revisions)" description for elided segments of the graph.

I didn't add any templating support for the elided nodes because I'm
not sure how we would want that to work. In particular, I don't know
what `commit_id` and most other keywords should return for elided
revisions.
2024-02-12 17:33:55 -08:00