# HG changeset patch # User mpm@selenic.com # Date 2005-08-27 21:43:20 # Node ID d62130f99a73db899a738d82cf44f32595da7d92 # Parent 1bca39b8561524a4f51f14d40e826cd77ca4e970 Move hash function back to revlog from node diff --git a/mercurial/node.py b/mercurial/node.py --- a/mercurial/node.py +++ b/mercurial/node.py @@ -19,18 +19,3 @@ def bin(node): def short(node): return hex(node[:6]) - -def hash(text, p1, p2): - """generate a hash from the given text and its parent hashes - - This hash combines both the current file contents and its history - in a manner that makes it easy to distinguish nodes with the same - content in the revision graph. - """ - l = [p1, p2] - l.sort() - s = sha.new(l[0]) - s.update(l[1]) - s.update(text) - return s.digest() - diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -14,6 +14,20 @@ import zlib, struct, sha, binascii, heap from mercurial import mdiff from node import * +def hash(text, p1, p2): + """generate a hash from the given text and its parent hashes + + This hash combines both the current file contents and its history + in a manner that makes it easy to distinguish nodes with the same + content in the revision graph. + """ + l = [p1, p2] + l.sort() + s = sha.new(l[0]) + s.update(l[1]) + s.update(text) + return s.digest() + def compress(text): """ generate a possibly-compressed representation of text """ if not text: return text