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

518 commits

Author SHA1 Message Date
Théo Daron
db8f655fe5 changelog: fix @tdaron username 2024-06-06 10:30:08 +02:00
mlcui
f2da2074cc changelog: Fix @mlcui-corp username
I have renamed myself from @mlcui-google to @mlcui-corp, but the
changelog still had the old username.

(That username is now taken by a squatter...)
2024-06-06 14:11:14 +10:00
Austin Seipp
33ac9bca6c release: version 0.18.0 2024-06-05 18:09:20 -05:00
Michael Gattozzi
3bc361a8b9 cli: add --allow-empty-description flag to push
This commit adds an optional flag to be able to push commits with an
empty description to a remote git repo. While the default behavior is
ideal we might need to interact with a repo that has an empty commit
description in it. I ran into this issue a few weeks ago pushing commits
from an open source repo to an empty repo and had to go back to using
git for that push as I would not want to rewrite the history which was
many many years long just for that.

This flag allows users an escape hatch for pushing empty descriptions
for commits and they're sure that they want that behavior.

This commit adds the flag to the `git push` command and updates the docs
for the command. It also updates the original test to make sure that the
flag works as intended to reject the commit when not set and to allow
the commit when the flag is set.

Closes #2633
2024-06-05 14:58:36 -04:00
Benjamin Tan
a3c6a9b1b7 new: allow --insert-before and --insert-after simultaneously 2024-06-05 19:29:27 +08:00
Benjamin Tan
256a51f835 new: convert --insert-before and --insert-after into proper options 2024-06-05 19:29:27 +08:00
Danny Hooper
3050685ff3 cli: implement enough of jj fix to run a single tool on all files 2024-06-04 14:28:21 -05:00
Gregory Anders
f4bedf56f6 cli: clear line after writing
Clear the rest of the cursor line (from the cursor to the end of the
row) after drawing the progress bar rather than clearing the entire line
before drawing. This reduces flickering on terminal emulators which are
able to redraw rapidly.
2024-05-30 12:27:11 -05:00
Martin von Zweigbergk
3090adfd5c repo: consider empty and undescribed merge commits as discardable 2024-05-29 06:54:30 -07:00
Martin von Zweigbergk
e02622b143 repo: when abandoning a working copy that a merge, recreate it
I recently needed to test something on top of a two branches at the
same time, so I created a new commit on top of both of them (i.e. a
merge commit). I then ran tests and made some adjustments to the
code. These adjustments belonged in one of the parent branches, so I
used `jj squash --into` to squash it in there. Unfortunately, that
meant that my working copy became a single-parent commit based on one
of the branches only. We already had #2859 for tracking this issue.

This patch changes the behavior so we create a new working-copy commit
with all of the previous parents.
2024-05-29 06:54:30 -07:00
Ilya Grigoriev
8d3dd17b51 jj git push: safety checks in push negotiation, "force-with-lease"
As explained in the commit, our logic is a bit more complicated than
that of `git push --force-with-lease`. This is to match the behavior of
`jj git fetch` and branch conflict resolution rules.
2024-05-28 21:38:26 -07:00
Waleed Khan
a17292317c deps: upgrade scm-record from v0.2.0 to v0.3.0
See release notes at https://github.com/arxanas/scm-record/releases/tag/v0.3.0
2024-05-27 13:36:27 -07:00
Yuya Nishihara
02eb164dae config: migrate "config get"/"set" to TOML-based name argument parsing 2024-05-23 12:22:12 +09:00
Yuya Nishihara
ef8038f60f cli: config: leverage toml_edit::Value to serialize values
I use ValueKind::Ty(ref v) here because (*v).into() looked rather noisy.

