Commit graph

2048 commits

Author SHA1 Message Date
Yuya Nishihara
46b1465324 revset: add generation parameter to RevsetExpression::Ancestors/Range
Parents(heads) will be translated to Ancestors(heads, 1..2).
2022-12-13 15:55:18 +09:00
Yuya Nishihara
29a565e3fb revset: add substitution rule for roots..heads
While working on ancestor generation, I noticed Mercurial has this
substitution rule. Since it's easier to deal with Ancestors() than Range {},
'roots..heads' is first decomposed to ':heads & ~:roots'.
2022-12-13 15:55:18 +09:00
Yuya Nishihara
e6229e6d77 revset: turn RevWalkRevset into generic wrapper of cloneable iterator
I failed to solve type puzzle for to_predicate_fn<'a>(&'a self) where
'repo: 'a, so struct RevWalkRevset<'repo, T> is bounded by T to consume
the lifetime parameter.
2022-12-13 15:55:18 +09:00
Martin von Zweigbergk
bf5a00a3e5 github: add reminder about adding tests
Thanks, GitHub Copilot, for adding this item to the checklist :)
2022-12-12 21:43:42 -08:00
Martin von Zweigbergk
7de8ac0744 github: don't ask PR authors to add themselves to the changelog
Most people seem to have forgotten to add themselves despite the
reminder in the PR tempalte. I (or whoever does the release) will fill
it out just before each release instead, like I did for 0.6.0. I
didn't remove the people already on the list for this release, but
I'll regenerate it for next release anyway.
2022-12-12 21:43:42 -08:00
Yuya Nishihara
67be440f4a cli: resolve operation symbol first and apply '-' postfix repeatedly
Just like revsets.
2022-12-13 09:28:48 +09:00
Yuya Nishihara
c46c150542 cli: add one more operation to test_op_log()
Also made op id variables less dynamic as operation ids are now stable
in tests.
2022-12-13 09:28:48 +09:00
Yuya Nishihara
57e5a3be65 cli: reorder resolve_op_for_load() to fall back to resolve_single_op()
I'll add multiple '-' resolution to resolve_single_op().
2022-12-13 09:28:48 +09:00
Martin von Zweigbergk
9d040fef78 docs: indent conflict marker examples to not confuse tools
When importing `conflicts.md` into the Google repo, our internal tools
complained that it contained conflict markers. Similarly, if you ever
get an actual merge conflict in the file, the working-copy
snapshotting would parse our sample conflict markers here, forcing you
to work around it. Let's avoid that by indenting the conflict
markers. Hopefully readers will understand that the leading space is
not part of the markers.
2022-12-12 16:20:40 -08:00
Yuya Nishihara
4a889b986c index: implement generation filter on RevWalkGenerationRange
This will be a building block of 'parents(base)' revset. 'base---' will
be .filter_by_generation(3..4) for example. I think 'ancestors(base)' can
also have an optional generation parameter, but I haven't considered any
particular syntax yet.
2022-12-11 13:14:19 +09:00
Yuya Nishihara
832cf8d838 index: add RevWalk variant that tracks generation
Even though I couldn't determine if RevWalkGenerationRange has a measurable
cost compared to RevWalk, I'm not comfortable with enabling generation
tracking by default. So this patch adds a separate struct. I duplicated
Iterator::next() method as it seemed rather complicated to extract a common
iterator wrapper.

Actual filtering function and tests will be added by the next commit.
2022-12-11 13:14:19 +09:00
Yuya Nishihara
4740d7fac1 index: add slot to track state of wanted RevWalk items
RevWalkWorkItem<u32> to track generation for example.
2022-12-11 13:14:19 +09:00
Yuya Nishihara
03eff13d52 index: extract a couple of RevWalk helper functions to inner struct 2022-12-11 13:14:19 +09:00
Yuya Nishihara
a124f84949 index: move core RevWalk logic to inner struct
I'll add a RevWalk that can filter entries by generation range.
2022-12-11 13:14:19 +09:00
Waleed Khan
91ead75e43 feat(branch): support jj branch forget --glob 2022-12-10 16:51:10 -08:00
Waleed Khan
cd1e27a037 cleanup: alphabetize Cargo.toml 2022-12-10 16:51:10 -08:00
Martin von Zweigbergk
29db672a5c tutorial: mention jj edit and when it's useful
I made some other little touchups while at it.

Closes #840
2022-12-09 22:28:33 -08:00
Danny Hooper
6787e17254 Do not use "..." between diff chunks when it only replaces 1 line of the diff
The number of lines in the diff output is unchanged.

This makes diffs a little more readable when the "..." would otherwise hide a
single line of code that helps in understanding the surrounding context lines.

