comparison mercurial/context.py @ 11539:a463e3c50212 stable

cmp: document the fact that we return True if content is different This is similar to the __builtin__.cmp behaviour, but still not straightforward, as the dailylife meaning of a comparison usually is "find out if they are different".
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Fri, 09 Jul 2010 11:02:39 +0900
parents 16fe98804fd8
children ce95d8b87d22
comparison
equal deleted inserted replaced
11538:16fe98804fd8 11539:a463e3c50212
351 return self._path 351 return self._path
352 def size(self): 352 def size(self):
353 return self._filelog.size(self._filerev) 353 return self._filelog.size(self._filerev)
354 354
355 def cmp(self, text): 355 def cmp(self, text):
356 """compare text with stored file revision
357
358 returns True if text is different than what is stored.
359 """
356 return self._filelog.cmp(self._filenode, text) 360 return self._filelog.cmp(self._filenode, text)
357 361
358 def renamed(self): 362 def renamed(self):
359 """check if file was actually renamed in this changeset revision 363 """check if file was actually renamed in this changeset revision
360 364
930 if err.errno != errno.ENOENT: 934 if err.errno != errno.ENOENT:
931 raise 935 raise
932 return (t, tz) 936 return (t, tz)
933 937
934 def cmp(self, text): 938 def cmp(self, text):
939 """compare text with disk content
940
941 returns True if text is different than what is on disk.
942 """
935 return self._repo.wread(self._path) != text 943 return self._repo.wread(self._path) != text
936 944
937 class memctx(object): 945 class memctx(object):
938 """Use memctx to perform in-memory commits via localrepo.commitctx(). 946 """Use memctx to perform in-memory commits via localrepo.commitctx().
939 947