Submitter | Katsunori FUJIWARA |
---|---|
Date | June 9, 2017, 4:08 a.m. |
Message ID | <c14fcdcf528768538d15.1496981304@speaknoevil> |
Download | mbox | patch |
Permalink | /patch/21263/ |
State | Accepted |
Headers | show |
Comments
On Fri, 09 Jun 2017 13:08:24 +0900, FUJIWARA Katsunori wrote: > # HG changeset patch > # User FUJIWARA Katsunori <foozy@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 Nit: this could be 'self.stat is old.stat'.
At Sun, 11 Jun 2017 12:26:20 +0900, Yuya Nishihara wrote: > > On Fri, 09 Jun 2017 13:08:24 +0900, FUJIWARA Katsunori wrote: > > # HG changeset patch > > # User FUJIWARA Katsunori <foozy@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 > > Nit: this could be 'self.stat is old.stat'. > Ah, you are right! Should I follow up for this change ?
On Mon, 12 Jun 2017 06:51:52 +0900, FUJIWARA Katsunori wrote: > At Sun, 11 Jun 2017 12:26:20 +0900, > Yuya Nishihara wrote: > > > > On Fri, 09 Jun 2017 13:08:24 +0900, FUJIWARA Katsunori wrote: > > > # HG changeset patch > > > # User FUJIWARA Katsunori <foozy@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 > > > > Nit: this could be 'self.stat is old.stat'. > > > > Ah, you are right! Should I follow up for this change ? This is just a cosmetic issue. If you prefer my version, please send a follow up.
Patch
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):