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

2617 commits

Author SHA1 Message Date
Martin von Zweigbergk
c1799b27a6 cli: say "snapshot working copy" in the operation description
This is user-visible, but it didn't seem important enough to mention
in the changelog. I can easily be convinced that it should be.
2023-02-02 21:03:30 -08:00
Martin von Zweigbergk
6b7f8e5eab cli_util: rename commit_working_copy() to snapshot_working_copy() 2023-02-02 21:03:30 -08:00
Martin von Zweigbergk
b0a6493d20 cli: rename --no-commit-working-copy to --ignore-working-copy
We have moved from saying "committing the working copy" towards saying
"snapshotting the working copy". More importantly, the option also
means that we don't update the working copy at the end. I went with
the `--ignore-working-copy` name suggested by Ilya. I also updated the
documentation of the option.
2023-02-02 21:03:30 -08:00
Yuya Nishihara
45a018ec6b templater: report invalid argument count as error
We'll probably need a helper to extract N..M arguments, but let's revisit
it later.
2023-02-03 12:06:04 +09:00
Yuya Nishihara
baf911459f templater: report invalid argument type as error 2023-02-03 12:06:04 +09:00
Yuya Nishihara
4eff802d87 templater: report keyword/function/method name error 2023-02-03 12:06:04 +09:00
Yuya Nishihara
8653cc885a templater: wrap inner parsing functions with Result<T> 2023-02-03 12:06:04 +09:00
Yuya Nishihara
7090fa0374 templater: report syntax error, don't panic()
Even though the template syntax is experimental, panicking parser makes
it difficult to write tests. So let's add minimal error handling. The error
types are basically copied from the revset module.

I made write_commit_summary() fall back to the default template if user
template had syntax error. It should be better than reporting parse error
after e.g. "jj abandon" finished successfully.
2023-02-03 12:06:04 +09:00
Martin von Zweigbergk
1e48914c42 github: add reminder to update config schema in PRs
We have forgotten this many times already.
2023-02-02 16:03:53 -08:00
David Barnett
14982d750e (Minor fix) Don't request pager for config edit, only config list 2023-02-02 19:17:05 +01:00
David Barnett
8ee919dcbb Don't output implicit defaults from "config list"
Accept an --include-defaults arg to enable including those.

