D4876: amend: add config to skip amend if only date is changed (issue5828)

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Mon Oct 8 12:17:32 EDT 2018


martinvonz added a comment.


  In https://phab.mercurial-scm.org/D4876#74021, @pulkit wrote:
  
  > (Replying because I adviced Zharas to take up this issue and he is a new mercurial user and have less context on the problem)
  >
  > In https://phab.mercurial-scm.org/D4876#74017, @martinvonz wrote:
  >
  > > I'm not sure how I feel about this. I think we talked within the team at Google about always passing a `-D now` and decided not to do it because of the issue you're fixing here (I may be confusing the discussion with one about using `hg metaedit`). Still, I feel like this patch is a workaround for the real problem. I assume that the real problem is that there the date is not normally updated when you amend a commit (i.e. you want to always pass `-D now`, not a specific other timestamp). If that's the problem we're trying address, should we instead introduce a config called something like `amend.updatetimestamp` that makes it update the timestamp to the current time? That would naturally not update the timestamp if the timestamp was the only thing that changed (just like this patch does it). The natural generalization of `amend.updatetimestamp` is something like `rewrite.updatetimestamp` that would be respected by amend, histedit, rebase, etc.
  > >
  > > What do you think? Is that the use case you're trying to address with this patch?
  >
  >
  > I agree that the real problem is amend not updating the timestamp. People have aliased `amend` to `amend -D now` or just like you said, they always pass `-D now`. In such cases, even if the working directory is not changed, we end up creating a new commit with just date change. This patch tries to solve the problem of creating a new commit when only date has changed for people who do `amend -D now` always by preventing that if the config option is turned on.
  >
  > I like your idea of having a config option which is respected by all the commands.
  >
  > That said, will you like to see a v2 of this patch with inline comments addressed or we abandon this idea in favour of proposed config option to change the date.
  
  
  I should be easy to introduce such an option and make amend respect it (similar amount of code as this patch), so I'd just like to hear if others think it's a good idea first. If others agree with it, then it seems better to introduce the generic option right away. I can't/won't access IRC right now, but feel free to check there what others think and update this review when you have.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4876

To: Zharaskhan, #hg-reviewers, pulkit
Cc: martinvonz, pulkit, mercurial-devel


More information about the Mercurial-devel mailing list