[PATCH 4 of 7] util: make filestat.__eq__ return True if both of self and old have None stat

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Fri Jun 9 00:08:24 EDT 2017


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1496981268 -32400
#      Fri Jun 09 13:07:48 2017 +0900
# Node ID c14fcdcf528768538d1557b2ce0905db4c91bb85
# Parent  650b77396c6ea684d7ffca6c5e0921482eaffd49
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.

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -1525,6 +1525,10 @@ class filestat(object):
                     self.stat.st_ctime == old.stat.st_ctime and
                     self.stat.st_mtime == old.stat.st_mtime)
         except AttributeError:
+            pass
+        try:
+            return self.stat is None and old.stat is None
+        except AttributeError:
             return False
 
     def isambig(self, old):


More information about the Mercurial-devel mailing list