'Add a new pack to this object store.
:return: Fileobject to write to, a commit function to
call when the pack is finished and an abort
function.'

def add_pack(self):

    (fd, path) = tempfile.mkstemp(dir=self.pack_dir, suffix='.pack')
    f = os.fdopen(fd, 'wb')
    def commit():
        os.fsync(fd)
        f.close()
        if (os.path.getsize(path) > 0):
            return self.move_in_pack(path)
        else:
            os.remove(path)
            return None
    def abort():
        f.close()
        os.remove(path)
    return (f, commit, abort)
