fune/testing/web-platform/update/update.py
James Graham 29a12e51e0 Bug 1488692 - Remove old ini files when updating wpt metadata r=jdm
The easiest way to ensure that old metadata files are removed is
simply to check that all the existing metadata files still correspond
to a test file, and remove those that do not. This happens before
metadata update so that if the metadata update causes a patch to be
created, these changes are included in the patch.

Differential Revision: https://phabricator.services.mozilla.com/D5015

--HG--
extra : moz-landing-system : lando
2018-09-05 17:21:12 +00:00

43 lines
1.4 KiB
Python

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import os
from wptrunner.update.base import Step, StepRunner
from wptrunner.update.update import LoadConfig, SyncFromUpstream, UpdateMetadata, RemoveObsolete
from wptrunner.update.tree import NoVCSTree
from .tree import GitTree, HgTree, GeckoCommit
from .upstream import SyncToUpstream
class LoadTrees(Step):
"""Load gecko tree and sync tree containing web-platform-tests"""
provides = ["local_tree", "sync_tree"]
def create(self, state):
if os.path.exists(state.sync["path"]):
sync_tree = GitTree(root=state.sync["path"])
else:
sync_tree = None
if GitTree.is_type():
local_tree = GitTree(commit_cls=GeckoCommit)
elif HgTree.is_type():
local_tree = HgTree(commit_cls=GeckoCommit)
else:
local_tree = NoVCSTree()
state.update({"local_tree": local_tree,
"sync_tree": sync_tree})
class UpdateRunner(StepRunner):
"""Overall runner for updating web-platform-tests in Gecko."""
steps = [LoadConfig,
LoadTrees,
SyncToUpstream,
SyncFromUpstream,
RemoveObsolete,
UpdateMetadata]