simplify fast-import flow

This commit is contained in:
Daniel Lenski 2014-10-14 12:31:20 -07:00
parent 695d460665
commit 839f2f86e9
1 changed files with 4 additions and 7 deletions

View File

@ -62,7 +62,7 @@ def main():
os.chdir(path)
# Create fast-import data stream
with open('fast-import-data', 'w+b') as fid:
with open('fast-import-data', 'wb') as fid:
fid.write('reset refs/heads/master\n')
for rev in page.revisions(dir='newer', prop='ids|timestamp|flags|comment|user|content'):
id = rev['revid']
@ -80,13 +80,10 @@ def main():
fid.write('data %d\n%s\n' % (len(text), text))
fid.write('done\n')
if args.doimport:
sp.check_call(['git','init','--bare'])
fid.seek(0, 0)
sp.check_call(['git', 'fast-import','--quiet'], stdin=fid)
if args.doimport:
os.unlink('fast-import-data')
sp.check_call(['git','init','--bare'])
sp.check_call(['git', 'fast-import','--quiet'], stdin=open(fid.name,"rb"))
os.unlink('fast-import-data')
if __name__=='__main__':
main()