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

176 commits

Author SHA1 Message Date
Waleed Khan
393b035498 merge_tools: create builtin merge editor 2023-09-18 06:33:29 +02:00
Ruben Slabbert
f2f5ded5f0 revsets: add trunk alias with default to main/master/root 2023-09-17 10:17:23 +10:00
Ilya Grigoriev
33087bcd90 cli docs: document that --config-toml can be repeated 2023-09-14 18:09:27 -07:00
Zachary Dremann
2177dc0657 Allow \0 escape for nulls
This allows safely getting e.g. multiple descriptions, and knowing where the
boundaries are
2023-09-14 17:11:05 -04:00
Martin von Zweigbergk
8bfb6c10fd cli: add jj op log --no-graph
Seems useful, and makes it consistent with the `jj log` and `jj
obslog`.
2023-09-10 15:17:43 -07:00
Martin von Zweigbergk
70f6e0a452 cargo: enable the watchman feature by default
I think the feature is requested by enough users that we should
include it by default, also for people who install from source (we
include it in the `packaging` feature already).

It increases the size of the binary from 16.5 MiB to 17.8 MiB. I
suspect we'd see some of that increase in size soon anyway, as I'm
probably going to use Tokio for making async backend requests.
2023-09-08 09:34:55 -07:00
Yuya Nishihara
8b825796ff cli: rewrite "x | x-" in default log revset as "ancestors(x, 2)" 2023-09-08 09:28:14 +09:00
Martin von Zweigbergk
8640eacfbd cargo: don't expose the criterion feature
There should be no reason to include `criterion` without the `bench`
feature. Adding the `dep:` prefix to any dependency makes cargo not
expose the implicit `criterion` feature.
2023-09-07 11:00:25 -07:00
Vamsi Avula
ddb6e1b954 cli: label working copies when writing commit summaries 2023-09-07 12:43:58 +05:30
Yuya Nishihara
c4769e0b7c revset: translate symbol rules in error message
Since we have overloaded operator symbols, we need to deduplicate them
upfront. Legacy and compat operators are also removed from the suggestion.

It's a bit ugly to mutate the error struct before calling Error::renamed_rule(),
but I think it's still better than reimplementing message formatting function.
2023-09-07 15:29:39 +09:00
Martin von Zweigbergk
7c8f66ab0c cli: make jj abandon print commit info as it was before the command
As we discussed in #1928, it seems better to print information about
abandoned commits in the context of the pre-abandon state. For
example, that means that we'll include any branches that pointed to
the now-abandoned commits.
2023-09-05 21:51:32 -07:00
Philip Metzger
f131dc9814 commands: Implement next and prev
This is a naive implementation, which cannot deal with multiple children
or parents stemming from merges.

Note: I gave each command separate a separate argument struct
for extensibility. 

Fixes #878
2023-09-05 23:13:39 +02:00
Martin von Zweigbergk
2b9c9d22cf cli: make it allowed to have a branch on the root commit again
Closes #1529.
2023-09-04 20:08:11 -07:00
Martin von Zweigbergk
4ea6b4a75b cli: make hint about foo and foo/bar branches more targeted
Many failure to export refs to Git are not about conflicts between a
branch named `foo` and a branch named `foo/bar`, so don't give that
hint in most cases.
2023-09-04 20:08:11 -07:00
Martin von Zweigbergk
ef550a9d6d git: include reason for each failed ref export 2023-09-04 20:08:11 -07:00
Yuya Nishihara
b0c8e9ef62 revset: add 0-ary "::" and ".." operators as short for "all()" and "~root()"
Suppose "x::y" is the operator that defaults to "root()::visible_heads()"
respectively, "::" is identical to "all()". Since we've just changed the
behavior of "..y", ".." is now "root()..visible_heads()" meaning "~root()".
2023-09-05 10:40:04 +09:00
Yuya Nishihara
e3c85d6ecc revset: convert root symbol to function
The idea is that we can fully eliminate special symbols that would otherwise
shadow user branches, tags, or change ID prefixes.

Closes #2095
2023-09-04 10:36:30 +09:00
Yuya Nishihara
4394bf8de8 templater: add boolean literals
They are implemented as literal expressions so that user cannot override
them by false and true aliases.
2023-09-03 07:01:40 +09:00
Yuya Nishihara
08e66fb7d4 templater: fix span of method call expression
Spotted while experimenting with field expression. This span is unused,
so no test output changes.
2023-09-03 07:01:40 +09:00
Yuya Nishihara
e36237426a cli: elide path in snapshot progress in the same way 2023-09-02 08:21:33 +09:00
Yuya Nishihara
1c7d2b9a96 cli: make diff stat calculate path length based on unicode width 2023-09-02 08:21:33 +09:00
Yuya Nishihara
643b2d4974 cli: include both ascii and non-ascii file names in diff stat test
ASCII file names can be used as reference widths.
2023-09-02 08:21:33 +09:00
Yuya Nishihara
3d54df9806 cli: add helper to elide text from left
I don't think this implements unicode layout stuff thoroughly, but it can at
least handle Latin and unambiguous East-Asian characters.
2023-09-02 08:21:33 +09:00
Martin von Zweigbergk
b8f71a4b30 working_copy: in LockedWorkingCopy::drop(), discard unsaved changes
In `LockedWorkingCopy::drop()`, we panic if the caller had not called
`finish()`. IIRC, the idea was both to find bugs where we forgot to
call `finish()` and to prevent continuing with a modified
`WorkingCopy` instance. I don't think the former has been a problem in
practice. It has been a problem in practice to call `discard()` to
avoid the panic, though. To address that, we can make the `Drop`
implementation discard the changes (forcing a reload of the state if
the working copy is accessed again).
2023-09-01 12:25:47 -07:00
Martin von Zweigbergk
f3a16eb964 cli: add hint when snapshot fails due to large file
I also converted the error from `InternalError` to `UserError`. So far
I've intented to use `InternalError` only to indicate bugs or corrupt
repos. I'm not sure that's a good idea, and we can revisit it later.
2023-09-01 12:25:47 -07:00
Martin von Zweigbergk
b18c97aa12 cli: trim path in diff stat if it's long, to give room for stat
If the path is too long to fit on the screen, this patch makes it so
we elide the first part of it. It goes a bit further and trims it down
to ~70% of the screen, giving some room for the stat. This seems
somewhat similar to what Git does.
2023-08-31 16:26:43 -07:00
Martin von Zweigbergk
497f4a952c cli: fix indentation of two insta snapshots
`insta` ignores leading indentation (as long as it's consistent within
the snapshot), but when a test case fails and you let `cargo insta`
update it, it's going to use a specific indentation. There were a few
tests that didn't match that indentation, which could lead to
surprising diffs if the tests fail at some point.
2023-08-31 16:26:43 -07:00
Martin von Zweigbergk
5ecc95a245 cli: make diff stat determine path length in chars, not bytes 2023-08-31 16:26:43 -07:00
Martin von Zweigbergk
0493e2b50e cli: use non-ascii chars in diff stat test
This shows that there's too much padding because we pad based on
number of bytes.

I had to reduce the path names for the file names not to get too long
for my file system.
2023-08-31 16:26:43 -07:00
Martin von Zweigbergk
4377c08f83 cli: don't crash diffstat on very narrow terminals
We can still crash on terminals that are less than 4 characters wide
(maybe it doesn't matter if we do because the user can't tell the
crash report from a diffstat in such a terminal?). This patch fixes
the crash.
2023-08-31 16:26:43 -07:00
Martin von Zweigbergk
5a054fcd20 cli: reuse number_padding instead of calculating twice in diff stat 2023-08-31 16:26:43 -07:00
Martin von Zweigbergk
5ce4ed45de cli: allow diff stat bar to be one character longer
I think the `+ 1` here came from an old iteration of this feature
where there was a single space before each line.
2023-08-31 16:26:43 -07:00
Martin von Zweigbergk
939528122d cli: fix crash on diff stat with long path name
We would run into a panic due to "attempt to subtract with overflow"
if the path was long. This patch fixes that and adds tests showing the
current behavior when there are long paths and/or large diffs.
2023-08-31 16:26:43 -07:00
Martin von Zweigbergk
61501db8ec merged_trees: consider conflict-format-change-only commits empty
When we start writing tree-level conflicts in an existing repo, we
don't want commits that change the format to be non-empty if they
don't change any content. This patch updates `MergeTreeId::eq()` to
consider two resolved trees equal even if only their `MergedTreeId`
variant is different (one is path-level and one is tree-level).

