Inline _get_ignore_manager.
Jelmer Vernooij
2 days ago
1159 | 1159 | index: Index to check against |
1160 | 1160 | exclude_ignored: Whether to exclude ignored paths |
1161 | 1161 | """ |
1162 | ignore_manager = _get_ignore_manager(frompath, exclude_ignored) | |
1162 | if exclude_ignored: | |
1163 | with open_repo_closing(frompath) as r: | |
1164 | ignore_manager = IgnoreFilterManager.from_repo(r) | |
1165 | else: | |
1166 | ignore_manager = None | |
1163 | 1167 | |
1164 | 1168 | for ap, is_dir in _walk_working_dir_paths(frompath, basepath): |
1165 | if (exclude_ignored and | |
1169 | if (ignore_manager is not None and | |
1166 | 1170 | ignore_manager.is_ignored(os.path.relpath(ap, frompath))): |
1167 | 1171 | continue |
1168 | 1172 | if not is_dir: |
1169 | 1173 | ip = path_to_tree_path(basepath, ap) |
1170 | 1174 | if ip not in index: |
1171 | 1175 | yield os.path.relpath(ap, frompath) |
1172 | ||
1173 | ||
1174 | def _get_ignore_manager(frompath, exclude_ignored): | |
1175 | """Get a repo's IgnoreFilterManager from a path if required. | |
1176 | ||
1177 | Args: | |
1178 | frompath: The path of the repo | |
1179 | exclude_ignored: Whether to return the IgnoreFilterManager | |
1180 | """ | |
1181 | if exclude_ignored: | |
1182 | with open_repo_closing(frompath) as r: | |
1183 | ignore_manager = IgnoreFilterManager.from_repo(r) | |
1184 | ||
1185 | return ignore_manager | |
1186 | 1176 | |
1187 | 1177 | |
1188 | 1178 | def get_tree_changes(repo): |