From 4751015af643e69a76207ea705cbfa46d82efab9 Mon Sep 17 00:00:00 2001 From: Tommi Virtanen Date: Mon, 31 Dec 2007 19:30:27 +0200 Subject: Allow using fast_import for more than initial commit. --- gitosis/repository.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'gitosis/repository.py') diff --git a/gitosis/repository.py b/gitosis/repository.py index 304e491..272c3cb 100644 --- a/gitosis/repository.py +++ b/gitosis/repository.py @@ -70,6 +70,7 @@ def fast_import( commit_msg, committer, files, + parent=None, ): """ Create an initial commit. @@ -104,10 +105,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() -- cgit v1.2.3