I think I've gone through all places we compare tree ids and checked
that it's safe to compare them this way. One consequence is that
rebasing a commit without changing the parents (typically
auto-rebasing after `jj describe`) will not lead to the tree id
getting upgraded, due to an optimization we have for that case. I
don't think that's serious enough to handle specially; we'll have to
support the old format for existing repos for a while regardless of a
few commits not getting upgraded right away.

The number of failing tests with the config option enabled drop from
108 to 11 with this patch.
2023-08-30 06:17:21 -07:00
Martin von Zweigbergk
8e47d2d66f merged_tree: add config option to write trees using new format
We're finally ready to start writing trees using the new format where
we represent conflicts by having multiple trees in the commit instead
of having a single tree with multiple entries at a path. This patch
adds a config option for that. It's not ready to be used yet, so I
haven't updated the release notes or other documentation.

I added only a simple CLI test for testing what happens when the
config is enabled in an existing repo. 108 tests currently fail if we
flip the default.
2023-08-30 06:17:21 -07:00
Waleed Khan
56c61fd047 merge_tools: create builtin diff editor 2023-08-30 05:38:10 -04:00
Waleed Khan
ccd67e8156 merge_tools: rename MergeTool::Internal -> MergeTool::Builtin
The name we will expose to the user is `builtin`, so this changes the internal messaging to match that.
2023-08-30 04:10:39 -04:00
Vamsi Avula
32377a13f4 templates: default placeholders to red
With the idea that less severe placeholders (like description) could
(and should) explicitly "opt out".

(Both email and name placeholders will be red with this change.)
2023-08-30 12:54:15 +08:00
Vamsi Avula
dbf13a5250 tests: add test for log builtin templates with colors 2023-08-30 12:54:15 +08:00
Martin von Zweigbergk
145b0b24d8 commit: drop merged_ prefix from tree() and tree_id()
The old `tree()` and `tree_id()` functions are now gone, so we can use
those names for the new functions.
2023-08-29 08:32:04 -07:00
Martin von Zweigbergk
67832a3940 merged_tree: take store argument to write_tree() instead of new()
The store isn't needed until we write the trees, so I think it makes
more sense to pass it there.
2023-08-29 08:32:04 -07:00
Yuya Nishihara
55c6e90555 git: remove handling of real remote named "git", always override
#1690
2023-08-29 22:50:46 +09:00
Yuya Nishihara
ce3d28e234 git: do not import refs from remote named "git"
I made it simply fail on explicit fetch/import, and ignored on implicit import.
Since the error mode is predictable and less likely to occur. I don't think it
makes sense to implement warning propagation just for this.

Closes #1690.
2023-08-29 22:50:46 +09:00
Yuya Nishihara
35a596ff66 git: prohibit creation of remote named "git"
#1690
2023-08-29 22:50:46 +09:00
Yuya Nishihara
0e26ef7733 git: add constant for pseudo remote name "git" 2023-08-29 22:50:46 +09:00
Martin von Zweigbergk
dc06bbc7d1 commit: migrate remaining uses of Commit::tree_id() and delete it 2023-08-28 15:58:34 -07:00
Martin von Zweigbergk
90e78a1424 rewrite: return MergedTree from merge_commit_trees() 2023-08-28 15:58:34 -07:00
Martin von Zweigbergk
494026a9bf cli: merge trees via MergedTree in rebase_to_dest_parent() 2023-08-28 15:58:34 -07:00
Martin von Zweigbergk
bd6098e09e cli: merge trees via MergedTree in jj move 2023-08-28 15:58:34 -07:00
Martin von Zweigbergk
1674a421ec commit_builder: take MergedTreeId for root id argument 2023-08-28 15:58:34 -07:00