comparison mercurial/filelog.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 d8d1b56d4519
children 2370e270a29a
comparison
equal deleted inserted replaced
11538:16fe98804fd8 11539:a463e3c50212
54 return len(self.read(node)) 54 return len(self.read(node))
55 55
56 return revlog.revlog.size(self, rev) 56 return revlog.revlog.size(self, rev)
57 57
58 def cmp(self, node, text): 58 def cmp(self, node, text):
59 """compare text with a given file revision""" 59 """compare text with a given file revision
60
61 returns True if text is different than what is stored.
62 """
60 63
61 # for renames, we have to go the slow way 64 # for renames, we have to go the slow way
62 if text.startswith('\1\n') or self.renamed(node): 65 if text.startswith('\1\n') or self.renamed(node):
63 t2 = self.read(node) 66 t2 = self.read(node)
64 return t2 != text 67 return t2 != text