comparison mercurial/util.py @ 32769:b5524fd9a4e3

util: make filestat.__eq__ return True if both of self and old have None stat For convenience to compare two filestat objects regardless of None-ness of stat field.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Fri, 09 Jun 2017 13:07:48 +0900
parents 77f354ae1123
children 7ad95626f6a7
comparison
equal deleted inserted replaced
32768:ed66ec39933f 32769:b5524fd9a4e3
1522 # avoided, comparison of size, ctime and mtime is enough 1522 # avoided, comparison of size, ctime and mtime is enough
1523 # to exactly detect change of a file regardless of platform 1523 # to exactly detect change of a file regardless of platform
1524 return (self.stat.st_size == old.stat.st_size and 1524 return (self.stat.st_size == old.stat.st_size and
1525 self.stat.st_ctime == old.stat.st_ctime and 1525 self.stat.st_ctime == old.stat.st_ctime and
1526 self.stat.st_mtime == old.stat.st_mtime) 1526 self.stat.st_mtime == old.stat.st_mtime)
1527 except AttributeError:
1528 pass
1529 try:
1530 return self.stat is None and old.stat is None
1527 except AttributeError: 1531 except AttributeError:
1528 return False 1532 return False
1529 1533
1530 def isambig(self, old): 1534 def isambig(self, old):
1531 """Examine whether new (= self) stat is ambiguous against old one 1535 """Examine whether new (= self) stat is ambiguous against old one