-
Notifications
You must be signed in to change notification settings - Fork 1.2k
state: use dvcignore when accessing metadata #2161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7945fc5
c1b1861
bfa4932
6d2158a
9c7239d
f83b988
3cf01b8
27141c1
d922f08
5797fca
934477c
9427b4e
9b6cfd9
9a36293
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,6 @@ | ||
| import errno | ||
| import os | ||
|
|
||
| from dvc.ignore import DvcIgnoreFilter | ||
| from dvc.utils import relpath | ||
| from dvc.utils.compat import StringIO, BytesIO | ||
| from dvc.exceptions import DvcException | ||
|
|
@@ -103,13 +102,7 @@ def git_object_by_path(self, path): | |
| tree = tree[i] | ||
| return tree | ||
|
|
||
| def _walk( | ||
| self, | ||
| tree, | ||
| topdown=True, | ||
| ignore_file_handler=None, | ||
| dvc_ignore_filter=None, | ||
| ): | ||
| def _walk(self, tree, topdown=True): | ||
| dirs, nondirs = [], [] | ||
| for i in tree: | ||
| if i.mode == GIT_MODE_DIR: | ||
|
|
@@ -118,26 +111,16 @@ def _walk( | |
| nondirs.append(i.name) | ||
|
|
||
| if topdown: | ||
| if not dvc_ignore_filter: | ||
| dvc_ignore_filter = DvcIgnoreFilter( | ||
| tree.abspath, ignore_file_handler=ignore_file_handler | ||
| ) | ||
| dirs, nondirs = dvc_ignore_filter(tree.path, dirs, nondirs) | ||
| yield os.path.normpath(tree.abspath), dirs, nondirs | ||
|
|
||
| for i in dirs: | ||
| for x in self._walk( | ||
| tree[i], | ||
| topdown=True, | ||
| ignore_file_handler=ignore_file_handler, | ||
| dvc_ignore_filter=dvc_ignore_filter, | ||
| ): | ||
| for x in self._walk(tree[i], topdown=True): | ||
| yield x | ||
|
|
||
| if not topdown: | ||
| yield os.path.normpath(tree.abspath), dirs, nondirs | ||
|
|
||
| def walk(self, top, topdown=True, ignore_file_handler=None): | ||
| def walk(self, top, topdown=True, dvcignore=None): | ||
|
||
| """Directory tree generator. | ||
|
|
||
| See `os.walk` for the docs. Differences: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Judging by
__eq__, we expect only abs path here, right? Should we put a check/assert here? Otherwise it might get nasty with__eq__saying True for two relative paths.