equal
deleted
inserted
replaced
5 # This software may be used and distributed according to the terms of the |
5 # This software may be used and distributed according to the terms of the |
6 # GNU General Public License version 2 or any later version. |
6 # GNU General Public License version 2 or any later version. |
7 |
7 |
8 import os |
8 import os |
9 from mercurial import util |
9 from mercurial import util |
|
10 from mercurial.node import hex, nullid |
10 from mercurial.i18n import _ |
11 from mercurial.i18n import _ |
11 |
12 |
12 from common import NoRepo, commit, converter_source, checktool |
13 from common import NoRepo, commit, converter_source, checktool |
13 |
14 |
14 class convert_git(converter_source): |
15 class convert_git(converter_source): |
57 if ret: |
58 if ret: |
58 raise util.Abort(_('cannot retrieve git heads')) |
59 raise util.Abort(_('cannot retrieve git heads')) |
59 return heads |
60 return heads |
60 |
61 |
61 def catfile(self, rev, type): |
62 def catfile(self, rev, type): |
62 if rev == "0" * 40: |
63 if rev == hex(nullid): |
63 raise IOError() |
64 raise IOError() |
64 data, ret = self.gitread("git cat-file %s %s" % (type, rev)) |
65 data, ret = self.gitread("git cat-file %s %s" % (type, rev)) |
65 if ret: |
66 if ret: |
66 raise util.Abort(_('cannot read %r object at %s') % (type, rev)) |
67 raise util.Abort(_('cannot read %r object at %s') % (type, rev)) |
67 return data |
68 return data |