Skip to content

Commit

Permalink
BF: If 'modified' was set, AnnotatePaths failed to report on unavaila…
Browse files Browse the repository at this point in the history
…ble paths. (Closes #1880)
  • Loading branch information
bpoldrack committed Oct 7, 2017
1 parent 2708c1b commit 00dc333
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions datalad/interface/annotate_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ def __call__(
requested_paths = assure_list(path)

if modified is not None:
# modification detection wwould silently kill all nondataset paths
# modification detection would silently kill all nondataset paths
# but we have to complain about them, hence doing it here
if requested_paths and refds_path:
for r in requested_paths:
Expand All @@ -546,9 +546,21 @@ def __call__(
**dict(res_kwargs, **path_props))
res['status'] = nondataset_path_status
res['message'] = 'path not associated with reference dataset'
reported_paths[path] = res
reported_paths[r] = res
yield res

# preserve non-existing paths to be silently killed by modification
# detection and append them to requested_paths again after detection.
# TODO: This might be melted in with treatment of non dataset paths
# above. Re-appending those paths seems to be better than yielding
# directly to avoid code duplication, since both cases later on are
# dealt with again.
preserved_paths = []
if requested_paths:
[preserved_paths.append(r)
for r in requested_paths
if not lexists(r['path'] if isinstance(r, dict) else r)]

# replace the requested paths by those paths that were actually
# modified underneath or at a requested location
requested_paths = get_modified_subpaths(
Expand All @@ -560,6 +572,10 @@ def __call__(
report_untracked='all' if force_untracked_discovery else 'no',
recursion_limit=recursion_limit)

from itertools import chain
# re-append the preserved paths:
requested_paths = chain(requested_paths, iter(preserved_paths))

# do not loop over unique(), this could be a list of dicts
# we avoid duplicates manually below via `reported_paths`
for path in requested_paths:
Expand Down

0 comments on commit 00dc333

Please sign in to comment.