mercurial/context.py
changeset 19578 2c149635c2c5
parent 19577 b52d572a2177
child 19579 964844d64ef8
equal deleted inserted replaced
19577:b52d572a2177 19578:2c149635c2c5
   445 
   445 
   446     @propertycache
   446     @propertycache
   447     def _repopath(self):
   447     def _repopath(self):
   448         return self._path
   448         return self._path
   449 
   449 
       
   450     def __nonzero__(self):
       
   451         try:
       
   452             self._filenode
       
   453             return True
       
   454         except error.LookupError:
       
   455             # file is missing
       
   456             return False
       
   457 
   450 class filectx(basefilectx):
   458 class filectx(basefilectx):
   451     """A filecontext object makes access to data related to a particular
   459     """A filecontext object makes access to data related to a particular
   452        filerevision convenient."""
   460        filerevision convenient."""
   453     def __init__(self, repo, path, changeid=None, fileid=None,
   461     def __init__(self, repo, path, changeid=None, fileid=None,
   454                  filelog=None, changectx=None):
   462                  filelog=None, changectx=None):
   493             #
   501             #
   494             # Linkrevs have several serious troubles with filtering that are
   502             # Linkrevs have several serious troubles with filtering that are
   495             # complicated to solve. Proper handling of the issue here should be
   503             # complicated to solve. Proper handling of the issue here should be
   496             # considered when solving linkrev issue are on the table.
   504             # considered when solving linkrev issue are on the table.
   497             return changectx(self._repo.unfiltered(), self._changeid)
   505             return changectx(self._repo.unfiltered(), self._changeid)
   498 
       
   499     def __nonzero__(self):
       
   500         try:
       
   501             self._filenode
       
   502             return True
       
   503         except error.LookupError:
       
   504             # file is missing
       
   505             return False
       
   506 
   506 
   507     def __str__(self):
   507     def __str__(self):
   508         return "%s@%s" % (self.path(), short(self.node()))
   508         return "%s@%s" % (self.path(), short(self.node()))
   509 
   509 
   510     def __repr__(self):
   510     def __repr__(self):