Bug 1370936 - Default to not creating a commit when updating wpt metadata, r=ato draft
authorJames Graham <james@hoppipolla.co.uk>
Fri, 16 Jun 2017 10:43:16 +0100
changeset 595540 5492fff7041db7107a51330d414e24cdf486368b
parent 595539 0d24f744db6fa7e97f8d144b446015789f6b9e85
child 595541 2b950ddd6e51800e7c8f33079109f0cf0b2676a8
push id64345
push userbmo:james@hoppipolla.co.uk
push dateFri, 16 Jun 2017 10:22:22 +0000
reviewersato
bugs1370936
milestone56.0a1
Bug 1370936 - Default to not creating a commit when updating wpt metadata, r=ato MozReview-Commit-ID: FaYNn0hkXkD
testing/web-platform/tests/tools/wptrunner/wptrunner/update/metadata.py
testing/web-platform/tests/tools/wptrunner/wptrunner/update/sync.py
testing/web-platform/tests/tools/wptrunner/wptrunner/update/update.py
testing/web-platform/tests/tools/wptrunner/wptrunner/wptcommandline.py
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/update/metadata.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/update/metadata.py
@@ -35,17 +35,17 @@ class UpdateExpected(Step):
                                                      property_order=state.property_order,
                                                      boolean_properties=state.boolean_properties)
 
 
 class CreateMetadataPatch(Step):
     """Create a patch/commit for the metadata checkout"""
 
     def create(self, state):
-        if state.no_patch:
+        if not state.patch:
             return
 
         local_tree = state.local_tree
         sync_tree = state.sync_tree
 
         if sync_tree is not None:
             name = "web-platform-tests_update_%s_metadata" % sync_tree.rev
             message = "Update %s expected data to revision %s" % (state.suite_name, sync_tree.rev)
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/update/sync.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/update/sync.py
@@ -164,17 +164,17 @@ class CopyWorkTree(Step):
                       excludes=state.path_excludes,
                       includes=state.path_includes)
 
 
 class CreateSyncPatch(Step):
     """Add the updated test files to a commit/patch in the local tree."""
 
     def create(self, state):
-        if state.no_patch:
+        if not state.patch:
             return
 
         local_tree = state.local_tree
         sync_tree = state.sync_tree
 
         local_tree.create_patch("web-platform-tests_update_%s" % sync_tree.rev,
                                 "Update %s to revision %s" % (state.suite_name, sync_tree.rev))
         local_tree.add_new(os.path.relpath(state.tests_path,
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/update/update.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/update/update.py
@@ -66,17 +66,17 @@ class SyncFromUpstream(Step):
         if not state.sync_tree:
             os.mkdir(state.sync["path"])
             state.sync_tree = GitTree(root=state.sync["path"])
 
         kwargs = state.kwargs
         with state.push(["sync", "paths", "metadata_path", "tests_path", "local_tree",
                          "sync_tree"]):
             state.target_rev = kwargs["rev"]
-            state.no_patch = kwargs["no_patch"]
+            state.patch = kwargs["patch"]
             state.suite_name = kwargs["suite_name"]
             state.path_excludes = kwargs["exclude"]
             state.path_includes = kwargs["include"]
             runner = SyncFromUpstreamRunner(self.logger, state)
             runner.run()
 
 
 class UpdateMetadata(Step):
@@ -85,17 +85,17 @@ class UpdateMetadata(Step):
     def create(self, state):
         if not state.kwargs["run_log"]:
             return
 
         kwargs = state.kwargs
         with state.push(["local_tree", "sync_tree", "paths", "serve_root"]):
             state.run_log = kwargs["run_log"]
             state.ignore_existing = kwargs["ignore_existing"]
-            state.no_patch = kwargs["no_patch"]
+            state.patch = kwargs["patch"]
             state.suite_name = kwargs["suite_name"]
             state.product = kwargs["product"]
             state.config = kwargs["config"]
             runner = MetadataUpdateRunner(self.logger, state)
             runner.run()
 
 
 class UpdateRunner(StepRunner):
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/wptcommandline.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/wptcommandline.py
@@ -389,16 +389,18 @@ def check_args(kwargs):
     return kwargs
 
 
 def check_args_update(kwargs):
     set_from_config(kwargs)
 
     if kwargs["product"] is None:
         kwargs["product"] = "firefox"
+    if kwargs["patch"] is None:
+        kwargs["patch"] = kwargs["sync"]
 
 
 def create_parser_update(product_choices=None):
     from mozlog.structured import commandline
 
     import products
 
     if product_choices is None:
@@ -416,20 +418,22 @@ def create_parser_update(product_choices
                         help="Path to web-platform-tests"),
     parser.add_argument("--sync-path", action="store", type=abs_path,
                         help="Path to store git checkout of web-platform-tests during update"),
     parser.add_argument("--remote_url", action="store",
                         help="URL of web-platfrom-tests repository to sync against"),
     parser.add_argument("--branch", action="store", type=abs_path,
                         help="Remote branch to sync against")
     parser.add_argument("--rev", action="store", help="Revision to sync to")
-    parser.add_argument("--no-patch", action="store_true",
-                        help="Don't create an mq patch or git commit containing the changes.")
+    parser.add_argument("--patch", action="store_true", dest="patch", default=None,
+                        help="Create a VCS commit containing the changes.")
+    parser.add_argument("--no-patch", action="store_false", dest="patch",
+                        help="Don't create a VCS commit containing the changes.")
     parser.add_argument("--sync", dest="sync", action="store_true", default=False,
-                        help="Sync the tests with the latest from upstream")
+                        help="Sync the tests with the latest from upstream (implies --patch)")
     parser.add_argument("--ignore-existing", action="store_true", help="When updating test results only consider results from the logfiles provided, not existing expectations.")
     parser.add_argument("--continue", action="store_true", help="Continue a previously started run of the update script")
     parser.add_argument("--abort", action="store_true", help="Clear state from a previous incomplete run of the update script")
     parser.add_argument("--exclude", action="store", nargs="*",
                         help="List of glob-style paths to exclude when syncing tests")
     parser.add_argument("--include", action="store", nargs="*",
                         help="List of glob-style paths to include which would otherwise be excluded when syncing tests")
     # Should make this required iff run=logfile