changeset 1091:d62130f99a73

Move hash function back to revlog from node
author mpm@selenic.com
date Sat, 27 Aug 2005 14:43:20 -0700
parents 1bca39b85615
children 0a02315976ff
files mercurial/node.py mercurial/revlog.py
diffstat 2 files changed, 14 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/node.py	Sat Aug 27 14:31:41 2005 -0700
+++ b/mercurial/node.py	Sat Aug 27 14:43:20 2005 -0700
@@ -19,18 +19,3 @@
 
 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()
-
--- a/mercurial/revlog.py	Sat Aug 27 14:31:41 2005 -0700
+++ b/mercurial/revlog.py	Sat Aug 27 14:43:20 2005 -0700
@@ -14,6 +14,20 @@
 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