-#!/usr/bin/env python
-import sys, glob, tempfile
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
+
+from __future__ import absolute_import
+import glob, os, sys, tempfile
+
from bup import options, git, bloom
-from bup.helpers import *
+from bup.helpers import (add_error, debug1, handle_ctrl_c, log, progress, qprogress,
+ saved_errors)
optspec = """
bup bloom [options...]
msg = b is None and 'creating from' or 'adding'
if not _first: _first = path
dirprefix = (_first != path) and git.repo_rel(path)+': ' or ''
- progress('bloom: %s%s %d file%s (%d object%s).\n'
+ progress('bloom: %s%s %d file%s (%d object%s).\r'
% (dirprefix, msg,
len(add), len(add)!=1 and 's' or '',
add_count, add_count!=1 and 's' or ''))
tfname = None
if b is None:
tfname = os.path.join(path, 'bup.tmp.bloom')
- tf = open(tfname, 'w+')
- b = bloom.create(tfname, f=tf, expected=add_count, k=opt.k)
+ b = bloom.create(tfname, expected=add_count, k=opt.k)
count = 0
icount = 0
for name in add:
count += 1
icount += len(ix)
+ # Currently, there's an open file object for tfname inside b.
+ # Make sure it's closed before rename.
+ b.close()
+
if tfname:
os.rename(tfname, outfilename)