]> arthur.barton.de Git - bup.git/commitdiff
cmd-save: add --smaller option.
authorAvery Pennarun <apenwarr@gmail.com>
Tue, 2 Feb 2010 05:54:10 +0000 (00:54 -0500)
committerAvery Pennarun <apenwarr@gmail.com>
Tue, 2 Feb 2010 06:00:20 +0000 (01:00 -0500)
This makes it only back up files smaller than the given size.  bup can
handle big files, but you might want to do quicker incremental backups and
skip bigger files except once a day, or something.

It's also handy for testing.

cmd-save.py

index 8c7ec9ef7ca60c8c6f239d41c8ca4ad98e9a6648..429d6460746a11f312203d54ddcf0d4bf36ce41f 100755 (executable)
@@ -18,6 +18,7 @@ t,tree     output a tree id
 c,commit   output a commit id
 n,name=    name of backup set to update (if any)
 v,verbose  increase log output (can be used more than once)
+smaller=   only back up files smaller than n bytes
 """
 o = options.Options('bup save', optspec)
 (opt, flags, extra) = o.parse(sys.argv[1:])
@@ -108,6 +109,8 @@ for (transname,ent) in index.Reader(git.repo('bupindex')).filter(extra):
         mode = '%o' % ent.mode
         id = ent.sha
         shalists[-1].append((mode, file, id))
+    elif opt.smaller and ent.size >= opt.smaller:
+        add_error('skipping large file "%s"' % ent.name)
     else:
         try:
             if stat.S_ISREG(ent.mode):