# HG changeset patch # User Sean Farley # Date 2013-08-12 03:45:13 # Node ID 2c149635c2c56835c152f02043608d803fcb9a63 # Parent b52d572a217745ae11073fb7f6f11ba0c0727abb basefilectx: move __nonzero__ from filectx diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -447,6 +447,14 @@ class basefilectx(object): def _repopath(self): return self._path + def __nonzero__(self): + try: + self._filenode + return True + except error.LookupError: + # file is missing + return False + class filectx(basefilectx): """A filecontext object makes access to data related to a particular filerevision convenient.""" @@ -496,14 +504,6 @@ class filectx(basefilectx): # considered when solving linkrev issue are on the table. return changectx(self._repo.unfiltered(), self._changeid) - def __nonzero__(self): - try: - self._filenode - return True - except error.LookupError: - # file is missing - return False - def __str__(self): return "%s@%s" % (self.path(), short(self.node()))