Ejemplo n.º 1
0
def do_landable(git_gecko, git_wpt, *args, **kwargs):
    import update
    from base import LandableStatus
    from downstream import DownstreamAction, DownstreamSync
    from landing import load_sync_point, landable_commits, unlanded_with_type

    if kwargs["prev_wpt_head"] is None:
        sync_point = load_sync_point(git_gecko, git_wpt)
        prev_wpt_head = sync_point["upstream"]
        print("Last sync was to commit %s" % sync_point["upstream"])
    else:
        prev_wpt_head = kwargs["prev_wpt_head"]
    landable = landable_commits(
        git_gecko,
        git_wpt,
        prev_wpt_head,
        include_incomplete=kwargs["include_incomplete"])

    if landable is None:
        print("Landing will not add any new commits")
        wpt_head = None
    else:
        wpt_head, commits = landable
        print("Landing will update wpt head to %s, adding %i new PRs" %
              (wpt_head, len(commits)))

    if kwargs["all"] or kwargs["retrigger"]:
        unlandable = unlanded_with_type(git_gecko, git_wpt, wpt_head,
                                        prev_wpt_head)
        count = 0
        for pr, _, status in unlandable:
            count += 1
            msg = status.reason_str()
            if status == LandableStatus.missing_try_results:
                sync = DownstreamSync.for_pr(git_gecko, git_wpt, pr)
                next_action = sync.next_action
                reason = next_action.reason_str()
                if next_action == DownstreamAction.wait_try:
                    latest_try_push = sync.latest_try_push
                    reason = "%s %s" % (reason,
                                        latest_try_push.treeherder_url(
                                            latest_try_push.try_rev))
                msg = "%s (%s)" % (msg, reason)
            elif status == LandableStatus.error:
                sync = DownstreamSync.for_pr(git_gecko, git_wpt, pr)
                msg = "%s (%s)" % (msg, sync.error["message"].split("\n")[0])
            print("%s: %s" % (pr, msg))

        print("%i PRs are unlandable:" % count)

        if kwargs["retrigger"]:
            errors = update.retrigger(git_gecko, git_wpt, unlandable)
            if errors:
                print("The following PRs have errors:\n%s" % "\n".join(errors))
Ejemplo n.º 2
0
def filter_commits(commits):
    rv = []
    for commit in commits:
        if (commit.metadata.get("wptsync-skip") or
            DownstreamSync.has_metadata(commit.msg) or
            (commit.is_backout and not commit.wpt_commits_backed_out()[0])):
            continue
        rv.append(commit)
    return rv
Ejemplo n.º 3
0
 def _filter_commit(self, commit):
     if commit.metadata.get("wptsync-skip"):
         return False
     if DownstreamSync.has_metadata(commit.msg):
         return False
     if commit.is_backout:
         commits, _ = commit.wpt_commits_backed_out()
         for backout_commit in commits:
             if backout_commit.sha1 in self.seen:
                 return True
     if commit.bug == self.bug:
         if commit.is_empty(env.config["gecko"]["path"]["wpt"]):
             return False
         self.seen.add(commit.sha1)
         return True
     return False