This change mostly rearranges the loop that consumes the diff lines, so it can
buffer up to num_context_lines*2+1 lines instead of just num_context_lines.
There's a bit of extra code to handle times when a "..." replaces the last line
of a diff.

Note that `jj diff --git` is unchanged, and will still output `@@` lines that
replace a single line of context.
2022-12-09 20:39:40 -06:00
dependabot[bot]
15d40ffa54 github: bump github/codeql-action from 2.1.35 to 2.1.36
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.1.35 to 2.1.36.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](b2a92eb56d...a669cc5936)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-09 11:09:59 -08:00
Martin von Zweigbergk
2a1c2e05ba cli: when colocated with Git, export refs on snapshot
This fixes the bug described in the previous commit.

Because we now print the message about failed exports also while
snapshotting, we may end up reporting it twice on one command. I'm not
sure it's worth worrying about that. We can deal with that later if it
turns out to be a common complaint.
2022-12-08 23:10:18 -08:00
Martin von Zweigbergk
217883591b git: demonstrate how branches don't get exported on snapshot
If a branch points to the working-copy commit, it will automatically
get updated when the working copy is snapshotted. However, it turns
out that we don't automatically export the change to Git when running
in a colocated working copy (nor in a non-colocated working copy, but
that shouldn't be surprising). The change will not get exported until
a non-snapshot operation runs. We noticed this bug in @hooper's repo
today.
2022-12-08 23:10:18 -08:00
Martin von Zweigbergk
1dbf4df3ea docs: mention that the "view" object knows about all workspaces
I seem to have forgotten to update this when I added support for
workspaces a while back.

I made some other little touchups while at it.
2022-12-08 17:30:29 -08:00
Martin von Zweigbergk
79d6779995 github: make Scorecard security scanner not use access token
Google's security team asked us to remove this use of a PAT. It's
apparently supposed to work without it, it's just that it won't be
able to check that we have bronch protection set up.
2022-12-08 14:54:28 -08:00
Yuya Nishihara
a569ac07f6 revset: alias 'empty()' to '~file(*)'
We're more likely to filter out empty commits, so this should be slightly
faster in practice.

The extra Option<> isn't needed, but it should clarify that "prefix([])"
is not "everything".
2022-12-07 23:38:17 +09:00
Yuya Nishihara
1eaa05b6fd revset: remove uninteresting expressions early
Since internalize_filter() should no longer insert redundant 'all() & x'
nodes, it's simpler to clean up uninteresting nodes first.
2022-12-07 23:38:17 +09:00
Yuya Nishihara
75e072b80c revset: remove stale comment about filter intersection with 'all()'
This should have been removed at e17fc89a8d "revset: make filter node unary,
move candidates to outer intersection".
2022-12-07 23:38:17 +09:00
Yuya Nishihara
222d9a6527 revset: rewrite 'x ~ y' to 'x & ~y' first to apply filter optimization
This is remainder of 48d10d648c "revset: add unary negate (or set
complement) operator '~y'".
2022-12-07 23:38:17 +09:00
Yuya Nishihara
b6e06f6dc9 cli: use deserialize to parse alias definition
Unfortunately, config::Value is lax and '[7]' could be parsed as '["7"]'.
I don't like it, but I think that's actually better for consistency as we
use config.get_string() in various places.
2022-12-07 23:26:11 +09:00
Yuya Nishihara
283231b1e4 cli: load all aliases to map first to suppress cryptic error
Otherwise 'jj foo.' would fail with 'Config error: Char'.
2022-12-07 23:26:11 +09:00
Yuya Nishihara
a45e00179c cli: on clone, turn local git remote to absolute path
Otherwise a subsequent git fetch would fail.
2022-12-07 14:14:31 +09:00
Herby Gillot
d530b34568 readme: add MacPorts install info
https://ports.macports.org/port/jujutsu/
2022-12-06 20:46:47 -08:00
Yuya Nishihara
951eb0b61a revset: use filter intersection for tree containing filter
This basically transforms 's1 & (f() | s2)' to
's1.iter().filter(all && f || s2)'. Still the predicate part includes "all",
the filter function doesn't need to load commit data for every entry since
's1.iter().filter(all)' is tested first. To optimize "all" predicate out,
maybe we can add a wrapper that returns '|_: &IndexEntry| true'.

