mercurial/context.py
changeset 19603 a92302f48a56
parent 19602 018ee491a6be
child 19604 ef7c47e4002f
equal deleted inserted replaced
19602:018ee491a6be 19603:a92302f48a56
   515         return self._changectx
   515         return self._changectx
   516 
   516 
   517     def path(self):
   517     def path(self):
   518         return self._path
   518         return self._path
   519 
   519 
       
   520     def isbinary(self):
       
   521         try:
       
   522             return util.binary(self.data())
       
   523         except IOError:
       
   524             return False
       
   525 
   520 class filectx(basefilectx):
   526 class filectx(basefilectx):
   521     """A filecontext object makes access to data related to a particular
   527     """A filecontext object makes access to data related to a particular
   522        filerevision convenient."""
   528        filerevision convenient."""
   523     def __init__(self, repo, path, changeid=None, fileid=None,
   529     def __init__(self, repo, path, changeid=None, fileid=None,
   524                  filelog=None, changectx=None):
   530                  filelog=None, changectx=None):
   574 
   580 
   575     def data(self):
   581     def data(self):
   576         return self._filelog.read(self._filenode)
   582         return self._filelog.read(self._filenode)
   577     def size(self):
   583     def size(self):
   578         return self._filelog.size(self._filerev)
   584         return self._filelog.size(self._filerev)
   579 
       
   580     def isbinary(self):
       
   581         try:
       
   582             return util.binary(self.data())
       
   583         except IOError:
       
   584             return False
       
   585 
   585 
   586     def cmp(self, fctx):
   586     def cmp(self, fctx):
   587         """compare with other file context
   587         """compare with other file context
   588 
   588 
   589         returns True if different than fctx.
   589         returns True if different than fctx.