-
Notifications
You must be signed in to change notification settings - Fork 234
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
rewrite: add reset-author-timestamp
revset
#3906
base: main
Are you sure you want to change the base?
Conversation
0dd75c2
to
5071365
Compare
According to #2000, options are:
Do we have any other practical conditions to update author timestamp? I'm asking because |
I imagine it could be useful to use
Yes, it does sound odd for those cases. Maybe |
Yeah, that might be useful, but I'm also not sure.
Yes. @ilyagr any comments to this PR in general? |
Does your list include setting a historical timestamp (like putting an old project that is in zip files finally into version control)? |
No, it doesn't. It's the list when user would expect author timestamp of new commit is settled. |
5071365
to
263b7b7
Compare
incomplete()
revset for updating author timestampreset-author-timestamp
revset
This PR affects many more call sites than I had expected. Do you think we could get good enough behavior by adding something similar to the option to abandon empty or emptied commits? That is, would another |
Sorry, that made no sense. We never want to reset the author timestamp when rebasing. We only want to reset it when creating new commits for reasons other than rebasing. |
Perhaps, Btw, if we don't need revset support, error handling will be much simpler. |
263b7b7
to
fd6828c
Compare
It's common to create empty working-copy commits while using jj, and currently the author timestamp for a commit is only set when it is first created. If you create an empty commit, then don't work on a repo for a few days, and then start working on a new feature without abandoning the working-copy commit, the author timestamp will remain as the time the commit was created rather than being updated to the time that work began or finished. This commit adds a new revset `reset-author-timestamp` which specifies which commits should have their author timestamp updated whenever changes are made to them. This can be configured to fit many different workflows. By default, empty commits with no description have their author timestamps reset, meaning that the author timestamp will become finalized whenever a commit is given a description or becomes non-empty. Rebasing commits never updates the author timestamp, and commits by a different author are also never updated.
fd6828c
to
99126dd
Compare
Some relatively minor thoughts, assuming we go with this design (which got nicer with the last update, thank you!):
I'll also ping @arxanas, @chriskrycho and @necauqua in case they have any thoughts. This feels quite reasonable to me. However, I am not actually bothered by the lack of this feature, so it's hard for me to have a clear feeling about whether this is sufficiently flexible (on one hand) and whether the complexity of allowing a customizable revset aliases is justified (on the other hand). |
I feel exactly the same :) |
Thanks for the feedback!
Yeah, that would make things a bit simpler in
I was thinking about that too. Maybe
To me, it seems like it would be good to support at least some level of customization here, since there seems to be at least 4 reasonable behaviors. We could potentially use an enum with these values instead:
( To me, the main reason to use revsets is to give additional flexibility to users (e.g. resetting for WIP commits) and to make the configuration more consistent (since many config options already use revsets). On the other hand, it seems like using an enum value would allow the logic to be moved into the library code more easily, and it might make it easier to consume for users of the library. If this option will be rarely used (perhaps most people don't even know about the distinction between author and committer in Git?), then it might not be worth the complexity from revsets. |
These sound fine to me. I'd only prefer an enum to a revset if it really makes the implementation much simpler (I haven't thought much about that). From the UI perspective, I think a revset is great, unless we'd rather go with a boolean option or with nothing. Also, my sense is that there are people who'd appreciate this feature, so I'd lean towards trying some version of it. |
This is my first time contributing, but I thought this might be a useful feature. This PR resolves #2000 by adding a revset to configure which commits have their author timestamps updated when they are rewritten. This gives a lot of flexibility for configuration, but it's more complex than having a single hard-coded rule. Another alternative might be to have a configuration option with a few fixed enum variants instead of a revset. I would appreciate any comments and feedback!
One thing which I was unsure about is whether all of the existing tests should be updated (it caused a large number of changes since many commit IDs are different due to the different timestamps), or if this feature should be disabled by default in tests except for a few new tests created to test this feature.
Checklist
If applicable:
CHANGELOG.md