servo-backout-pr: fix handling of backouts that touch servo and non-servo files (bug 1443377) r=gps
authorbyron jones <glob@mozilla.com>
Fri, 09 Mar 2018 13:32:44 +0800
changeset 5829 cf3cd79666bf
parent 5828 83f1cda27356
child 5830 f115bc96c7b7
push id2692
push usergszorc@mozilla.com
push dateMon, 12 Mar 2018 21:35:47 +0000
treeherderversion-control-tools@cf3cd79666bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1443377
servo-backout-pr: fix handling of backouts that touch servo and non-servo files (bug 1443377) r=gps MozReview-Commit-ID: dpeaBQXOfg
vcssync/mozvcssync/servo_backout.py
--- a/vcssync/mozvcssync/servo_backout.py
+++ b/vcssync/mozvcssync/servo_backout.py
@@ -75,27 +75,21 @@ def _find_backed_out_urls(hg_repo, githu
         else:
             logger.warning('failed to find merge id in #%s: %s'
                            % (backed_out_rev, backed_out_desc))
 
     return backed_out_urls
 
 
 def _get_touched_files(hg_repo, commit_node):
-    # Build list of files touched by this commit.
-
-    def strip_servo(filename):
-        assert filename.startswith('servo/')
-        return filename[len('servo/'):]
-
     # Grab a list of files under the servo/ directory touched by this
-    # change.
-    args = cmdbuilder('log', template='{join(files,"\n")}',
-                      r=commit_node, I='path:servo/')
-    return map(strip_servo, hg_repo.rawcommand(args).split('\n'))
+    # change, stripping the leading servo/ prefix.
+    args = cmdbuilder('log', template='{join(files,"\n")}', r=commit_node)
+    files = hg_repo.rawcommand(args).split('\n')
+    return [fn[len('servo/'):] for fn in files if fn.startswith('servo/')]
 
 
 def _build_commit_desc(commit_desc, backed_out_urls):
     # Build commit description and PR body.
     desc = commitparser.strip_commit_metadata(commit_desc).strip()
     if backed_out_urls:
         desc += '\n\n'
         for url in backed_out_urls:
@@ -109,16 +103,20 @@ def _create_pr_from_backout(integration_
         logger.info('processing backout %s: %s'
                     % (commit.node[:12], commit.desc.splitlines()[0]))
 
         backed_out_urls = _find_backed_out_urls(
             hg_repo, github_pr.upstream_repo().html_url,
             commit.desc, commit.node)
 
         touched_files = _get_touched_files(hg_repo, commit.node)
+        if not touched_files:
+            logger.info('backout %s does not modify servo files, ignoring'
+                        % commit.node[:12])
+            return
 
         # Set up commit and PR metadata.
 
         branch_name = 'gecko-backout'
 
         if pull_request_author:
             author = pull_request_author
         else: