-
Notifications
You must be signed in to change notification settings - Fork 343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add optional depth
parameter to ancestors() revset function
#2200
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Thanks, the code looks good to me. Can you also update docs/revsets.md (and add a couple of tests)? Maybe we need to call the
Actually adding |
For sure! For the tests I was thinking just a couple different invocations of |
I think lib/tests/test_revset.rs is better place since we don't change the CLI behavior. |
Ah perfect, I missed the lib tests somehow. |
I like |
Just gotta add docs, and I believe the config schema is not applicable to this |
depth
parameter to ancestors() revset function
rebased on main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your PR. I think you can squash all 6 commits into one, per
https://github.com/martinvonz/jj/blob/main/docs/contributing.md#code-reviews
I'm happy to squash, but on my reading contributing.md says not to! It might need updating if that's your preference, unless I'm misunderstanding. |
Perhaps "we don't squash them when the PR is ready" could be misinterpreted, but it means the PR isn't squashed when integrating, so it's up to contributor to organize commits in meaningful way. I think the first |
Ahh, I see, that makes sense. |
6cda4cf
to
012822f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure whether exclusive depth
is intuitive or not, but other than that, the change LGTM, thanks.
You'll probably need to cargo fmt
the first commit.
I'm also not sure, but to be clear, I don't want that to block this PR. We can always change it later if necessary. |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
Auspicious occasion, that was my first rust open source contribution. Thanks both for your help! |
Allows
ancestors(rev, n)
in the revset language.See #1984 for some context.
Since I care most about the
git log -n 5
use-case, I chose to implement the simplest option of those discussed, returning the last n changes, including the "descendent" change.Support for
ancestors(x, m, n)
can be added later, since it will be backwards compatible. However, if we later went for theancestors(x, m..n)
syntax, I believe that would require a breaking change, unless it was allowed to support either a number or a range argument. I'm not familiar enough with the language to know if that's possible.Checklist
If applicable:
CHANGELOG.md