Exemple #1
0
def test_wpt_empty(git_gecko, local_gecko_commit):
    commit = local_gecko_commit(
        meta_changes={"test/test1.html.ini": "example change"},
        other_changes={"example": "example change"})
    gecko_commit = sync_commit.GeckoCommit(git_gecko, commit)
    assert not gecko_commit.is_empty()
    assert not gecko_commit.has_wpt_changes()
Exemple #2
0
def test_upstream_reprocess_commits(git_gecko, git_wpt, upstream_gecko_commit,
                                    upstream_gecko_backout):
    bug = "1234"
    test_changes = {"README": "Change README\n"}
    rev = upstream_gecko_commit(test_changes=test_changes, bug=bug,
                                message="Change README")

    update_repositories(git_gecko, git_wpt, wait_gecko_commit=rev)
    pushed, _, _ = upstream.gecko_push(git_gecko, git_wpt, "inbound", rev,
                                       raise_on_error=True)
    sync = pushed.pop()
    assert sync.gecko_commits[0].upstream_sync(git_gecko, git_wpt) == sync

    backout_rev = upstream_gecko_backout(rev, bug)

    update_repositories(git_gecko, git_wpt, wait_gecko_commit=backout_rev)
    upstream.gecko_push(git_gecko, git_wpt, "inbound", backout_rev, raise_on_error=True)

    sync_point = git_gecko.refs["sync/upstream/inbound"]
    sync_point.commit = (sync_commit.GeckoCommit(git_gecko, git_gecko.cinnabar.hg2git(rev))
                         .commit.parents[0])

    pushed, landed, failed = upstream.gecko_push(git_gecko, git_wpt, "inbound", backout_rev,
                                                 raise_on_error=True)
    assert len(pushed) == len(landed) == len(failed) == 0
Exemple #3
0
def test_move_utf16(git_gecko, git_wpt_upstream, git_wpt, wpt_worktree, local_gecko_commit):
    commit = local_gecko_commit(other_changes={"test_file": u"\U0001F60A".encode("utf16")})
    gecko_commit = sync_commit.GeckoCommit(git_gecko, commit)

    git_wpt.remotes.origin.fetch()
    git_wpt = wpt_worktree()

    with patch("sync.commit.GeckoCommit.canonical_rev", PropertyMock()) as m:
        m.return_value = gecko_commit.sha1
        wpt_commit = gecko_commit.move(git_wpt)

    assert git_wpt.git.show("%s:test_file" % wpt_commit.sha1,
                            stdout_as_string=False).decode("utf16") == u"\U0001F60A"
Exemple #4
0
def test_create_pr_backout(git_gecko, git_wpt, upstream_gecko_commit,
                           upstream_gecko_backout):
    bug = "1234"
    test_changes = {"README": "Change README\n"}
    rev = upstream_gecko_commit(test_changes=test_changes,
                                bug=bug,
                                message="Change README")

    update_repositories(git_gecko, git_wpt, wait_gecko_commit=rev)
    upstream.gecko_push(git_gecko,
                        git_wpt,
                        "autoland",
                        rev,
                        raise_on_error=True)

    syncs = upstream.UpstreamSync.for_bug(git_gecko, git_wpt, bug)
    assert syncs.keys() == ["open"]
    assert len(syncs["open"]) == 1
    sync = syncs["open"].pop()
    assert sync.bug == "1234"
    assert sync.status == "open"
    assert len(sync.gecko_commits) == 1
    assert len(sync.wpt_commits) == 1
    assert sync.pr

    backout_rev = upstream_gecko_backout(rev, bug)

    update_repositories(git_gecko, git_wpt, wait_gecko_commit=backout_rev)
    upstream.gecko_push(git_gecko,
                        git_wpt,
                        "autoland",
                        backout_rev,
                        raise_on_error=True)
    syncs = upstream.UpstreamSync.for_bug(git_gecko, git_wpt, bug)
    assert syncs.keys() == ["incomplete"]
    assert len(syncs["incomplete"]) == 1
    sync = syncs["incomplete"].pop()
    assert sync.bug == "1234"
    assert len(sync.gecko_commits) == 0
    assert len(sync.wpt_commits) == 1
    assert len(sync.upstreamed_gecko_commits) == 1
    assert sync.status == "incomplete"
    backout_commit = sync_commit.GeckoCommit(git_gecko,
                                             git_gecko.cinnabar.hg2git(rev))
    assert backout_commit.upstream_sync(git_gecko, git_wpt) == sync
def test_empty(git_gecko, gecko_worktree):
    gecko_worktree.git.commit(allow_empty=True, message="Empty commit")
    commit = gecko_worktree.head.commit
    gecko_commit = sync_commit.GeckoCommit(git_gecko, commit)
    assert gecko_commit.is_empty()