[PATCH 1 of 2 v2] Allow commit date before Unix epoch

Adrian Buehlmann adrian at cadifra.com
Sat Apr 2 05:49:53 EDT 2016


On 2016-04-02 11:00, Christian Ebert wrote:
> * Adrian Buehlmann on Saturday, April 02, 2016 at 09:58:27 +0200
>> On 2016-04-02 02:55, Florent Gallaire wrote:
>>> # HG changeset patch
>>> # User Florent Gallaire <fgallaire at gmail.com>
>>> # Date 1459212616 -7200
>>> #      Tue Mar 29 02:50:16 2016 +0200
>>> # Node ID 8152e614ee77606b3e26f8935ded4157b4caa86c
>>> # Parent  ff0d3b6b287f89594bd8d0308fe2810d2a18ea01
>>> date: allow negative timestamp
>>>
>>> DVCS are very useful to store various texts (as legislation) written before
>>> Unix epoch. Fri, 13 Dec 1901 is a nice gain over Thu, 01 Jan 1970.
>>
>> This change would backout change dd24f3e7ca9e and thus reintroduce issue
>> 2513.
>>
>> In case you indeed manage to find a different solution for old issue
>> 2513, you would have to introduce that solution together with the
>> removal of the check for negative t values.
>>
>> Putting the mercurial codebase into an intermediate state which
>> reintroduces a bug is not acceptable.
>>
>> Perhaps a different solution for dd24f3e7ca9e is possible, but it likely
>> is quite a bit more complex than what you sent with your other patches.
>>
>> For example, you would have to explain the strategy how to introduce
>> negative time values. The current method of mercurial seems to be to
>> refuse negative time values on input - because it cannot handle these.
>>
>> If you introduce a solution which can handle negative time values, then
>> you have to show how such a soulution can be released. Old and new
>> versions of Mercurial coexist in the wild. For example, it has been a
>> long standing requirement that old versions of mercurial can talk to new
>> versions over the wire (push and pull). Introducing a change which
>> produces history data that old versions of mercurial can't handle is
>> usually a rather complex matter.
>>
>> See also:
>> https://www.mercurial-scm.org/wiki/CompatibilityRules
>> https://www.mercurial-scm.org/wiki/RequiresFile
>> https://www.mercurial-scm.org/wiki/ContributingChanges
> 
> Maybe the best way forward would be to develop this as an
> extension? If and once it's stable enough it could become either
> a shipped extension or part of core.

Maybe. Altough I think it might be sufficient to do this with a config
option. If the option is enabled, it would allow adding changesets with
negative timestamps. (Provided all other issues can be solved...)

The default value of said new config option would be to disallow adding
negative timestamps. Which means that if the user hasn't explicitly
enabled the option, Mercurial would still refuse negative timestamps on
input.

An argument could be made by pointing out that recent enough versions of
Mercurial currently simply display timestamps prior to "the epoch" (Thu
Jan 01 00:00:00 1970) as "the epoch" (per dd24f3e7ca9e). In other words:
Mercurial stopped crashing on negative timestamps in the log with
version 1.7.2 (released on Dec 1st, 2010).

> Speaking from a rather selfish point of view, as the feature
> could be useful for a personal project of mine.
> 

Yeah. I can imagine that this might be useful.


More information about the Mercurial-devel mailing list