Updating commit timestamp on rebase [was: Updating commit timestamp on push.]
Kannan Goundan
kannan at cakoose.com
Fri Dec 6 00:59:04 UTC 2013
Thanks everyone for the words of caution about my "update timestamp on push"
idea :)
I went with a different approach: I modified rebase to always use the
current timestamp when rewriting a patch (instead of using the timestamp of
the original commit). This seems simpler and safer than my original idea,
but still achieves the goal of having the commit timestamp roughly match the
push timestamp (we rebase before pushing to the central repo).
Unfortunately the implementation is hacky. I wrote an extension that
monkey-patches hgext.rebase.concludenode and discards the "date" parameter
to repo.commit(). Roughly:
def patched_concludenode(repo, ...)
repo = RepoWrapper(repo)
orig_concludenode(repo, ...)
class RepoWrapper(object):
def __init__(self, repo):
self._original_repo = repo
def commit(self, ..., date=None, ...):
self._original_repo.commit(..., date=None, ...)
...
# Forward all the other methods through unchanged.
I'm a little worried about this breaking in weird corner cases or for new
Mercurial releases. Any ideas on how to do this more robustly?
In general, I think having "rebase" update the commit date is useful. If
others feel the same way, maybe the rebase extension could be modified to
support it directly, possibly through an option in hgrc? Any objections to
that idea?
More information about the Mercurial
mailing list