Instead of inserting AsFilter(_) node, I could add a recursive is_filter()
function. That would also work so long as the height of RevsetExpression tree
is limited. I chose node insertion just for ease of snapshot testing.
2022-12-07 11:01:59 +09:00
Yuya Nishihara
f2e7a5ad03 revset: introduce trait that turns evaluated revset into predicate function
This allows us to evaluate 's1 & (f() | s2)' as 's1.iter().filter(f || s2)'
instead of 's1 & (all.iter().filter(f) | s2)'.
2022-12-07 11:01:59 +09:00
Yuya Nishihara
f64f96251f revset: add basic tests for revset combinator
I've made MutableIndex::add_commit_data() crate-public since it's convenient
to build an IndexEntry by that function.
2022-12-07 11:01:59 +09:00
dependabot[bot]
5834a1b191 cargo: bump pest_derive from 2.5.0 to 2.5.1
Bumps [pest_derive](https://github.com/pest-parser/pest) from 2.5.0 to 2.5.1.
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.5.0...v2.5.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-06 08:11:18 -08:00
dependabot[bot]
ed7908e9ed cargo: bump zstd from 0.12.0+zstd.1.5.2 to 0.12.1+zstd.1.5.2
Bumps [zstd](https://github.com/gyscos/zstd-rs) from 0.12.0+zstd.1.5.2 to 0.12.1+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>
2022-12-06 08:10:53 -08:00
Ilya Grigoriev
581cdad1b0 Upgrade insta from 1.21.2 to 1.22.0 2022-12-05 22:29:05 -08:00
Ilya Grigoriev
9e334de7d6 Remove insta::assert_snapshot that causes a failure with insta 1.22 2022-12-05 22:29:05 -08:00
Martin von Zweigbergk
5caade2705 release: release version 0.6.1
The only changes is that we now depend on a released version of
`thrift`.
2022-12-05 20:50:48 -08:00
Martin von Zweigbergk
dfde44255c cargo: depend on now-released thrift 0.17.0
This should let us publish our crates to crates.io.
2022-12-05 20:50:48 -08:00
Martin von Zweigbergk
f5fc3c35f5 github: disable broken attempt to auto-merge Dependabot PRs again
Sigh, I thought it was fixed now, but it seems it's only `gh pr ready`
that works with `GITHUB_TOKEN`. This rolls back commit ee7e7e1b62.
2022-12-05 14:23:43 -08:00
Martin von Zweigbergk
80ccfa8bcc release: release version 0.6.0
Lots of new features and important bugfixes. Thanks, everyone!
2022-12-05 10:38:56 -08:00
Pranay Sashank
d9f1ada69a Add legacy-thrift feature to nix flake. 2022-12-06 00:05:46 +05:30
dependabot[bot]
9a36f1d6e3 github: bump github/codeql-action from 2.1.32 to 2.1.35
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.1.32 to 2.1.35.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](4238421316...b2a92eb56d)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-05 10:07:43 -08:00
dependabot[bot]
da284f5410 cargo: bump assert_cmd from 2.0.6 to 2.0.7
Bumps [assert_cmd](https://github.com/assert-rs/assert_cmd) from 2.0.6 to 2.0.7.
- [Release notes](https://github.com/assert-rs/assert_cmd/releases)
- [Changelog](https://github.com/assert-rs/assert_cmd/blob/master/CHANGELOG.md)
- [Commits](https://github.com/assert-rs/assert_cmd/compare/v2.0.6...v2.0.7)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-05 10:07:10 -08:00
dependabot[bot]
6192183d2b cargo: bump predicates from 2.1.3 to 2.1.4
Bumps [predicates](https://github.com/assert-rs/predicates-rs) from 2.1.3 to 2.1.4.
- [Release notes](https://github.com/assert-rs/predicates-rs/releases)
- [Changelog](https://github.com/assert-rs/predicates-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/assert-rs/predicates-rs/compare/v2.1.3...v2.1.4)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-05 10:00:11 -08:00
dependabot[bot]
92f3dca4bd cargo: bump pest from 2.5.0 to 2.5.1
Bumps [pest](https://github.com/pest-parser/pest) from 2.5.0 to 2.5.1.
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.5.0...v2.5.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-05 09:48:28 -08:00
dependabot[bot]
2deb2f5e71 cargo: bump config from 0.13.2 to 0.13.3
Bumps [config](https://github.com/mehcode/config-rs) from 0.13.2 to 0.13.3.
- [Release notes](https://github.com/mehcode/config-rs/releases)
- [Changelog](https://github.com/mehcode/config-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mehcode/config-rs/compare/0.13.2...0.13.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-05 09:35:44 -08:00
dependabot[bot]
726c042b12 cargo: bump libc from 0.2.137 to 0.2.138
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.137 to 0.2.138.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.137...0.2.138)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-05 09:35:14 -08:00
dependabot[bot]
113c160baf cargo: bump serde from 1.0.148 to 1.0.149
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.148 to 1.0.149.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.148...v1.0.149)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-05 09:34:42 -08:00