Fixes #3374
2024-05-22 10:17:37 +09:00
Matt Stark
fa6f5e3880 Add the revsets mutable and immutable.
I add them as aliases, since a user may instead choose to define `immutable_heads()`, for example, as `heads(immutable())`, and the define `immutable()` instead.
2024-05-22 09:19:46 +10:00
Remo Senekowitsch
2a320b324c github: add linux-aarch64 build 2024-05-21 13:49:06 -05:00
dploch
d31edd4ac5 changelog: fix typo and move 'reachable' announcement to correct section 2024-05-21 10:51:48 -05:00
dploch
a49da4ad01 revset: implement a 'reachable(src, domain)' expression
This revset correctly implements "reachability" from a set of source commits following both parent and child edges as far as they can go within a domain set. This type of 'bfs' query is currently impossible to express with existing revset functions.
2024-05-21 10:52:31 -04:00
Thomas Castiglione
59d3a2c866 local_working_copy: when all sides of a conflict are executable, materialise the conflicted file as executable
Fixes #3579 and adds a testcase for an executable conflict treevalue.
2024-05-21 14:37:17 +08:00
Ilya Grigoriev
84007075d9 jj config list: escape keys
Fixes #1322. There may be more places where keys need escaping, I'm not
completely sure.
2024-05-20 22:39:56 -07:00
jyn
0d3e949439 give a warning when trying to redefine a built-in command
previously, aliases to built-in commands were silently ignored. this matches git's behavior, but seems unhelpful, especially if the user doesn't know that a command with that name already exists.
give a warning rather than silently ignoring it.
2024-05-17 16:50:54 +01:00
Théo Daron
0a48ac63cb cli: make jj branch track show conflicts 2024-05-17 12:21:10 +02:00
Théo Daron
b1fca954cf fix: changelog entry for PR #3600 2024-05-14 12:14:46 +02:00
Théo Daron
823041c795 cli: create new wc_commit when wc_commit become immuable 2024-05-14 08:53:11 +02: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
Alexander Potashev
07559f24ec Refuse to split an empty commit with jj split.
Rationale: The user may be confused by the empty diff in the diff editor
tool if they accidentally run `jj split` on a wrong (empty) commit.
2024-05-10 19:37:28 +02:00
Yuya Nishihara
12b873e1ef cli: port "branch list" to template
Perhaps, this can be used to generate parsable branches list.

The hint for deleted branches isn't migrated to the template. I'm thinking of
moving it out of the loop and printed once at the end. If we want to generate
a hint in template, we'll probably need local_ref.tracking_remote_refs(), etc.
that return a list of RefNames.
2024-05-10 08:36:38 +09:00
Martin von Zweigbergk
61e4e3627c
branching: merge v0.17.1 into main 2024-05-07 08:54:35 -07:00
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
Ilya Grigoriev
3cf521fb41 fixup to 70b517c: remove errant conflict marker 2024-05-05 19:24:37 -07:00
Ilya Grigoriev
70b517ca64 conflicts.rs: label conflict number and sides next to conflict markers
For example, 

```
<<<<<<< Conflict 1 of 3
+++++++ Contents of side #1
left 3.1
left 3.2
left 3.3
%%%%%%% Changes from base to side #2
-line 3
+right 3.1
>>>>>>>
```

or

```
<<<<<<< Conflict 1 of 1
%%%%%%% Changes from base to side #1
-line 3
+right 3.1
+++++++ Contents of side #2
left 3.1
left 3.2
left 3.3
>>>>>>>
```

Currently, there is no way to disable these, this is TODO for a future
PR. Other TODOs for future PRs: make these labels configurable. After
that, we could support a `diff3/git`-like conflict format as well, in
principle.

Counting conflicts helps with knowing whether you fixed all the
conflicts while you are in the editor.

While labeling "side #1", etc, does not tell you the commit id or
description as requested in #1176, I still think it's an improvement.
Most importantly, I hope this will make `jj`'s conflict format less
scary-looking for new users.

I've used this for a bit, and I like it. Without the labels, I would see
that the two conflicts have a different order of conflict markers, but I
wouldn't be able to remember what that means. For longer diffs, it can
be tricky for me to quickly tell that it's a diff as opposed to one of
the sides. This also creates some hope of being able to navigate a
conflict with more than 2 sides.

Another not-so-secret goal for this is explained in
https://github.com/martinvonz/jj/pull/3109#issuecomment-2014140627. The
idea is a little weird, but I *think* it could be helpful, and I'd like
to experiment with it.
2024-05-05 18:42:14 -07:00
Martin von Zweigbergk
f958957f9e cli: drop support for old ui.default-revset config
We replaced it by `revsets.log` in 0.8.0, which is long enough that
users should have been able to switch.
2024-05-05 09:08:14 -07:00
Yuya Nishihara
0d630ac1bc cli: show commit summary in "tag list"
This is basically a template version of print_branch_target().
2024-05-03 15:16:52 +09: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