diff options
author | ben <ben@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2002-06-27 20:28:49 +0000 |
---|---|---|
committer | ben <ben@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2002-06-27 20:28:49 +0000 |
commit | b1fb2cfd121cf5093e271e9e6947da7345e72fc3 (patch) | |
tree | 4485144e532acb1f8e399475e6f5f3c63d2faa97 /rdiff-backup/misc/librsync-many-files.py | |
parent | 0663475e9f7517fd444acafe24992fb549fafc86 (diff) | |
download | rdiff-backup-b1fb2cfd121cf5093e271e9e6947da7345e72fc3.tar.gz |
Added three new utilities for benchmarking and memory testing
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@155 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
Diffstat (limited to 'rdiff-backup/misc/librsync-many-files.py')
-rw-r--r-- | rdiff-backup/misc/librsync-many-files.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/rdiff-backup/misc/librsync-many-files.py b/rdiff-backup/misc/librsync-many-files.py new file mode 100644 index 0000000..239d2fb --- /dev/null +++ b/rdiff-backup/misc/librsync-many-files.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python + +"""Use librsync to transform everything in one dir to another""" + +import sys, os, librsync + +dir1, dir2 = sys.argv[1:3] +for i in xrange(1000): + dir1fn = "%s/%s" % (dir1, i) + dir2fn = "%s/%s" % (dir2, i) + + # Write signature file + f1 = open(dir1fn, "rb") + sigfile = open("sig", "wb") + librsync.filesig(f1, sigfile, 2048) + f1.close() + sigfile.close() + + # Write delta file + f2 = open(dir2fn, "r") + sigfile = open("sig", "rb") + deltafile = open("delta", "wb") + librsync.filerdelta(sigfile, f2, deltafile) + f2.close() + sigfile.close() + deltafile.close() + + # Write patched file + f1 = open(dir1fn, "rb") + newfile = open("%s/%s.out" % (dir1, i), "wb") + deltafile = open("delta", "rb") + librsync.filepatch(f1, deltafile, newfile) + f1.close() + deltafile.close() + newfile.close() + + |