Mercurial > hg
changeset 2890:5df3e5cf16bc
Move cmp bits from filelog to revlog
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Tue, 15 Aug 2006 14:18:13 -0500 |
parents | 20b95aef3fe0 |
children | 95cc73523983 |
files | mercurial/filelog.py mercurial/revlog.py |
diffstat | 2 files changed, 14 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/filelog.py Tue Aug 15 14:06:50 2006 -0500 +++ b/mercurial/filelog.py Tue Aug 15 14:18:13 2006 -0500 @@ -73,18 +73,7 @@ t2 = self.read(node) return t2 == text - p1, p2 = self.parents(node) - h = hash(text, p1, p2) - - return h != node - - def makenode(self, node, text): - """calculate a file nodeid for text, descended or possibly - unchanged from node""" - - if self.cmp(node, text): - return hash(text, node, nullid) - return node + return revlog.cmp(self, node, text) def annotate(self, node):
--- a/mercurial/revlog.py Tue Aug 15 14:06:50 2006 -0500 +++ b/mercurial/revlog.py Tue Aug 15 14:18:13 2006 -0500 @@ -766,6 +766,19 @@ raise RevlogError(_("No match found")) + def cmp(self, node, text): + """compare text with a given file revision""" + p1, p2 = self.parents(node) + return hash(text, p1, p2) != node + + def makenode(self, node, text): + """calculate a file nodeid for text, descended or possibly + unchanged from node""" + + if self.cmp(node, text): + return hash(text, node, nullid) + return node + def diff(self, a, b): """return a delta between two revisions""" return mdiff.textdiff(a, b)