Listing a nonexistent name is no longer an error, but does output a
warning to stderr when no config entries match to explain why there's no
other output.
2023-02-01 19:49:57 -06:00
Yuya Nishihara
d6592573d0 templater: abstract Dynamic/LabelTemplate over labels type, unify them 2023-02-02 01:12:23 +09:00
Yuya Nishihara
1911734acc templater: add wrapper that turns template back to string property
I have no idea whether or not any template expressions are intentionally
allowed as a label, but it makes sense to write something like
'label("phase-" phase, ...)' (if we had a phase keyword.) So I decided to
add .into_plain_text() instead of stricter .try_into_string().
2023-02-02 01:12:23 +09:00
dependabot[bot]
a42ce8773c cargo: bump bytes from 1.3.0 to 1.4.0
Bumps [bytes](https://github.com/tokio-rs/bytes) from 1.3.0 to 1.4.0.
- [Release notes](https://github.com/tokio-rs/bytes/releases)
- [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/bytes/compare/v1.3.0...v1.4.0)

---
updated-dependencies:
- dependency-name: bytes
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-01 15:20:46 +00:00
dependabot[bot]
bd5cbbdbaa github: bump dtolnay/rust-toolchain
Bumps [dtolnay/rust-toolchain](https://github.com/dtolnay/rust-toolchain) from ce8f65846d7180d2ce63b1e74483d981800b9e22 to c758e63728211bd4acda6501cfa2a16c5c751fc4.
- [Release notes](https://github.com/dtolnay/rust-toolchain/releases)
- [Commits](ce8f65846d...c758e63728)

---
updated-dependencies:
- dependency-name: dtolnay/rust-toolchain
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-01 15:19:38 +00:00
Yuya Nishihara
6da43734cb templater: migrate trivial commit keywords to closure wrapper
Perhaps, non-trivial keywords can be extracted to free functions, and both
parsing and property functions can be eventually moved to a commit templater
module?
2023-02-01 17:54:35 +09:00
Yuya Nishihara
846be15132 templater: add CommitOrChangeId constructor to help inline keywords 2023-02-01 17:54:35 +09:00
David Barnett
dc0e3c1855 Add ui.unique-prefixes and git.auto-local-branch to config schema 2023-02-01 01:21:26 -06:00
Yuya Nishihara
e63ea86841 templater: do not complete "(no commit description)" by default
This allows us to use "if(description,)" to test empty description. And
I think this change is unavoidable if we want to add support for commit
template.
2023-02-01 16:13:43 +09:00
Yuya Nishihara
12d8c4ef01 cli: have complete_newline() return String instead of mutating
String -> String function is more convenient in one liner, and it's unlikely
we'll use this function in hot loop.
2023-02-01 16:13:43 +09:00
Yuya Nishihara
e4cb1afd61 templater: fix crash on "".first_line() 2023-02-01 16:13:43 +09:00
Samuel Tardieu
6e9d3879fd split: give warning when given paths don't match anything 2023-02-01 07:15:38 +01:00
David Barnett
16d287340a Update schema for [colors] to allow either string or table values 2023-01-31 22:24:01 -06:00
Yuya Nishihara
259314b442 templater: reuse parse_commit_term() to coerce if() condition to bool
This should fix some inconsistent parsing of condition term.
2023-02-01 10:25:28 +09:00
Yuya Nishihara
553bee6ac4 templater: extract method that coerces property to boolean 2023-02-01 10:25:28 +09:00
Yuya Nishihara
5eee7186ba templater: add enum that holds property or template
This allows us to merge parse_boolean_commit_property() into
parse_commit_term(). We'll probably need similar type coercion methods
for the other basic types.

I considered adding something like Property::Template(), which could be
reused for map operation (e.g. 'revset().map(commit_id).join(" ")'.)
However, a mapped commit template would be different from the top-level
commit template regarding the lifetime of the context.
"Expression::<Commit>::Template()" takes "for<'b> &'b Commit" as an argument,
whereas a mapped template property would capture Commit object somewhere.
2023-02-01 10:25:28 +09:00
Yuya Nishihara
8d7ba8ddd3 templater: extract PropertyAndLabels::into_template() 2023-02-01 10:25:28 +09:00
Yuya Nishihara
41afdd48c7 templater: reorder declaration of PropertyAndLabels struct 2023-02-01 10:25:28 +09:00
Yuya Nishihara
195672f75e tests: extract helper that renders single commit template with no graph 2023-02-01 10:25:28 +09:00
dependabot[bot]
c6dc4ec811 cargo: bump zstd from 0.12.2+zstd.1.5.2 to 0.12.3+zstd.1.5.2
Bumps [zstd](https://github.com/gyscos/zstd-rs) from 0.12.2+zstd.1.5.2 to 0.12.3+zstd.1.5.2.
- [Release notes](https://github.com/gyscos/zstd-rs/releases)
- [Commits](https://github.com/gyscos/zstd-rs/commits)

---
updated-dependencies:
- dependency-name: zstd
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-31 22:32:47 +01:00
Martin von Zweigbergk
18d4300895 formatter: rename underlined color config to underline
I keep calling it `underline` by mistake, so that probably means that
it's a more natural name for it. We haven't made a release of it yet,
so I didn't mention it in the changelog.

I didn't update all variables to also use `underline`, because I felt
that `underlined` was usually more natural there, plus crossterm calls
it `Attribute::Underlined`.
2023-01-31 08:14:27 -08:00
Yuya Nishihara
f1e6146d6d templater: add newtype to implement property over closure
Many template keywords and methods are one liners, and I think that's actually
good because writing tests for templater would be more involved than for pure
functions.

This patch introduces a wrapper for such one-line functions, and migrates
method parser to that. Some of the commit keyword structs can also be ported
to this wrapper.
2023-01-31 16:27:52 +09:00
Yuya Nishihara
67eac2a455 templater: host shortest_styled_prefix() by CommitOrChangeId
HighlightPrefix::extract() will be inlined by the next commit.
2023-01-31 16:27:52 +09:00
David Barnett
94b53575d8 Add ui.graph.style into config schema 2023-01-31 01:10:31 -06:00
Ilya Grigoriev
6e05c5a829 jj log: Change the default of ui.unique-prefixes to "styled" 2023-01-30 22:48:38 -08:00
Ilya Grigoriev
adeba7f2a5 test_commit_template: break up long lines 2023-01-30 22:48:38 -08:00
Ilya Grigoriev
adfae11e11 jj log: ui.unique-prefixes="styled" option to show prefixes in color
The tail of the id is shown in grey. For divergent commits, it looks better
to show the tail in red, so the prefix is underlined.

https://user-images.githubusercontent.com/4123047/213904951-caccef87-3636-45b1-b503-86a4271f0cc8.png
2023-01-30 22:48:38 -08:00
Ilya Grigoriev
26cc290157 Templater: Create shortest_styled_prefix function for ids 2023-01-30 22:48:38 -08:00
Ilya Grigoriev
bd37989b63 Templater: Inline highlight_shortest_prefix_brackets 2023-01-30 22:48:38 -08:00
Ilya Grigoriev
3ee87aa5a7 Rename short => shortest 2023-01-30 22:48:38 -08:00
Ilya Grigoriev
85452397c4 Templater: Show entire prefix even if it's long + refactor
This refactors the unique prefix functionality and extracts a function
that will be reused by the styled prefix highlighting.

This also includes a minor change in functionality: if the unique prefix
of an id does not fit into the space provided, it is still printed.

Currently, this would happen if the prefix is more than 12 characters
long, which takes a huge repository. However, I'm hoping that in the
future we'll make this number customizeable.
2023-01-30 22:48:38 -08:00
Martin von Zweigbergk
910c73a9ae tests: demonstrate bug on undo after squash in colocated working copy
I think this is the same bug as reported in #922, just simplified a
bit further. The branches in the repo actually look good after the
`undo` operation, but the reverted `master` branch doesn't get
exported to the git repo even though our recorded `refs/heads/master`
in the repo was moved back. Then the next automatic import on `log`
notices that the `master` branch in the git repo still points to the
new commit, and that commit becomes visible again.
2023-01-30 22:43:46 -08:00
Martin von Zweigbergk
e3e7c17f52 git: demonstrate bug when fetching into colocated working copy (#864) 2023-01-30 09:05:03 -08:00
Martin von Zweigbergk
fafa9b70fc view: also merge git_heads when merging views
I don't know if I had just forgotten to merge `git_heads` when I added
it to the view object, but it seems like it should be merged just like
refs.
2023-01-30 09:05:03 -08:00
Martin von Zweigbergk
4e8fbaa210 git: allow conflicts in "HEAD@git"
Git's HEAD ref is similar to other refs and can logically have
conflicts just like the other refs in `git_refs`. As with the other
refs, it can happen if you run concurrent commands importing two
different updates from Git. So let's treat `git_head` the same as
`git_refs` by making it an `Option<RefTarget>`.
2023-01-30 09:05:03 -08:00
Martin von Zweigbergk
6cf7d98465 templater: replace is_git_head keyword by git_head keyword
I'm about to make it possible for `HEAD@git` to be conflicted. For
that, we need to be able to include the trailing `?`. This patch
prepares for that.
2023-01-30 09:05:03 -08:00
Martin von Zweigbergk
23fc849574 log: add test of HEAD@git template 2023-01-30 09:05:03 -08:00
dependabot[bot]
b88478d8d2 cargo: bump crossterm from 0.25.0 to 0.26.0
Bumps [crossterm](https://github.com/crossterm-rs/crossterm) from 0.25.0 to 0.26.0.
- [Release notes](https://github.com/crossterm-rs/crossterm/releases)
- [Changelog](https://github.com/crossterm-rs/crossterm/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crossterm-rs/crossterm/compare/0.25...0.26)

---
updated-dependencies:
- dependency-name: crossterm
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-30 08:30:56 -08:00
Glen Choo
b338c916c0 cli: report no updates to current branch
Fix a bug where `jj git push` would print "No current branch." when
there is a current branch but it is unchanged. We were conflating the
two because we print the message when no updates were performed, instead
of only when no branches were found.
2023-01-29 22:07:28 -08:00
Glen Choo
3418c8ff73 git: add git.auto-local-branch
Add a new git.auto-local-branch config option. When set to false, a
remote-tracking branch imported from Git will not automatically create a
local branch target. This is implemented by a new GitSettings struct
that passes Git-related settings from UserSettings.

This behavior is particularly useful in a co-located jj and Git repo,
because a Git remote might have branches that are not of everyday
interest to the user, so it does not make sense to export them as local
branches in Git. E.g. https://github.com/gitster/git, the maintainer's
fork of Git, has 379 branches, most of which are topic branches kept
around for historical reasons, and Git developers wouldn't be expected
to have local branches for each remote-tracking branch.
2023-01-29 20:17:49 -08:00