From: Avery Pennarun Date: Tue, 2 Feb 2010 05:54:10 +0000 (-0500) Subject: cmd-save: add --smaller option. X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=62f3faef86b6e2e7f32b12b14d7cf637a3c36eba;p=packages%2Fb%2Fbup.git cmd-save: add --smaller option. 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. --- diff --git a/cmd-save.py b/cmd-save.py index 8c7ec9e..429d646 100755 --- a/cmd-save.py +++ b/cmd-save.py @@ -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):