Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BF: Don't claim content size is zero without status --annex availablity #3378

Merged
merged 1 commit into from May 3, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 17 additions & 7 deletions datalad/core/local/status.py
Expand Up @@ -411,18 +411,28 @@ def custom_result_summary_renderer(results): # pragma: no cover
# fish out sizes of annexed files. those will only be present
# with --annex ...
annexed = [
(int(r['bytesize']), r.get('has_content', False))
(int(r['bytesize']), r.get('has_content', None))
for r in results
if r.get('action', None) == 'status' \
and 'key' in r and 'bytesize' in r]
if annexed:
have_availability = any(a[1] is not None for a in annexed)
total_size = bytes2human(sum(a[0] for a in annexed))
# we have availability info encoded in the results
from datalad.ui import ui
ui.message(
"{} annex'd {} ({}/{} present/total size)".format(
len(annexed),
single_or_plural('file', 'files', len(annexed)),
bytes2human(sum(a[0] for a in annexed if a[1])),
bytes2human(sum(a[0] for a in annexed))))
if have_availability:
ui.message(
"{} annex'd {} ({}/{} present/total size)".format(
len(annexed),
single_or_plural('file', 'files', len(annexed)),
bytes2human(sum(a[0] for a in annexed if a[1])),
total_size))
else:
ui.message(
"{} annex'd {} ({} recorded total size)".format(
len(annexed),
single_or_plural('file', 'files', len(annexed)),
total_size))


# TODO move to datalad.utils eventually
Expand Down