clone, patch, convert: use hex(nullid) instead of '0'*40
authorMartin Geisler <mg@lazybytes.net>
Thu, 02 Sep 2010 12:08:13 +0200
changeset 12144 be9c4131a8f4
parent 12143 bf840a3d1af2
child 12147 2b171fe378c0
clone, patch, convert: use hex(nullid) instead of '0'*40
hgext/convert/git.py
mercurial/hg.py
mercurial/patch.py
--- a/hgext/convert/git.py	Thu Sep 02 11:20:23 2010 +0200
+++ b/hgext/convert/git.py	Thu Sep 02 12:08:13 2010 +0200
@@ -7,6 +7,7 @@
 
 import os
 from mercurial import util
+from mercurial.node import hex, nullid
 from mercurial.i18n import _
 
 from common import NoRepo, commit, converter_source, checktool
@@ -59,7 +60,7 @@
         return heads
 
     def catfile(self, rev, type):
-        if rev == "0" * 40:
+        if rev == hex(nullid):
             raise IOError()
         data, ret = self.gitread("git cat-file %s %s" % (type, rev))
         if ret:
--- a/mercurial/hg.py	Thu Sep 02 11:20:23 2010 +0200
+++ b/mercurial/hg.py	Thu Sep 02 12:08:13 2010 +0200
@@ -311,7 +311,8 @@
             # we need to re-init the repo after manually copying the data
             # into it
             dest_repo = repository(ui, dest)
-            src_repo.hook('outgoing', source='clone', node='0'*40)
+            src_repo.hook('outgoing', source='clone',
+                          node=node.hex(node.nullid))
         else:
             try:
                 dest_repo = repository(ui, dest, create=True)
--- a/mercurial/patch.py	Thu Sep 02 11:20:23 2010 +0200
+++ b/mercurial/patch.py	Thu Sep 02 12:08:13 2010 +0200
@@ -1352,7 +1352,7 @@
     '''print base85-encoded binary diff'''
     def gitindex(text):
         if not text:
-            return '0' * 40
+            return hex(nullid)
         l = len(text)
         s = util.sha1('blob %d\0' % l)
         s.update(text)