Read about our upcoming Code of Conduct on this issue

This instance was upgraded to Heptapod 0.28.0 today

Commit d14cc552 authored by Pierre-Yves David's avatar Pierre-Yves David 🐙
Browse files

dirstate: drop comparison primitive on the timestamp class

All comparison are now managed without using operator :

- the status mtime comparisons is handled by the DirstateItem,
- the fixup reliability check,
- the update "hack".

So we no longer needs the operator and should discourage its usage.

Differential Revision: https://phab.mercurial-scm.org/D11841
parent c0d88407b7d4
......@@ -9,6 +9,8 @@ import functools
import os
import stat
from .. import error
rangemask = 0x7FFFFFFF
......@@ -34,25 +36,14 @@ class timestamp(tuple):
return super(timestamp, cls).__new__(cls, value)
def __eq__(self, other):
self_secs, self_subsec_nanos = self
other_secs, other_subsec_nanos = other
return self_secs == other_secs and (
self_subsec_nanos == other_subsec_nanos
or self_subsec_nanos == 0
or other_subsec_nanos == 0
raise error.ProgrammingError(
'timestamp should never be compared directly'
)
def __gt__(self, other):
self_secs, self_subsec_nanos = self
other_secs, other_subsec_nanos = other
if self_secs > other_secs:
return True
if self_secs < other_secs:
return False
if self_subsec_nanos == 0 or other_subsec_nanos == 0:
# they are considered equal, so not "greater than"
return False
return self_subsec_nanos > other_subsec_nanos
raise error.ProgrammingError(
'timestamp should never be compared directly'
)
def get_fs_now(vfs):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment