Skip to content
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 author_date and committer_date revset functions #3887

Merged
merged 2 commits into from
Aug 1, 2024

Conversation

jennings
Copy link
Collaborator

@jennings jennings commented Jun 15, 2024

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added tests to cover my changes

@jennings jennings force-pushed the revset-date-filter branch 2 times, most recently from c75fcf2 to 84bc6c7 Compare June 15, 2024 04:07
Copy link
Collaborator

@yuja yuja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

cli/src/config/revsets.toml Outdated Show resolved Hide resolved
lib/src/revset.rs Show resolved Hide resolved
lib/src/time_expression.rs Outdated Show resolved Hide resolved
lib/src/time_expression.rs Outdated Show resolved Hide resolved
lib/src/time_expression.rs Outdated Show resolved Hide resolved
lib/src/revset.rs Outdated Show resolved Hide resolved
lib/src/revset.rs Outdated Show resolved Hide resolved
lib/src/revset.rs Outdated Show resolved Hide resolved
Copy link
Member

@martinvonz martinvonz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chrono-english supports US and UK dialects to disambiguate mm/dd/yy from
dd/mm/yy, but for now we default to US. This should probably be a config
setting.

I don't think it's worth a config option (but I wouldn't personally mind not having support for either little-endian or middle-endian formats for either dates or time, so maybe don't listen to me :))

@emilazy
Copy link
Collaborator

emilazy commented Jun 29, 2024

I would agree that it’s preferable to only support the ISO/RFC‐style YYYY-MM-DD formats. The non‐big‐endian formats are too hopelessly ambiguous for communication with computers or international users. If they are unnatural to users in the major English speaking countries, they are at least comparably unnatural to all of them, and I think anyone in computing is likely to have encountered them before (if not, Jujutsu can be their introduction!).

@jennings jennings force-pushed the revset-date-filter branch 3 times, most recently from 8275ba0 to a26f5d3 Compare July 3, 2024 06:01
@jennings
Copy link
Collaborator Author

jennings commented Jul 3, 2024

I've made the following substantive changes:

  • Renamed TimeExpression to TimePattern, to fit better with StringPattern and FilePattern.
  • Added an optional after: prefix. If no prefix is given, it behaves like after:.
  • before: is now supported, and is exclusive

Since after: is inclusive but before: is exclusive, every revision falls into either author_date(before:"D") or author_date(after:"D") given any date D, but never both.

@jennings jennings force-pushed the revset-date-filter branch 2 times, most recently from 0ab7538 to b385d6b Compare July 3, 2024 06:15
@jennings jennings requested a review from yuja July 3, 2024 06:20
@jennings jennings force-pushed the revset-date-filter branch 4 times, most recently from 1a0b8de to 5e1276d Compare July 3, 2024 06:38
Copy link
Collaborator

@yuja yuja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

lib/src/time_pattern.rs Outdated Show resolved Hide resolved
lib/src/time_pattern.rs Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
lib/src/default_index/revset_engine.rs Outdated Show resolved Hide resolved
lib/src/default_index/revset_engine.rs Outdated Show resolved Hide resolved
lib/src/revset.rs Outdated Show resolved Hide resolved
lib/src/revset.rs Outdated Show resolved Hide resolved
lib/src/time_pattern.rs Outdated Show resolved Hide resolved
lib/src/time_pattern.rs Outdated Show resolved Hide resolved
@jennings jennings force-pushed the revset-date-filter branch 5 times, most recently from 9c908d3 to c8c7bcb Compare July 10, 2024 06:38
lib/src/time_util.rs Outdated Show resolved Hide resolved
lib/src/time_util.rs Outdated Show resolved Hide resolved
lib/src/time_util.rs Outdated Show resolved Hide resolved
lib/src/time_util.rs Outdated Show resolved Hide resolved
lib/tests/test_revset.rs Show resolved Hide resolved
lib/src/revset.rs Outdated Show resolved Hide resolved
@jennings jennings force-pushed the revset-date-filter branch 2 times, most recently from 2637b21 to 7fe0f55 Compare July 11, 2024 06:46
lib/src/time_util.rs Outdated Show resolved Hide resolved
lib/src/time_util.rs Outdated Show resolved Hide resolved
@jennings jennings force-pushed the revset-date-filter branch 2 times, most recently from fdd5fd0 to 248a9db Compare July 12, 2024 21:16
@jennings jennings force-pushed the revset-date-filter branch from 248a9db to e476536 Compare July 12, 2024 21:23
Creates a DatePattern type that can be created by parsing a string in any
format supported by the chrono-english crate, including:

- 2024-03-25
- 2024-03-25T00:00:00
- 2024-03-25T00:00:00-08:00
- 2 weeks ago
- 5 minutes ago
- yesterday
- yesterday 5pm
- yesterday 10:30
- yesterday 15:30
- tomorrow

A `kind` can be specified to indicate whether the pattern should match dates at
or after (`after`) or strictly before (`before`) the given instant.

chrono-english supports US and UK dialects to disambiguate mm/dd/yy from
dd/mm/yy, but for now we default to US. This should probably be a config
setting.
@jennings jennings force-pushed the revset-date-filter branch 2 times, most recently from a3d80b3 to e71e2ab Compare August 1, 2024 06:25
Author dates and committer dates can be filtered like so:

    committer_date(before:"1 hour ago") # more than 1 hour ago
    committer_date(after:"1 hour ago")  # 1 hour ago or less

A date range can be created by combining revsets. For example, to see any
revisions committed yesterday:

    committer_date(after:"yesterday") & committer_date(before:"today")
@jennings jennings force-pushed the revset-date-filter branch from e71e2ab to a4b024a Compare August 1, 2024 15:52
@jennings jennings merged commit 6c41b1b into jj-vcs:main Aug 1, 2024
17 checks passed
@jennings jennings deleted the revset-date-filter branch August 1, 2024 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants