Dulwich.io dulwich / master
Inline _get_ignore_manager. Jelmer Vernooń≥ 2 days ago
1 changed file(s) with 6 addition(s) and 16 deletion(s). Raw diff Collapse all Expand all
11591159 index: Index to check against
11601160 exclude_ignored: Whether to exclude ignored paths
11611161 """
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
11631167
11641168 for ap, is_dir in _walk_working_dir_paths(frompath, basepath):
1165 if (exclude_ignored and
1169 if (ignore_manager is not None and
11661170 ignore_manager.is_ignored(os.path.relpath(ap, frompath))):
11671171 continue
11681172 if not is_dir:
11691173 ip = path_to_tree_path(basepath, ap)
11701174 if ip not in index:
11711175 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
11861176
11871177
11881178 def get_tree_changes(repo):