]> arthur.barton.de Git - bup.git/commitdiff
Add compression level options to bup save and bup split
authorZoran Zaric <zz@zoranzaric.de>
Tue, 10 May 2011 00:59:52 +0000 (02:59 +0200)
committerAvery Pennarun <apenwarr@gmail.com>
Sun, 15 May 2011 19:39:01 +0000 (15:39 -0400)
For now 0 and 9 should suffice.  1 still is the default.

Signed-off-by: Zoran Zaric <zz@zoranzaric.de>
cmd/save-cmd.py
cmd/split-cmd.py

index b00635a29691f62812dc5ccc08b603c634712454..d8ab9486136bfdb4c742df2054626d18b01a4c72 100755 (executable)
@@ -21,6 +21,8 @@ f,indexfile=  the name of the index file (normally BUP_DIR/bupindex)
 strip      strips the path to every filename given
 strip-path= path-prefix to be stripped when saving
 graft=     a graft point *old_path*=*new_path* (can be used more than once)
+0          set compression-level to 0
+9          set compression-level to 9
 """
 o = options.Options(optspec)
 (opt, flags, extra) = o.parse(sys.argv[1:])
@@ -31,6 +33,13 @@ if not (opt.tree or opt.commit or opt.name):
 if not extra:
     o.fatal("no filenames given")
 
+if opt['0']:
+    compression_level = 0
+elif opt['9']:
+    compression_level = 9
+else:
+    compression_level = 1
+
 opt.progress = (istty2 and not opt.quiet)
 opt.smaller = parse_num(opt.smaller or 0)
 if opt.bwlimit:
@@ -74,7 +83,7 @@ if opt.remote or is_reverse:
 else:
     cli = None
     oldref = refname and git.read_ref(refname) or None
-    w = git.PackWriter()
+    w = git.PackWriter(compression_level=compression_level)
 
 handle_ctrl_c()
 
index b243c61400e918fdae1b19a907177c38a61ea2a1..b51f9978905cf38a99381e207a949bcc785dd47f 100755 (executable)
@@ -26,6 +26,8 @@ max-pack-size=  maximum bytes in a single pack
 max-pack-objects=  maximum number of objects in a single pack
 fanout=    maximum number of blobs in a single tree
 bwlimit=   maximum bytes/sec to transmit to server
+0          set compression-level to 0
+9          set compression-level to 9
 """
 o = options.Options(optspec)
 (opt, flags, extra) = o.parse(sys.argv[1:])
@@ -61,6 +63,14 @@ if opt.date:
 else:
     date = time.time()
 
+if opt['0']:
+    compression_level = 0
+elif opt['9']:
+    compression_level = 9
+else:
+    compression_level = 1
+
+
 
 total_bytes = 0
 def prog(filenum, nbytes):
@@ -84,13 +94,13 @@ refname = opt.name and 'refs/heads/%s' % opt.name or None
 if opt.noop or opt.copy:
     cli = pack_writer = oldref = None
 elif opt.remote or is_reverse:
-    cli = client.Client(opt.remote)
+    cli = client.Client(opt.remote, compression_level = compression_level)
     oldref = refname and cli.read_ref(refname) or None
     pack_writer = cli.new_packwriter()
 else:
     cli = None
     oldref = refname and git.read_ref(refname) or None
-    pack_writer = git.PackWriter()
+    pack_writer = git.PackWriter(compression_level = compression_level)
 
 if opt.git_ids:
     # the input is actually a series of git object ids that we should retrieve