+ if check_out:
+ cache_files = __tree_status(files, tree_id)
+ # files which were added but need to be removed
+ rm_files = [x[1] for x in cache_files if x[0] in ['A']]
+
+ checkout(files, tree_id, True)
+ # checkout doesn't remove files
+ map(os.remove, rm_files)