Skip to content

Commit

Permalink
caches move creation of file index before dir update
Browse files Browse the repository at this point in the history
looks like dir update removes whole dirs/moves them to trash

reminder that caching like this is currently completely broken and
needs testing
  • Loading branch information
tgbugs committed Nov 25, 2019
1 parent 4ff3365 commit 264684e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion augpathlib/caches.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,9 @@ def _bootstrap_recursive(self, only=tuple(), skip=tuple()):
rcs = sname(self.remote._rchildren(create_cache=False))
local_paths = list(self.local.rchildren)
local_files = set(p for p in local_paths if p.is_file() or p.is_broken_symlink())
file_index = {f.cache.id:f for f in local_files} # FIXME WARNING can get big
# FIXME have to compute file_index here because for some reason
# computing local_dirs will remove folders entirely !??
local_dirs = set(p.relative_to(self.anchor) for p in local_paths if p.is_dir())
if local_dirs:
remote_dirs = set(c for c in rcs if c.is_dir())
Expand All @@ -305,7 +308,6 @@ def _bootstrap_recursive(self, only=tuple(), skip=tuple()):
if not ld.as_posix().startswith(d.as_posix()))
old_local = local_dirs - rd

file_index = {f.cache.id:f for f in local_files} # FIXME WARNING can get big
for child in sorted(rcs, key=lambda c: len(c.as_path().as_posix())):
# use the remote's recursive implementation
# not the local implementation, since the
Expand Down

0 comments on commit 264684e

Please sign in to comment.