Commit graph

4203 commits

Author SHA1 Message Date
Yuya Nishihara
17f502c83a git: do not import unknown commits by read_commit(), use explicit method call
The main goal of this change is to enable tree-level conflict format, but it
also allows us to bulk-import commits on clone/init. I think a separate method
will help if we want to provide progress information, enable check for
.jjconflict entries under certain condition, etc.

Since git::import_refs() now depends on GitBackend type, it might be better to
remove git_repo from the function arguments.
2023-09-08 21:54:43 +09:00
Yuya Nishihara
dde1c1ec9c revset: use ancestors(x, 0) in tree substitution test 2023-09-08 09:28:14 +09:00
Yuya Nishihara
8b825796ff cli: rewrite "x | x-" in default log revset as "ancestors(x, 2)" 2023-09-08 09:28:14 +09:00
Ilya Grigoriev
5fc71018d6 config docs: minor fixups
mkdocs can't seem to handle backticks in link anchors for out-of-text links.
2023-09-07 11:01:12 -07: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
James Sully
0946934ca6 revset: Add optional argument n to ancestors() in revset language 2023-09-08 02:50:58 +10:00
James Sully
6ea10906a8 revset: add ancestors_range() method 2023-09-08 02:50:58 +10:00
Martin von Zweigbergk
233b31fdf2 docs: try to clarify that we want contributors to squash fixup commits
It's happened a few times that contributors misunderstood the
guidelines, so they're clearly not clear enough. Hopefully this
clarifies.
2023-09-07 09:31:45 -07:00
dependabot[bot]
8660b39b4c github: bump the github-dependencies group with 1 update
Bumps the github-dependencies group with 1 update: [actions/upload-artifact](https://github.com/actions/upload-artifact).

- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](0b7f8abb15...a8a3f3ad30)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-07 15:48:44 +00:00
dependabot[bot]
67258d52e7 cargo: bump the cargo-dependencies group with 3 updates
Bumps the cargo-dependencies group with 3 updates: [bytes](https://github.com/tokio-rs/bytes), [clap_complete](https://github.com/clap-rs/clap) and [chrono](https://github.com/chronotope/chrono).


Updates `bytes` from 1.4.0 to 1.5.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.4.0...v1.5.0)

Updates `clap_complete` from 4.4.0 to 4.4.1
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.4.0...clap_complete-v4.4.1)

