def whatchanged(di_path, paths): """Compared current filesystem with a saved dirindex from before. Returns a Changes() list.""" di_saved = DirIndex(di_path) di_fs = DirIndex() di_fs.walk(*paths) new, edited, statfix = di_saved.diff(di_fs) changes = Changes() changes += [Change.Overwrite(path) for path in new + edited] changes += [Change.Stat(path) for path in statfix] di_saved.prune(*paths) deleted = set(di_saved) - set(di_fs) changes += [Change.Deleted(path) for path in deleted] return changes
def whatchanged(di_path, paths): """Compared current filesystem with a saved dirindex from before. Returns a Changes() list.""" di_saved = DirIndex(di_path) di_fs = DirIndex() di_fs.walk(*paths) new, edited, statfix = di_saved.diff(di_fs) changes = Changes() changes += [ Change.Overwrite(path) for path in new + edited ] changes += [ Change.Stat(path) for path in statfix ] di_saved.prune(*paths) deleted = set(di_saved) - set(di_fs) changes += [ Change.Deleted(path) for path in deleted ] return changes