Move hex/bin bits to revlog
authormpm@selenic.com
Sat, 07 May 2005 16:12:31 -0800
changeset 37 a8811676c85a
parent 36 da28286bf6b7
child 38 ed1d3e3ca8e0
Move hex/bin bits to revlog Handle lookup of rev -1 of changelog
mercurial/hg.py
--- a/mercurial/hg.py	Sat May 07 16:11:36 2005 -0800
+++ b/mercurial/hg.py	Sat May 07 16:12:31 2005 -0800
@@ -5,15 +5,12 @@
 # This software may be used and distributed according to the terms
 # of the GNU General Public License, incorporated herein by reference.
 
-import sys, struct, sha, socket, os, time, base64, re, urllib2, binascii
+import sys, struct, sha, socket, os, time, base64, re, urllib2
 import urllib
 from mercurial import byterange
 from mercurial.transaction import *
 from mercurial.revlog import *
 
-def hex(node): return binascii.hexlify(node)
-def bin(node): return binascii.unhexlify(node)
-
 class filelog(revlog):
     def __init__(self, opener, path):
         s = self.encodepath(path)
@@ -112,6 +109,8 @@
         revlog.__init__(self, opener, "00changelog.i", "00changelog.d")
 
     def extract(self, text):
+        if not text:
+            return (nullid, "", 0, [], "")
         last = text.index("\n\n")
         desc = text[last + 2:]
         l = text[:last].splitlines()