From: Avery Pennarun Date: Thu, 31 Dec 2009 23:46:04 +0000 (-0500) Subject: 'bup split' takes a list of filenames on the command line. X-Git-Tag: bup-0.01~28 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=bup.git;a=commitdiff_plain;h=b368644810f69fe719b50511cc0c90d46c3ec06b 'bup split' takes a list of filenames on the command line. --- diff --git a/Makefile b/Makefile index ae2924b..d0df36c 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ runtests: all runtests-cmdline: all @echo "Testing \"$@\" in Makefile:" ./bup split -b tags1 - ./bup split -b tags2 + ./bup split -b testfile2 >tags2 diff -u tags1 tags2 || true wc -c testfile1 testfile2 wc -l tags1 tags2 diff --git a/cmd-split.py b/cmd-split.py index e5eb5c3..e755efe 100755 --- a/cmd-split.py +++ b/cmd-split.py @@ -52,7 +52,7 @@ def hashsplit_iter(f): lv = 0 while blob or not eof: if not eof and (buf.used() < BLOB_LWM or not blob): - bnew = sys.stdin.read(BLOB_HWM) + bnew = f.read(BLOB_HWM) if not len(bnew): eof = 1 #log('got %d, total %d\n' % (len(bnew), buf.used())) buf.put(bnew) @@ -74,8 +74,17 @@ def hashsplit_iter(f): log('%d\t' % nv) lv = nv + +def autofiles(filenames): + if not filenames: + yield sys.stdin + else: + for n in filenames: + yield open(n) + + optspec = """ -bup split [-t]