Updates `chrono` from 0.4.29 to 0.4.30
- [Release notes](https://github.com/chronotope/chrono/releases)
- [Changelog](https://github.com/chronotope/chrono/blob/main/CHANGELOG.md)
- [Commits](https://github.com/chronotope/chrono/compare/v0.4.29...v0.4.30)

---
updated-dependencies:
- dependency-name: bytes
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo-dependencies
- dependency-name: clap_complete
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: chrono
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-07 15:44:04 +00: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
a422fd7f67 cargo: add version number to jj-lib dependency
This is required for `cargo publish`. It seems better to have it
tracked than to do add it whenever we publish.
2023-09-06 17:20:31 -07:00
Ilya Grigoriev
2911f414bd docs: remove v0.7.0 shell completion instructions
Now that v0.9.0 is released, it seems appropriate.
2023-09-06 15:35:01 -07:00
Martin von Zweigbergk
d047512115 docs: prefer new revset operator :: over deprecated :
Now that we're very close to a release, it should be fine to use the
new syntax in our documentation. This effecttively backs out
37436f7344.
2023-09-06 13:09:14 -07:00
Martin von Zweigbergk
bafd1b568e changelog: more orphan entries under headings 2023-09-06 11:32:48 -07:00
Martin von Zweigbergk
c7d1932546 release: release version 0.9.0
Thanks to everyone who's contributed!
2023-09-06 10:57:57 -07:00
Ilya Grigoriev
18bcc87794 docs: make co-located repos more prominent, more details
At this point, they are stable enough that I think we should
advertise them and encourage their use. This also explains
some caveats.
2023-09-06 09:15:27 -07:00
Ilya Grigoriev
be8be2e55a docs: More info about syncing jj repo with rsync
This will be used for context in the next commit

Includes a mention of
https://github.com/martinvonz/jj/issues/2193.
2023-09-06 09:15:27 -07: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
Yuya Nishihara
a868b2d9a5 revset: do not lookup unimported tags or remote branches by unqualified name
Since e7e49527ef "git: ensure that remote branches never diverge", the last
known "refs/remotes" ref should be synced with the corresponding remote branch.
So we can always trust the branch@remote expression. We don't need "refs/tags"
lookup either since tags should have been imported by git::import_refs().

FWIW, I'm thinking of reorganizing view.git_refs() map as per-remote views.
It would be nice if we can get rid of revsets and template keywords exposing
low-level Git ref primitives.
2023-09-06 13:42:22 +09:00
Yuya Nishihara
4e6323c0a4 revset: add basic test for tag name resolution 2023-09-06 13:42:22 +09:00
Yuya Nishihara
8f4512b109 git: rename local variables in diff_refs_to_export()
old/new_branch sounds like a branch name, but it's a RefTarget. And
jj_known_refs_passing_filter may contain "new" ref names.
2023-09-06 08:17:49 +09:00
Yuya Nishihara
119cc88832 git: extract calculation step from export_some_refs()
export_some_refs() is big, let's split it to functions of reasonable size.
2023-09-06 08:17:49 +09:00
Yuya Nishihara
89f1d83a22 git: do not export new ref if racy process created one with the same name
Since we've checked the ref doesn't exist in this code path, I think it's
better to not overwrite the existing ref.
2023-09-06 08:17:49 +09:00
Yuya Nishihara
a4dd598e3e git: extract helper that exports single updated ref 2023-09-06 08:17:49 +09:00
Yuya Nishihara
d1a08782c9 git: extract helper that exports single deleted ref 2023-09-06 08:17:49 +09:00
Yuya Nishihara
7282b517e8 git: remove stale TODO comment about FailedRefExportReason 2023-09-06 08:17:49 +09: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
Philip Metzger
8dda7e21e0 revsets: Add descendants_at and ancestors_at
They are needed for `next` and `prev`.
They behave symmetrically for parents and children.
2023-09-05 23:13:39 +02:00
dependabot[bot]
57f46a4bb7 cargo: bump the cargo-dependencies group with 1 update
Bumps the cargo-dependencies group with 1 update: [chrono](https://github.com/chronotope/chrono).

- [Release notes](https://github.com/chronotope/chrono/releases)
- [Changelog](https://github.com/chronotope/chrono/blob/main/CHANGELOG.md)
- [Commits](https://github.com/chronotope/chrono/compare/v0.4.28...v0.4.29)

---
updated-dependencies:
- dependency-name: chrono
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-05 16:13:02 +00: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
f198a1e5f9 git: skip branches on root commit on export
Git doesn't have a root commit, so we should skip branches pointing to
it on export, just like we do with conflicted branches (which Git also
doesn't support).
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
Martin von Zweigbergk
f6c24fbcef git: return refs that failed to export in sorted order
Before this patch, the order would depend on the reason we failed to
export a ref, because we would add to the `failed_branches` list in
several different places. What's worse, when the export failed because
the branch was conflicted or had an invalid name (from Git's
perspective), it was non-deterministic because we iterated over a
HashSet. This patch fixes that by sorting at the end.

Note that we still want the `branches_to_update` map to be a
`BTreeMap` so we update branches in deterministic order. Otherwise the
error when trying to export both branches `main` and `main/sub` will
become non-deterministic.
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
6b2ad23f8f revset: evaluate "..y" expression to "root()..y"
This seems useful since the root commit is often uninteresting. It's also
consistent with "x::y" in a way that the left operand defaults to "root()".
2023-09-05 10:40:04 +09:00
Yuya Nishihara
f2c1697362 revset: fix comment about "@" expression 2023-09-05 10:40:04 +09:00
dependabot[bot]
0fa6d132ab cargo: bump the cargo-dependencies group with 2 updates
Bumps the cargo-dependencies group with 2 updates: [regex](https://github.com/rust-lang/regex) and [thiserror](https://github.com/dtolnay/thiserror).


Updates `regex` from 1.9.4 to 1.9.5
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.9.4...1.9.5)

Updates `thiserror` from 1.0.47 to 1.0.48
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.47...1.0.48)

---
updated-dependencies:
- dependency-name: regex
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-04 13:39:27 -07:00
dependabot[bot]
d420ca06d0 github: bump the github-dependencies group with 1 update
Bumps the github-dependencies group with 1 update: [actions/checkout](https://github.com/actions/checkout).

- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...3df4ab11eba7bda6032a0b82a6bb43b11571feac)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-04 13:39:04 -07: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
c08fab60da docs: update description of @ revset expression, mention name@remote syntax
Since I'm going to remove the root symbol, it doesn't make sense to leave
@ in the priority list.
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
Martin von Zweigbergk
e3825495e3 store: don't include cached objects in Debug format
I was looking into some overly verbose logs and happened to notice
that `Store` uses the default derived, which presumably means it's
going to include all objects in its cached. Just including the
backend's debug string seems enough.
2023-09-01 16:49:23 -07:00
Martin von Zweigbergk
16c897d8b4 conflicts: leverage Merge::map() in materialize_merge_result() 2023-09-01 16:23:39 -07: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