# HG changeset patch # User Martin Geisler # Date 1283422093 -7200 # Node ID be9c4131a8f4b9d90671ce13b151c3627ddb6904 # Parent bf840a3d1af21958bb4d58e7f6abea62146a5f46 clone, patch, convert: use hex(nullid) instead of '0'*40 diff -r bf840a3d1af2 -r be9c4131a8f4 hgext/convert/git.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: diff -r bf840a3d1af2 -r be9c4131a8f4 mercurial/hg.py --- 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) diff -r bf840a3d1af2 -r be9c4131a8f4 mercurial/patch.py --- 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)