[Updated] D11841: dirstate: drop comparison primitive on the timestamp class
marmoute (Pierre-Yves David)
phabricator at mercurial-scm.org
Fri Dec 3 10:43:11 UTC 2021
Closed by commit rHG8d585aa9becf: dirstate: drop comparison primitive on the timestamp class (authored by marmoute).
This revision was automatically updated to reflect the committed changes.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D11841?vs=31270&id=31286
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D11841/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D11841
AFFECTED FILES
mercurial/dirstateutils/timestamp.py
CHANGE DETAILS
diff --git a/mercurial/dirstateutils/timestamp.py b/mercurial/dirstateutils/timestamp.py
--- a/mercurial/dirstateutils/timestamp.py
+++ b/mercurial/dirstateutils/timestamp.py
@@ -9,6 +9,8 @@
import os
import stat
+from .. import error
+
rangemask = 0x7FFFFFFF
@@ -34,25 +36,14 @@
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):
To: marmoute, #hg-reviewers, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20211203/5adb18b7/attachment-0002.html>
More information about the Mercurial-patches
mailing list