4 from git_remote_helpers
.util
import check_call
7 class GitImporter(object):
8 """An importer for testgit repositories.
10 This importer simply delegates to git fast-import.
13 def __init__(self
, repo
):
14 """Creates a new importer for the specified repo.
19 def do_import(self
, base
):
20 """Imports a fast-import stream to the given directory.
22 Simply delegates to git fast-import.
25 dirname
= self
.repo
.get_base_path(base
)
27 gitdir
= self
.repo
.gitpath
29 gitdir
= os
.path
.abspath(os
.path
.join(dirname
, '.git'))
30 path
= os
.path
.abspath(os
.path
.join(dirname
, 'git.marks'))
32 if not os
.path
.exists(dirname
):
35 args
= ["git", "--git-dir=" + gitdir
, "fast-import", "--quiet", "--export-marks=" + path
]
37 if os
.path
.exists(path
):
38 args
.append("--import-marks=" + path
)