5 class GitImporter(object):
6 """An importer for testgit repositories.
8 This importer simply delegates to git fast-import.
11 def __init__(self, repo):
12 """Creates a new importer for the specified repo.
17 def do_import(self, base):
18 """Imports a fast-import stream to the given directory.
20 Simply delegates to git fast-import.
23 dirname = self.repo.get_base_path(base)
25 gitdir = self.repo.gitpath
27 gitdir = os.path.abspath(os.path.join(dirname, '.git'))
28 path = os.path.abspath(os.path.join(dirname, 'git.marks'))
30 if not os.path.exists(dirname):
33 args = ["git", "--git-dir=" + gitdir, "fast-import", "--quiet", "--export-marks=" + path]
35 if os.path.exists(path):
36 args.append("--import-marks=" + path)
38 subprocess.check_call(args)