-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Allow patial update to wpt manifest #47588
Changes from all commits
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 |
---|---|---|
|
@@ -24,6 +24,7 @@ def get_tree(tests_root: Text, | |
manifest: "Manifest", | ||
manifest_path: Optional[Text], | ||
cache_root: Optional[Text], | ||
paths_to_update: Optional[List[Text]], | ||
working_copy: bool = True, | ||
rebuild: bool = False) -> "FileSystem": | ||
tree = None | ||
|
@@ -43,7 +44,9 @@ def get_tree(tests_root: Text, | |
manifest.url_base, | ||
manifest_path=manifest_path, | ||
cache_path=cache_root, | ||
rebuild=rebuild) | ||
paths_to_update=paths_to_update, | ||
rebuild=rebuild, | ||
) | ||
return tree | ||
|
||
|
||
|
@@ -91,10 +94,12 @@ def __init__(self, | |
tests_root: Text, | ||
url_base: Text, | ||
cache_path: Optional[Text], | ||
paths_to_update: Optional[List[Text]] = None, | ||
manifest_path: Optional[Text] = None, | ||
rebuild: bool = False) -> None: | ||
self.tests_root = tests_root | ||
self.url_base = url_base | ||
self.paths_to_update = paths_to_update or [''] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Defaulting to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is relevant to the other comments in |
||
self.ignore_cache = None | ||
self.mtime_cache = None | ||
tests_root_bytes = tests_root.encode("utf8") | ||
|
@@ -109,17 +114,29 @@ def __init__(self, | |
git = GitHasher(tests_root) | ||
self.hash_cache = git.hash_cache() | ||
|
||
def __iter__(self) -> Iterator[Tuple[Text, Optional[Text], bool]]: | ||
def _make_file_info(self, | ||
path: Text, | ||
path_stat: os.stat_result) -> Tuple[Text, Optional[Text], bool]: | ||
mtime_cache = self.mtime_cache | ||
for dirpath, dirnames, filenames in self.path_filter( | ||
walk(self.tests_root.encode("utf8"))): | ||
for filename, path_stat in filenames: | ||
path = os.path.join(dirpath, filename).decode("utf8") | ||
if mtime_cache is None or mtime_cache.updated(path, path_stat): | ||
file_hash = self.hash_cache.get(path, None) | ||
yield path, file_hash, True | ||
else: | ||
yield path, None, False | ||
if mtime_cache is None or mtime_cache.updated(path, path_stat): | ||
file_hash = self.hash_cache.get(path, None) | ||
return path, file_hash, True | ||
else: | ||
return path, None, False | ||
|
||
def __iter__(self) -> Iterator[Tuple[Text, Optional[Text], bool]]: | ||
for path_to_update in self.paths_to_update: | ||
path = os.path.join(self.tests_root, path_to_update) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want to be joining to From the CLI, I'd expect to be able to pass an absolute path in here and have it work — or give an error if it wasn't within the test root. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would like If we want to accept absolute paths from CLI, I think we can handle that when process the command line arguments. But after that we only need to keep the part relative to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We eventually want to yield something that is relative to |
||
if os.path.isfile(path): | ||
WeizhongX marked this conversation as resolved.
Show resolved
Hide resolved
|
||
path_stat = os.stat(path) | ||
yield self._make_file_info(path_to_update, path_stat) | ||
elif os.path.isdir(path): | ||
for dirpath, dirnames, filenames in self.path_filter( | ||
walk(path.encode("utf8"))): | ||
for filename, path_stat in filenames: | ||
path = os.path.join(path_to_update, | ||
os.path.join(dirpath, filename).decode("utf8")) | ||
yield self._make_file_info(path, path_stat) | ||
|
||
def dump_caches(self) -> None: | ||
for cache in [self.mtime_cache, self.ignore_cache]: | ||
|
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.
Presumably I'm missing something, but I don't see where this command line argument is being used.
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.
As I said in the description, Additional work is needed to plug in this into the test runner. This change only make patial update in
wpt manifest
command possible.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.
Line 49, above:
wpt/tools/manifest/update.py
Line 49 in b4aa684