aboutsummaryrefslogtreecommitdiff
path: root/gitosis/repository.py
diff options
context:
space:
mode:
authorTommi Virtanen <tv@eagain.net>2007-12-31 19:30:27 +0200
committerTommi Virtanen <tv@eagain.net>2007-12-31 19:30:27 +0200
commit895fd8b7ad0766f5c320befa221fa7e4cdacfc71 (patch)
tree0dc1cb73e60087be1a56cdf2a3f9d9a2433a5563 /gitosis/repository.py
parentDon't always init repository when doing fast-import. (diff)
downloadgitosis-dakkar-895fd8b7ad0766f5c320befa221fa7e4cdacfc71.tar.gz
gitosis-dakkar-895fd8b7ad0766f5c320befa221fa7e4cdacfc71.tar.bz2
gitosis-dakkar-895fd8b7ad0766f5c320befa221fa7e4cdacfc71.zip
Allow using fast_import for more than initial commit.
Diffstat (limited to 'gitosis/repository.py')
-rw-r--r--gitosis/repository.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/gitosis/repository.py b/gitosis/repository.py
index 18a789c..092e41d 100644
--- a/gitosis/repository.py
+++ b/gitosis/repository.py
@@ -63,6 +63,7 @@ def fast_import(
commit_msg,
committer,
files,
+ parent=None,
):
"""
Create an initial commit.
@@ -97,10 +98,17 @@ committer %(committer)s now
data %(commit_msg_len)d
%(commit_msg)s
""" % dict(
- committer=committer,
- commit_msg_len=len(commit_msg),
- commit_msg=commit_msg,
- ))
+ committer=committer,
+ commit_msg_len=len(commit_msg),
+ commit_msg=commit_msg,
+ ))
+ if parent is not None:
+ assert not parent.startswith(':')
+ child.stdin.write("""\
+from %(parent)s
+""" % dict(
+ parent=parent,
+ ))
for index, (path, content) in enumerate(files):
child.stdin.write('M 100644 :%d %s\n' % (index+1, path))
child.stdin.close()