##// END OF EJS Templates
dirstate: drop comparison primitive on the timestamp class...
marmoute -
r49226:8d585aa9 default
parent child Browse files
Show More
@@ -9,6 +9,8 b' import functools'
9 import os
9 import os
10 import stat
10 import stat
11
11
12 from .. import error
13
12
14
13 rangemask = 0x7FFFFFFF
15 rangemask = 0x7FFFFFFF
14
16
@@ -34,25 +36,14 b' class timestamp(tuple):'
34 return super(timestamp, cls).__new__(cls, value)
36 return super(timestamp, cls).__new__(cls, value)
35
37
36 def __eq__(self, other):
38 def __eq__(self, other):
37 self_secs, self_subsec_nanos = self
39 raise error.ProgrammingError(
38 other_secs, other_subsec_nanos = other
40 'timestamp should never be compared directly'
39 return self_secs == other_secs and (
40 self_subsec_nanos == other_subsec_nanos
41 or self_subsec_nanos == 0
42 or other_subsec_nanos == 0
43 )
41 )
44
42
45 def __gt__(self, other):
43 def __gt__(self, other):
46 self_secs, self_subsec_nanos = self
44 raise error.ProgrammingError(
47 other_secs, other_subsec_nanos = other
45 'timestamp should never be compared directly'
48 if self_secs > other_secs:
46 )
49 return True
50 if self_secs < other_secs:
51 return False
52 if self_subsec_nanos == 0 or other_subsec_nanos == 0:
53 # they are considered equal, so not "greater than"
54 return False
55 return self_subsec_nanos > other_subsec_nanos
56
47
57
48
58 def get_fs_now(vfs):
49 def get_fs_now(vfs):
General Comments 0
You need to be logged in to leave comments. Login now