2019-05-14 12:30:56 +03:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# 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
|
|
|
|
import shutil
|
2019-06-04 13:49:42 +03:00
|
|
|
import time
|
2019-06-01 14:09:50 +03:00
|
|
|
from datetime import datetime, timezone
|
2019-05-14 12:30:56 +03:00
|
|
|
|
|
|
|
import hglib
|
|
|
|
import pytest
|
|
|
|
import responses
|
2019-06-01 14:09:50 +03:00
|
|
|
from dateutil.relativedelta import relativedelta
|
2019-05-14 12:30:56 +03:00
|
|
|
|
|
|
|
from bugbug import repository
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
def fake_hg_repo(tmpdir):
|
|
|
|
tmp_path = tmpdir.strpath
|
|
|
|
dest = os.path.join(tmp_path, "repos")
|
|
|
|
local = os.path.join(dest, "local")
|
|
|
|
remote = os.path.join(dest, "remote")
|
|
|
|
for d in [local, remote]:
|
|
|
|
os.makedirs(d)
|
|
|
|
hglib.init(d)
|
|
|
|
|
|
|
|
os.environ["USER"] = "app"
|
|
|
|
hg = hglib.open(local)
|
|
|
|
|
|
|
|
hg.branch(b"central")
|
|
|
|
|
|
|
|
responses.add_passthru("http://localhost:8000")
|
|
|
|
|
|
|
|
yield hg, local, remote
|
|
|
|
|
|
|
|
hg.close()
|
|
|
|
|
|
|
|
|
|
|
|
def copy_pushlog_database(remote, local):
|
|
|
|
shutil.copyfile(
|
|
|
|
os.path.join(remote, ".hg/pushlog2.db"), os.path.join(local, ".hg/pushlog2.db")
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def add_file(hg, repo_dir, name, contents):
|
|
|
|
path = os.path.join(repo_dir, name)
|
|
|
|
|
|
|
|
with open(path, "w") as f:
|
|
|
|
f.write(contents)
|
|
|
|
|
|
|
|
hg.add(files=[bytes(path, "ascii")])
|
|
|
|
|
|
|
|
|
2019-06-01 14:09:50 +03:00
|
|
|
def commit(hg, commit_message=None, date=datetime(2019, 4, 16, tzinfo=timezone.utc)):
|
|
|
|
commit_message = (
|
|
|
|
commit_message
|
|
|
|
if commit_message is not None
|
|
|
|
else "Commit {}".format(
|
|
|
|
" ".join(
|
|
|
|
[elem.decode("ascii") for status in hg.status() for elem in status]
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2019-05-14 12:30:56 +03:00
|
|
|
|
2019-06-01 14:09:50 +03:00
|
|
|
i, revision = hg.commit(
|
|
|
|
message=commit_message, user="Moz Illa <milla@mozilla.org>", date=date
|
|
|
|
)
|
2019-05-14 12:30:56 +03:00
|
|
|
|
|
|
|
return str(revision, "ascii")
|
|
|
|
|
|
|
|
|
|
|
|
def test_get_revs(fake_hg_repo):
|
|
|
|
hg, local, remote = fake_hg_repo
|
|
|
|
|
|
|
|
add_file(hg, local, "file1", "1\n2\n3\n4\n5\n6\n7\n")
|
|
|
|
revision1 = commit(hg)
|
|
|
|
|
2019-05-24 16:33:57 +03:00
|
|
|
revs = repository.get_revs(hg)
|
2019-05-14 12:30:56 +03:00
|
|
|
|
|
|
|
assert len(revs) == 1, "There should be one revision now"
|
|
|
|
assert revs[0].decode("ascii") == revision1
|
|
|
|
|
|
|
|
add_file(hg, local, "file2", "1\n2\n3\n4\n5\n6\n7\n")
|
|
|
|
revision2 = commit(hg)
|
|
|
|
|
2019-05-24 16:33:57 +03:00
|
|
|
revs = repository.get_revs(hg)
|
2019-05-14 12:30:56 +03:00
|
|
|
|
|
|
|
assert len(revs) == 2, "There should be two revisions now"
|
|
|
|
assert revs[0].decode("ascii") == revision1
|
|
|
|
assert revs[1].decode("ascii") == revision2
|
|
|
|
|
2019-06-03 17:02:01 +03:00
|
|
|
add_file(hg, local, "file3", "1\n2\n3\n4\n5\n6\n7\n")
|
|
|
|
revision3 = commit(hg)
|
|
|
|
|
|
|
|
revs = repository.get_revs(hg)
|
|
|
|
|
|
|
|
assert len(revs) == 3, "There should be three revisions now"
|
|
|
|
assert revs[0].decode("ascii") == revision1
|
|
|
|
assert revs[1].decode("ascii") == revision2
|
|
|
|
assert revs[2].decode("ascii") == revision3
|
|
|
|
|
|
|
|
revs = repository.get_revs(hg, revision2)
|
|
|
|
|
|
|
|
assert len(revs) == 2, "There should be two revisions after the first"
|
|
|
|
assert revs[0].decode("ascii") == revision2
|
|
|
|
assert revs[1].decode("ascii") == revision3
|
|
|
|
|
2019-07-27 02:13:01 +03:00
|
|
|
add_file(hg, local, "file4", "1\n2\n3\n4\n5\n6\n7\n")
|
|
|
|
commit(hg)
|
|
|
|
|
|
|
|
revs = repository.get_revs(hg, revision2, revision3)
|
|
|
|
|
|
|
|
assert (
|
|
|
|
len(revs) == 2
|
|
|
|
), "There should be two revision after the first and up to the third"
|
|
|
|
assert revs[0].decode("ascii") == revision2
|
|
|
|
assert revs[1].decode("ascii") == revision3
|
|
|
|
|
2019-05-14 12:30:56 +03:00
|
|
|
|
2019-08-01 18:06:50 +03:00
|
|
|
def test_hg_modified_files(fake_hg_repo):
|
|
|
|
hg, local, remote = fake_hg_repo
|
|
|
|
|
|
|
|
add_file(hg, local, "f1", "1\n2\n3\n4\n5\n6\n7\n")
|
|
|
|
revision1 = commit(hg, date=datetime(1991, 4, 16, tzinfo=timezone.utc))
|
|
|
|
|
|
|
|
add_file(hg, local, "f2", "1\n2\n3\n4\n5\n6\n7\n")
|
|
|
|
revision2 = commit(hg, "Bug 123 - Prova. r=moz,rev2")
|
|
|
|
|
|
|
|
hg.copy(
|
|
|
|
bytes(os.path.join(local, "f2"), "ascii"),
|
|
|
|
bytes(os.path.join(local, "f2copy"), "ascii"),
|
|
|
|
)
|
|
|
|
revision3 = commit(hg, "Copy")
|
|
|
|
|
|
|
|
hg.move(
|
|
|
|
bytes(os.path.join(local, "f2copy"), "ascii"),
|
|
|
|
bytes(os.path.join(local, "f2copymove"), "ascii"),
|
|
|
|
)
|
|
|
|
revision4 = commit(hg, "Move")
|
|
|
|
|
|
|
|
hg.push(dest=bytes(remote, "ascii"))
|
|
|
|
revs = repository.get_revs(hg, revision1)
|
|
|
|
commits = repository.hg_log(hg, revs)
|
|
|
|
|
2019-12-08 15:39:39 +03:00
|
|
|
repository.path_to_component = {}
|
|
|
|
|
2019-08-01 18:06:50 +03:00
|
|
|
for c in commits:
|
|
|
|
repository.hg_modified_files(hg, c)
|
|
|
|
|
|
|
|
assert commits[0].node == revision1
|
|
|
|
assert commits[0].files == ["f1"]
|
|
|
|
assert commits[0].file_copies == {}
|
|
|
|
|
|
|
|
assert commits[1].node == revision2
|
|
|
|
assert commits[1].files == ["f2"]
|
|
|
|
assert commits[1].file_copies == {}
|
|
|
|
|
|
|
|
assert commits[2].node == revision3
|
|
|
|
assert commits[2].files == ["f2copy"]
|
|
|
|
assert commits[2].file_copies == {"f2": "f2copy"}
|
|
|
|
|
|
|
|
assert commits[3].node == revision4
|
|
|
|
assert commits[3].files == ["f2copy", "f2copymove"]
|
|
|
|
assert commits[3].file_copies == {"f2copy": "f2copymove"}
|
|
|
|
|
|
|
|
|
2019-06-01 14:09:50 +03:00
|
|
|
def test_hg_log(fake_hg_repo):
|
|
|
|
hg, local, remote = fake_hg_repo
|
|
|
|
|
|
|
|
add_file(hg, local, "file1", "1\n2\n3\n4\n5\n6\n7\n")
|
|
|
|
revision1 = commit(hg, date=datetime(1991, 4, 16, tzinfo=timezone.utc))
|
|
|
|
|
|
|
|
first_push_date = datetime.utcnow()
|
|
|
|
hg.push(dest=bytes(remote, "ascii"))
|
|
|
|
|
|
|
|
add_file(hg, local, "file2", "1\n2\n3\n4\n5\n6\n7\n")
|
|
|
|
revision2 = commit(hg, "Bug 123 - Prova. r=moz,rev2")
|
|
|
|
|
|
|
|
hg.copy(
|
|
|
|
bytes(os.path.join(local, "file2"), "ascii"),
|
|
|
|
bytes(os.path.join(local, "file2copy"), "ascii"),
|
|
|
|
)
|
|
|
|
revision3 = commit(hg)
|
|
|
|
|
|
|
|
hg.move(
|
|
|
|
bytes(os.path.join(local, "file2copy"), "ascii"),
|
|
|
|
bytes(os.path.join(local, "file2copymove"), "ascii"),
|
|
|
|
)
|
|
|
|
revision4 = commit(hg)
|
|
|
|
|
|
|
|
hg.backout(
|
|
|
|
rev=revision4,
|
|
|
|
message=f"Backout {revision4[:12]}",
|
|
|
|
user="sheriff",
|
|
|
|
date=datetime(2019, 4, 16, tzinfo=timezone.utc),
|
|
|
|
)
|
|
|
|
revision5 = hg.log(limit=1)[0][1].decode("ascii")
|
|
|
|
|
2019-07-02 12:23:45 +03:00
|
|
|
# Wait one second, to have a different pushdate.
|
|
|
|
time.sleep(1)
|
|
|
|
|
2019-06-01 14:09:50 +03:00
|
|
|
second_push_date = datetime.utcnow()
|
|
|
|
hg.push(dest=bytes(remote, "ascii"))
|
|
|
|
|
2019-07-02 12:23:45 +03:00
|
|
|
add_file(hg, local, "file3", "1\n2\n3\n4\n5\n6\n7\n")
|
|
|
|
revision6 = commit(hg)
|
|
|
|
|
2019-06-01 14:09:50 +03:00
|
|
|
copy_pushlog_database(remote, local)
|
|
|
|
|
|
|
|
revs = repository.get_revs(hg)
|
|
|
|
|
2019-07-02 12:23:45 +03:00
|
|
|
# Wait one second, to have a different pushdate.
|
|
|
|
time.sleep(1)
|
|
|
|
|
|
|
|
hg_log_date = datetime.utcnow()
|
|
|
|
|
2019-06-01 14:09:50 +03:00
|
|
|
commits = repository.hg_log(hg, revs)
|
2019-07-02 12:23:45 +03:00
|
|
|
assert len(commits) == 6, "hg log should return six commits"
|
2019-06-01 14:09:50 +03:00
|
|
|
|
|
|
|
assert commits[0].node == revision1
|
|
|
|
assert commits[0].author == "Moz Illa <milla@mozilla.org>"
|
|
|
|
assert commits[0].desc == "Commit A file1"
|
|
|
|
assert commits[0].date == datetime(1991, 4, 16)
|
|
|
|
assert (
|
|
|
|
first_push_date - relativedelta(seconds=1)
|
|
|
|
<= commits[0].pushdate
|
|
|
|
<= first_push_date + relativedelta(seconds=1)
|
|
|
|
)
|
2019-08-01 18:06:50 +03:00
|
|
|
assert commits[0].bug_id is None
|
2019-06-01 14:09:50 +03:00
|
|
|
assert commits[0].backedoutby == ""
|
2019-08-01 18:06:50 +03:00
|
|
|
assert commits[0].author_email == "milla@mozilla.org"
|
2019-11-22 01:17:15 +03:00
|
|
|
assert commits[0].reviewers == []
|
2019-06-01 14:09:50 +03:00
|
|
|
|
|
|
|
assert commits[1].node == revision2
|
|
|
|
assert commits[1].author == "Moz Illa <milla@mozilla.org>"
|
|
|
|
assert commits[1].desc == "Bug 123 - Prova. r=moz,rev2"
|
|
|
|
assert commits[1].date == datetime(2019, 4, 16)
|
|
|
|
assert (
|
|
|
|
second_push_date - relativedelta(seconds=1)
|
|
|
|
<= commits[1].pushdate
|
|
|
|
<= second_push_date + relativedelta(seconds=1)
|
|
|
|
)
|
2019-08-01 18:06:50 +03:00
|
|
|
assert commits[1].bug_id == 123
|
2019-06-01 14:09:50 +03:00
|
|
|
assert commits[1].backedoutby == ""
|
2019-08-01 18:06:50 +03:00
|
|
|
assert commits[1].author_email == "milla@mozilla.org"
|
2019-06-01 14:09:50 +03:00
|
|
|
assert set(commits[1].reviewers) == {"moz", "rev2"}
|
|
|
|
|
|
|
|
assert commits[2].node == revision3
|
|
|
|
assert commits[2].author == "Moz Illa <milla@mozilla.org>"
|
|
|
|
assert commits[2].desc == "Commit A file2copy"
|
|
|
|
assert commits[2].date == datetime(2019, 4, 16)
|
|
|
|
assert (
|
|
|
|
second_push_date - relativedelta(seconds=1)
|
|
|
|
<= commits[2].pushdate
|
|
|
|
<= second_push_date + relativedelta(seconds=1)
|
|
|
|
)
|
2019-08-01 18:06:50 +03:00
|
|
|
assert commits[2].bug_id is None
|
2019-06-01 14:09:50 +03:00
|
|
|
assert commits[2].backedoutby == ""
|
2019-08-01 18:06:50 +03:00
|
|
|
assert commits[2].author_email == "milla@mozilla.org"
|
2019-11-22 01:17:15 +03:00
|
|
|
assert commits[2].reviewers == []
|
2019-06-01 14:09:50 +03:00
|
|
|
|
|
|
|
assert commits[3].node == revision4
|
|
|
|
assert commits[3].author == "Moz Illa <milla@mozilla.org>"
|
|
|
|
assert commits[3].desc == "Commit A file2copymove R file2copy"
|
|
|
|
assert commits[3].date == datetime(2019, 4, 16)
|
|
|
|
assert (
|
|
|
|
second_push_date - relativedelta(seconds=1)
|
|
|
|
<= commits[3].pushdate
|
|
|
|
<= second_push_date + relativedelta(seconds=1)
|
|
|
|
)
|
2019-08-01 18:06:50 +03:00
|
|
|
assert commits[3].bug_id is None
|
2019-06-01 14:09:50 +03:00
|
|
|
assert commits[3].backedoutby == revision5
|
2019-08-01 18:06:50 +03:00
|
|
|
assert commits[3].author_email == "milla@mozilla.org"
|
2019-11-22 01:17:15 +03:00
|
|
|
assert commits[3].reviewers == []
|
2019-06-01 14:09:50 +03:00
|
|
|
|
|
|
|
assert commits[4].node == revision5
|
|
|
|
assert commits[4].author == "sheriff"
|
|
|
|
assert commits[4].desc == f"Backout {revision4[:12]}"
|
|
|
|
assert commits[4].date == datetime(2019, 4, 16)
|
|
|
|
assert (
|
|
|
|
second_push_date - relativedelta(seconds=1)
|
|
|
|
<= commits[4].pushdate
|
|
|
|
<= second_push_date + relativedelta(seconds=1)
|
|
|
|
)
|
2019-08-01 18:06:50 +03:00
|
|
|
assert commits[4].bug_id is None
|
2019-06-01 14:09:50 +03:00
|
|
|
assert commits[4].backedoutby == ""
|
2019-08-01 18:06:50 +03:00
|
|
|
assert commits[4].author_email == "sheriff"
|
2019-11-22 01:17:15 +03:00
|
|
|
assert commits[4].reviewers == []
|
2019-06-01 14:09:50 +03:00
|
|
|
|
2019-07-02 12:23:45 +03:00
|
|
|
assert commits[5].node == revision6
|
|
|
|
assert commits[5].author == "Moz Illa <milla@mozilla.org>"
|
|
|
|
assert commits[5].desc == "Commit A file3"
|
|
|
|
assert commits[5].date == datetime(2019, 4, 16)
|
|
|
|
assert (
|
|
|
|
hg_log_date - relativedelta(seconds=1)
|
|
|
|
<= commits[5].pushdate
|
|
|
|
<= hg_log_date + relativedelta(seconds=1)
|
|
|
|
)
|
2019-08-01 18:06:50 +03:00
|
|
|
assert commits[5].bug_id is None
|
2019-07-02 12:23:45 +03:00
|
|
|
assert commits[5].backedoutby == ""
|
2019-08-01 18:06:50 +03:00
|
|
|
assert commits[5].author_email == "milla@mozilla.org"
|
2019-11-22 01:17:15 +03:00
|
|
|
assert commits[5].reviewers == []
|
2019-07-02 12:23:45 +03:00
|
|
|
|
2019-06-01 14:09:50 +03:00
|
|
|
commits = repository.hg_log(hg, [revs[1], revs[3]])
|
|
|
|
assert len(commits) == 3, "hg log should return three commits"
|
|
|
|
assert commits[0].node == revision2
|
|
|
|
assert commits[1].node == revision3
|
|
|
|
assert commits[2].node == revision4
|
|
|
|
|
|
|
|
|
2019-06-25 15:23:09 +03:00
|
|
|
def test_download_component_mapping():
|
|
|
|
responses.add(
|
|
|
|
responses.HEAD,
|
2019-11-20 03:16:01 +03:00
|
|
|
"https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/gecko.v2.mozilla-central.latest.source.source-bugzilla-info/artifacts/public/components.json",
|
2019-06-25 15:23:09 +03:00
|
|
|
status=200,
|
|
|
|
headers={"ETag": "100"},
|
|
|
|
)
|
|
|
|
|
|
|
|
responses.add(
|
|
|
|
responses.GET,
|
2019-11-20 03:16:01 +03:00
|
|
|
"https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/gecko.v2.mozilla-central.latest.source.source-bugzilla-info/artifacts/public/components.json",
|
2019-06-25 15:23:09 +03:00
|
|
|
status=200,
|
|
|
|
json={},
|
|
|
|
)
|
|
|
|
|
|
|
|
repository.download_component_mapping()
|
|
|
|
assert len(repository.path_to_component) == 0
|
|
|
|
|
|
|
|
responses.reset()
|
|
|
|
responses.add(
|
|
|
|
responses.HEAD,
|
2019-11-20 03:16:01 +03:00
|
|
|
"https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/gecko.v2.mozilla-central.latest.source.source-bugzilla-info/artifacts/public/components.json",
|
2019-06-25 15:23:09 +03:00
|
|
|
status=200,
|
|
|
|
headers={"ETag": "101"},
|
|
|
|
)
|
|
|
|
|
|
|
|
responses.add(
|
|
|
|
responses.GET,
|
2019-11-20 03:16:01 +03:00
|
|
|
"https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/gecko.v2.mozilla-central.latest.source.source-bugzilla-info/artifacts/public/components.json",
|
2019-06-25 15:23:09 +03:00
|
|
|
status=200,
|
|
|
|
json={
|
|
|
|
"AUTHORS": ["mozilla.org", "Licensing"],
|
|
|
|
"Cargo.lock": ["Firefox Build System", "General"],
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
repository.download_component_mapping()
|
|
|
|
assert len(repository.path_to_component) == 2
|
|
|
|
assert repository.path_to_component["AUTHORS"] == "mozilla.org::Licensing"
|
|
|
|
assert repository.path_to_component["Cargo.lock"] == "Firefox Build System::General"
|
|
|
|
|
|
|
|
responses.reset()
|
|
|
|
responses.add(
|
|
|
|
responses.HEAD,
|
2019-11-20 03:16:01 +03:00
|
|
|
"https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/gecko.v2.mozilla-central.latest.source.source-bugzilla-info/artifacts/public/components.json",
|
2019-06-25 15:23:09 +03:00
|
|
|
status=200,
|
|
|
|
headers={"ETag": "101"},
|
|
|
|
)
|
|
|
|
|
|
|
|
repository.download_component_mapping()
|
|
|
|
assert len(repository.path_to_component) == 2
|
|
|
|
assert repository.path_to_component["AUTHORS"] == "mozilla.org::Licensing"
|
|
|
|
assert repository.path_to_component["Cargo.lock"] == "Firefox Build System::General"
|
|
|
|
|
|
|
|
|
2019-06-03 16:52:17 +03:00
|
|
|
def test_download_commits(fake_hg_repo):
|
|
|
|
hg, local, remote = fake_hg_repo
|
|
|
|
|
|
|
|
responses.add(
|
|
|
|
responses.HEAD,
|
2019-11-20 03:16:01 +03:00
|
|
|
"https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/gecko.v2.mozilla-central.latest.source.source-bugzilla-info/artifacts/public/components.json",
|
2019-06-03 16:52:17 +03:00
|
|
|
status=200,
|
|
|
|
headers={"ETag": "123"},
|
|
|
|
)
|
|
|
|
|
|
|
|
responses.add(
|
|
|
|
responses.GET,
|
2019-11-20 03:16:01 +03:00
|
|
|
"https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/gecko.v2.mozilla-central.latest.source.source-bugzilla-info/artifacts/public/components.json",
|
2019-06-03 16:52:17 +03:00
|
|
|
status=200,
|
|
|
|
json={
|
|
|
|
"file1": ["Firefox", "Menus"],
|
|
|
|
"file2": ["Firefox", "General"],
|
|
|
|
"file3": ["Core", "General"],
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
# Remove the mock DB generated by the mock_data fixture.
|
|
|
|
os.remove("data/commits.json")
|
|
|
|
|
|
|
|
with open(os.path.join(local, ".hg-annotate-ignore-revs"), "w") as f:
|
|
|
|
f.write("not_existing_hash\n")
|
|
|
|
|
|
|
|
add_file(hg, local, "file1", "1\n2\n3\n4\n5\n6\n7\n")
|
|
|
|
commit(hg, date=datetime(1991, 4, 16, tzinfo=timezone.utc))
|
|
|
|
hg.push(dest=bytes(remote, "ascii"))
|
|
|
|
copy_pushlog_database(remote, local)
|
|
|
|
|
2019-08-01 18:06:50 +03:00
|
|
|
commits = repository.download_commits(local)
|
2019-06-06 19:55:17 +03:00
|
|
|
assert len(commits) == 0
|
2019-06-03 16:52:17 +03:00
|
|
|
commits = list(repository.get_commits())
|
|
|
|
assert len(commits) == 0
|
|
|
|
|
2019-06-05 02:02:57 +03:00
|
|
|
# Wait one second, to have a different pushdate.
|
|
|
|
time.sleep(1)
|
|
|
|
|
2019-06-03 16:52:17 +03:00
|
|
|
add_file(hg, local, "file2", "1\n2\n3\n4\n5\n6\n7\n")
|
|
|
|
revision2 = commit(hg, "Bug 123 - Prova. r=moz,rev2")
|
|
|
|
hg.push(dest=bytes(remote, "ascii"))
|
|
|
|
copy_pushlog_database(remote, local)
|
|
|
|
|
2019-08-01 18:06:50 +03:00
|
|
|
commits = repository.download_commits(local)
|
2019-06-06 19:55:17 +03:00
|
|
|
assert len(commits) == 1
|
2019-06-03 16:52:17 +03:00
|
|
|
commits = list(repository.get_commits())
|
|
|
|
assert len(commits) == 1
|
|
|
|
assert commits[0]["node"] == revision2
|
2019-06-03 20:29:08 +03:00
|
|
|
assert commits[0]["touched_prev_total_author_sum"] == 0
|
2019-06-04 13:49:42 +03:00
|
|
|
assert commits[0]["seniority_author"] > 0
|
|
|
|
|
|
|
|
# Wait one second, to have a different pushdate.
|
|
|
|
time.sleep(1)
|
2019-06-03 16:52:17 +03:00
|
|
|
|
|
|
|
add_file(hg, local, "file3", "1\n2\n3\n4\n5\n6\n7\n")
|
|
|
|
revision3 = commit(hg, "Bug 456 - Prova. r=moz")
|
|
|
|
hg.push(dest=bytes(remote, "ascii"))
|
|
|
|
copy_pushlog_database(remote, local)
|
|
|
|
|
2019-08-01 18:06:50 +03:00
|
|
|
commits = repository.download_commits(local, revision3)
|
2019-06-06 19:55:17 +03:00
|
|
|
assert len(commits) == 1
|
2019-06-03 16:52:17 +03:00
|
|
|
commits = list(repository.get_commits())
|
|
|
|
assert len(commits) == 2
|
|
|
|
assert commits[0]["node"] == revision2
|
2019-06-03 20:29:08 +03:00
|
|
|
assert commits[0]["touched_prev_total_author_sum"] == 0
|
2019-06-04 13:49:42 +03:00
|
|
|
assert commits[0]["seniority_author"] > 0
|
2019-06-03 16:52:17 +03:00
|
|
|
assert commits[1]["node"] == revision3
|
2019-06-03 20:29:08 +03:00
|
|
|
assert commits[1]["touched_prev_total_author_sum"] == 1
|
2019-06-04 13:49:42 +03:00
|
|
|
assert commits[1]["seniority_author"] > commits[0]["seniority_author"]
|
2019-06-03 16:52:17 +03:00
|
|
|
|
2019-06-06 19:55:17 +03:00
|
|
|
os.remove("data/commits.json")
|
|
|
|
os.remove("data/commit_experiences.pickle")
|
2019-08-01 18:06:50 +03:00
|
|
|
commits = repository.download_commits(local, f"children({revision2})")
|
2019-06-06 19:55:17 +03:00
|
|
|
assert len(commits) == 1
|
|
|
|
assert len(list(repository.get_commits())) == 1
|
|
|
|
|
|
|
|
os.remove("data/commits.json")
|
|
|
|
os.remove("data/commit_experiences.pickle")
|
2019-08-01 18:06:50 +03:00
|
|
|
commits = repository.download_commits(local)
|
2019-06-06 19:55:17 +03:00
|
|
|
assert len(list(repository.get_commits())) == 2
|
|
|
|
|
2019-06-03 16:52:17 +03:00
|
|
|
|
2019-05-14 12:30:56 +03:00
|
|
|
def test_get_directories():
|
|
|
|
assert repository.get_directories("") == []
|
|
|
|
assert repository.get_directories("Makefile") == []
|
|
|
|
assert repository.get_directories("dom/aFile.jsm") == ["dom"]
|
|
|
|
assert set(
|
|
|
|
repository.get_directories("tools/code-coverage/CodeCoverageHandler.cpp")
|
|
|
|
) == {"tools", "tools/code-coverage"}
|
|
|
|
|
|
|
|
assert repository.get_directories([""]) == []
|
|
|
|
assert repository.get_directories(["Makefile"]) == []
|
|
|
|
assert repository.get_directories(["dom/aFile.jsm"]) == ["dom"]
|
|
|
|
assert set(
|
|
|
|
repository.get_directories(["tools/code-coverage/CodeCoverageHandler.cpp"])
|
|
|
|
) == {"tools", "tools/code-coverage"}
|
|
|
|
assert set(
|
|
|
|
repository.get_directories(
|
|
|
|
["dom/aFile.jsm", "tools/code-coverage/CodeCoverageHandler.cpp"]
|
|
|
|
)
|
|
|
|
) == {"dom", "tools", "tools/code-coverage"}
|
|
|
|
|
|
|
|
|
2019-08-01 18:06:50 +03:00
|
|
|
def test_set_commits_to_ignore(tmpdir):
|
2019-05-29 12:24:11 +03:00
|
|
|
tmp_path = tmpdir.strpath
|
|
|
|
|
|
|
|
with open(os.path.join(tmp_path, ".hg-annotate-ignore-revs"), "w") as f:
|
|
|
|
f.write("commit1\ncommit2\n8ba995b74e18334ab3707f27e9eb8f4e37ba3d29\n")
|
|
|
|
|
2019-08-01 18:06:50 +03:00
|
|
|
def create_commit(node, desc, bug_id, backedoutby):
|
2019-05-29 12:24:11 +03:00
|
|
|
return repository.Commit(
|
|
|
|
node=node,
|
|
|
|
author="author",
|
|
|
|
desc=desc,
|
|
|
|
date=datetime(2019, 1, 1),
|
|
|
|
pushdate=datetime(2019, 1, 1),
|
2019-08-01 18:06:50 +03:00
|
|
|
bug_id=bug_id,
|
2019-05-29 12:24:11 +03:00
|
|
|
backedoutby=backedoutby,
|
|
|
|
author_email="author@mozilla.org",
|
|
|
|
reviewers=("reviewer1", "reviewer2"),
|
2019-08-01 18:06:50 +03:00
|
|
|
).set_files(["dom/file1.cpp"], {})
|
2019-05-29 12:24:11 +03:00
|
|
|
|
|
|
|
commits = [
|
|
|
|
create_commit("commit", "", 123, ""),
|
|
|
|
create_commit("commit_backout", "", 123, ""),
|
|
|
|
create_commit("commit_backedout", "", 123, "commit_backout"),
|
2019-08-01 18:06:50 +03:00
|
|
|
create_commit("commit_no_bug", "", None, ""),
|
2019-05-29 12:24:11 +03:00
|
|
|
create_commit(
|
|
|
|
"8ba995b74e18334ab3707f27e9eb8f4e37ba3d29",
|
|
|
|
"commit in .hg-annotate-ignore-revs",
|
|
|
|
123,
|
|
|
|
"",
|
|
|
|
),
|
|
|
|
create_commit(
|
|
|
|
"commit_with_ignore_in_desc", "prova\nignore-this-changeset\n", 123, ""
|
|
|
|
),
|
|
|
|
]
|
|
|
|
|
2019-08-01 18:06:50 +03:00
|
|
|
repository.set_commits_to_ignore(tmp_path, commits)
|
|
|
|
leftovers = [commit for commit in commits if commit.ignored]
|
2019-05-29 12:24:11 +03:00
|
|
|
assert len(leftovers) == 4
|
|
|
|
assert set(commit.node for commit in leftovers) == {
|
|
|
|
"commit_backout",
|
|
|
|
"commit_no_bug",
|
|
|
|
"8ba995b74e18334ab3707f27e9eb8f4e37ba3d29",
|
|
|
|
"commit_with_ignore_in_desc",
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-14 12:30:56 +03:00
|
|
|
def test_calculate_experiences():
|
2019-08-01 18:06:50 +03:00
|
|
|
repository.path_to_component = {
|
|
|
|
"dom/file1.cpp": "Core::DOM",
|
|
|
|
"dom/file1copied.cpp": "Core::DOM",
|
|
|
|
"dom/file2.cpp": "Core::Layout",
|
|
|
|
"apps/file1.jsm": "Firefox::Boh",
|
|
|
|
"apps/file2.jsm": "Firefox::Boh",
|
|
|
|
}
|
|
|
|
|
2019-05-28 13:59:55 +03:00
|
|
|
commits = {
|
|
|
|
"commit1": repository.Commit(
|
2019-05-14 12:30:56 +03:00
|
|
|
node="commit1",
|
|
|
|
author="author1",
|
|
|
|
desc="commit1",
|
|
|
|
date=datetime(2019, 1, 1),
|
|
|
|
pushdate=datetime(2019, 1, 1),
|
2019-08-01 18:06:50 +03:00
|
|
|
bug_id=123,
|
2019-05-14 12:30:56 +03:00
|
|
|
backedoutby="",
|
|
|
|
author_email="author1@mozilla.org",
|
|
|
|
reviewers=("reviewer1", "reviewer2"),
|
2019-08-01 18:06:50 +03:00
|
|
|
).set_files(["dom/file1.cpp", "apps/file1.jsm"], {}),
|
2019-05-28 13:59:55 +03:00
|
|
|
"commitbackedout": repository.Commit(
|
|
|
|
node="commitbackedout",
|
|
|
|
author="author1",
|
|
|
|
desc="commitbackedout",
|
|
|
|
date=datetime(2019, 1, 1),
|
|
|
|
pushdate=datetime(2019, 1, 1),
|
2019-08-01 18:06:50 +03:00
|
|
|
bug_id=123,
|
2019-05-28 13:59:55 +03:00
|
|
|
backedoutby="commitbackout",
|
|
|
|
author_email="author1@mozilla.org",
|
|
|
|
reviewers=("reviewer1", "reviewer2"),
|
2019-08-01 18:06:50 +03:00
|
|
|
).set_files(["dom/file1.cpp", "apps/file1.jsm"], {}),
|
2019-05-28 13:59:55 +03:00
|
|
|
"commit2": repository.Commit(
|
2019-05-14 12:30:56 +03:00
|
|
|
node="commit2",
|
|
|
|
author="author2",
|
|
|
|
desc="commit2",
|
|
|
|
date=datetime(2019, 1, 1),
|
|
|
|
pushdate=datetime(2019, 1, 1),
|
2019-08-01 18:06:50 +03:00
|
|
|
bug_id=123,
|
2019-05-14 12:30:56 +03:00
|
|
|
backedoutby="",
|
|
|
|
author_email="author2@mozilla.org",
|
|
|
|
reviewers=("reviewer1",),
|
2019-08-01 18:06:50 +03:00
|
|
|
).set_files(["dom/file1.cpp"], {}),
|
2019-05-29 12:24:11 +03:00
|
|
|
"commit2refactoring": repository.Commit(
|
|
|
|
node="commit2refactoring",
|
|
|
|
author="author2",
|
|
|
|
desc="commit2refactoring",
|
|
|
|
date=datetime(2019, 1, 1),
|
|
|
|
pushdate=datetime(2019, 1, 1),
|
2019-08-01 18:06:50 +03:00
|
|
|
bug_id=123,
|
2019-05-29 12:24:11 +03:00
|
|
|
backedoutby="",
|
|
|
|
author_email="author2@mozilla.org",
|
|
|
|
reviewers=("reviewer1",),
|
2019-08-01 18:06:50 +03:00
|
|
|
ignored=True,
|
|
|
|
).set_files(["dom/file1.cpp"], {}),
|
2019-05-28 13:59:55 +03:00
|
|
|
"commit3": repository.Commit(
|
2019-05-14 12:30:56 +03:00
|
|
|
node="commit3",
|
|
|
|
author="author1",
|
|
|
|
desc="commit3",
|
|
|
|
date=datetime(2019, 1, 1),
|
|
|
|
pushdate=datetime(2019, 1, 1),
|
2019-08-01 18:06:50 +03:00
|
|
|
bug_id=123,
|
2019-05-14 12:30:56 +03:00
|
|
|
backedoutby="",
|
|
|
|
author_email="author1@mozilla.org",
|
|
|
|
reviewers=("reviewer2",),
|
2019-08-01 18:06:50 +03:00
|
|
|
).set_files(["dom/file2.cpp", "apps/file1.jsm"], {}),
|
2019-05-28 13:59:55 +03:00
|
|
|
"commit4": repository.Commit(
|
2019-05-14 12:30:56 +03:00
|
|
|
node="commit4",
|
|
|
|
author="author2",
|
|
|
|
desc="commit4",
|
|
|
|
date=datetime(2019, 1, 1),
|
|
|
|
pushdate=datetime(2020, 1, 1),
|
2019-08-01 18:06:50 +03:00
|
|
|
bug_id=123,
|
2019-05-14 12:30:56 +03:00
|
|
|
backedoutby="",
|
|
|
|
author_email="author2@mozilla.org",
|
|
|
|
reviewers=("reviewer1", "reviewer2"),
|
2019-08-01 18:06:50 +03:00
|
|
|
).set_files(["dom/file1.cpp", "apps/file2.jsm"], {}),
|
2019-05-28 13:59:55 +03:00
|
|
|
"commit5": repository.Commit(
|
2019-05-14 12:30:56 +03:00
|
|
|
node="commit5",
|
|
|
|
author="author3",
|
|
|
|
desc="commit5",
|
|
|
|
date=datetime(2019, 1, 1),
|
|
|
|
pushdate=datetime(2020, 1, 2),
|
2019-08-01 18:06:50 +03:00
|
|
|
bug_id=123,
|
2019-05-14 12:30:56 +03:00
|
|
|
backedoutby="",
|
|
|
|
author_email="author3@mozilla.org",
|
|
|
|
reviewers=("reviewer3",),
|
2019-08-01 18:06:50 +03:00
|
|
|
).set_files(["dom/file1.cpp"], {"dom/file1.cpp": "dom/file1copied.cpp"}),
|
2019-05-28 13:59:55 +03:00
|
|
|
"commit6": repository.Commit(
|
2019-05-14 12:30:56 +03:00
|
|
|
node="commit6",
|
|
|
|
author="author3",
|
|
|
|
desc="commit6",
|
|
|
|
date=datetime(2019, 1, 1),
|
|
|
|
pushdate=datetime(2020, 1, 3),
|
2019-08-01 18:06:50 +03:00
|
|
|
bug_id=123,
|
2019-05-14 12:30:56 +03:00
|
|
|
backedoutby="",
|
|
|
|
author_email="author3@mozilla.org",
|
|
|
|
reviewers=("reviewer3",),
|
2019-08-01 18:06:50 +03:00
|
|
|
).set_files(["dom/file1.cpp", "dom/file1copied.cpp"], {}),
|
2019-05-28 13:59:55 +03:00
|
|
|
}
|
2019-05-14 12:30:56 +03:00
|
|
|
|
2019-08-01 18:06:50 +03:00
|
|
|
repository.calculate_experiences(commits.values(), datetime(2019, 1, 1))
|
2019-05-28 13:59:55 +03:00
|
|
|
|
|
|
|
assert commits["commit1"].seniority_author == 0
|
|
|
|
assert commits["commitbackedout"].seniority_author == 0
|
|
|
|
assert commits["commit2"].seniority_author == 0
|
|
|
|
assert commits["commit3"].seniority_author == 0
|
2019-06-04 13:49:42 +03:00
|
|
|
assert commits["commit4"].seniority_author == 86400.0 * 365
|
2019-05-28 13:59:55 +03:00
|
|
|
assert commits["commit5"].seniority_author == 0
|
2019-06-04 13:49:42 +03:00
|
|
|
assert commits["commit6"].seniority_author == 86400.0
|
2019-05-28 13:59:55 +03:00
|
|
|
|
|
|
|
assert commits["commit1"].touched_prev_total_author_sum == 0
|
|
|
|
assert commits["commit2"].touched_prev_total_author_sum == 0
|
|
|
|
assert commits["commit3"].touched_prev_total_author_sum == 1
|
|
|
|
assert commits["commit4"].touched_prev_total_author_sum == 1
|
|
|
|
assert commits["commit5"].touched_prev_total_author_sum == 0
|
|
|
|
assert commits["commit6"].touched_prev_total_author_sum == 1
|
|
|
|
|
|
|
|
assert commits["commit1"].touched_prev_90_days_author_sum == 0
|
|
|
|
assert commits["commit2"].touched_prev_90_days_author_sum == 0
|
|
|
|
assert commits["commit3"].touched_prev_90_days_author_sum == 1
|
|
|
|
assert commits["commit4"].touched_prev_90_days_author_sum == 0
|
|
|
|
assert commits["commit5"].touched_prev_90_days_author_sum == 0
|
|
|
|
assert commits["commit6"].touched_prev_90_days_author_sum == 1
|
|
|
|
|
|
|
|
assert commits["commit1"].touched_prev_total_reviewer_sum == 0
|
|
|
|
assert commits["commit1"].touched_prev_total_reviewer_max == 0
|
|
|
|
assert commits["commit1"].touched_prev_total_reviewer_min == 0
|
|
|
|
assert commits["commit2"].touched_prev_total_reviewer_sum == 1
|
|
|
|
assert commits["commit2"].touched_prev_total_reviewer_max == 1
|
|
|
|
assert commits["commit2"].touched_prev_total_reviewer_min == 1
|
|
|
|
assert commits["commit3"].touched_prev_total_reviewer_sum == 1
|
|
|
|
assert commits["commit3"].touched_prev_total_reviewer_max == 1
|
|
|
|
assert commits["commit3"].touched_prev_total_reviewer_min == 1
|
|
|
|
assert commits["commit4"].touched_prev_total_reviewer_sum == 4
|
|
|
|
assert commits["commit4"].touched_prev_total_reviewer_max == 2
|
|
|
|
assert commits["commit4"].touched_prev_total_reviewer_min == 2
|
|
|
|
assert commits["commit5"].touched_prev_total_reviewer_sum == 0
|
|
|
|
assert commits["commit5"].touched_prev_total_reviewer_max == 0
|
|
|
|
assert commits["commit5"].touched_prev_total_reviewer_min == 0
|
|
|
|
assert commits["commit6"].touched_prev_total_reviewer_sum == 1
|
|
|
|
assert commits["commit6"].touched_prev_total_reviewer_max == 1
|
|
|
|
assert commits["commit6"].touched_prev_total_reviewer_min == 1
|
|
|
|
|
|
|
|
assert commits["commit1"].touched_prev_90_days_reviewer_sum == 0
|
|
|
|
assert commits["commit1"].touched_prev_90_days_reviewer_max == 0
|
|
|
|
assert commits["commit1"].touched_prev_90_days_reviewer_min == 0
|
|
|
|
assert commits["commit2"].touched_prev_90_days_reviewer_sum == 1
|
|
|
|
assert commits["commit2"].touched_prev_90_days_reviewer_max == 1
|
|
|
|
assert commits["commit2"].touched_prev_90_days_reviewer_min == 1
|
|
|
|
assert commits["commit3"].touched_prev_90_days_reviewer_sum == 1
|
|
|
|
assert commits["commit3"].touched_prev_90_days_reviewer_max == 1
|
|
|
|
assert commits["commit3"].touched_prev_90_days_reviewer_min == 1
|
|
|
|
assert commits["commit4"].touched_prev_90_days_reviewer_sum == 0
|
|
|
|
assert commits["commit4"].touched_prev_90_days_reviewer_max == 0
|
|
|
|
assert commits["commit4"].touched_prev_90_days_reviewer_min == 0
|
|
|
|
assert commits["commit5"].touched_prev_90_days_reviewer_sum == 0
|
|
|
|
assert commits["commit5"].touched_prev_90_days_reviewer_max == 0
|
|
|
|
assert commits["commit5"].touched_prev_90_days_reviewer_min == 0
|
|
|
|
assert commits["commit6"].touched_prev_90_days_reviewer_sum == 1
|
|
|
|
assert commits["commit6"].touched_prev_90_days_reviewer_max == 1
|
|
|
|
assert commits["commit6"].touched_prev_90_days_reviewer_min == 1
|
|
|
|
|
|
|
|
assert commits["commit1"].touched_prev_total_file_sum == 0
|
|
|
|
assert commits["commit1"].touched_prev_total_file_max == 0
|
|
|
|
assert commits["commit1"].touched_prev_total_file_min == 0
|
|
|
|
assert commits["commit2"].touched_prev_total_file_sum == 1
|
|
|
|
assert commits["commit2"].touched_prev_total_file_max == 1
|
|
|
|
assert commits["commit2"].touched_prev_total_file_min == 1
|
|
|
|
assert commits["commit3"].touched_prev_total_file_sum == 1
|
|
|
|
assert commits["commit3"].touched_prev_total_file_max == 1
|
|
|
|
assert commits["commit3"].touched_prev_total_file_min == 0
|
|
|
|
assert commits["commit4"].touched_prev_total_file_sum == 2
|
|
|
|
assert commits["commit4"].touched_prev_total_file_max == 2
|
|
|
|
assert commits["commit4"].touched_prev_total_file_min == 0
|
|
|
|
assert commits["commit5"].touched_prev_total_file_sum == 3
|
|
|
|
assert commits["commit5"].touched_prev_total_file_max == 3
|
|
|
|
assert commits["commit5"].touched_prev_total_file_min == 3
|
|
|
|
assert commits["commit6"].touched_prev_total_file_sum == 4
|
|
|
|
assert commits["commit6"].touched_prev_total_file_max == 4
|
|
|
|
assert commits["commit6"].touched_prev_total_file_min == 3
|
|
|
|
|
|
|
|
assert commits["commit1"].touched_prev_90_days_file_sum == 0
|
|
|
|
assert commits["commit1"].touched_prev_90_days_file_max == 0
|
|
|
|
assert commits["commit1"].touched_prev_90_days_file_min == 0
|
|
|
|
assert commits["commit2"].touched_prev_90_days_file_sum == 1
|
|
|
|
assert commits["commit2"].touched_prev_90_days_file_max == 1
|
|
|
|
assert commits["commit2"].touched_prev_90_days_file_min == 1
|
|
|
|
assert commits["commit3"].touched_prev_90_days_file_sum == 1
|
|
|
|
assert commits["commit3"].touched_prev_90_days_file_max == 1
|
|
|
|
assert commits["commit3"].touched_prev_90_days_file_min == 0
|
|
|
|
assert commits["commit4"].touched_prev_90_days_file_sum == 0
|
|
|
|
assert commits["commit4"].touched_prev_90_days_file_max == 0
|
|
|
|
assert commits["commit4"].touched_prev_90_days_file_min == 0
|
|
|
|
assert commits["commit5"].touched_prev_90_days_file_sum == 1
|
|
|
|
assert commits["commit5"].touched_prev_90_days_file_max == 1
|
|
|
|
assert commits["commit5"].touched_prev_90_days_file_min == 1
|
|
|
|
assert commits["commit6"].touched_prev_90_days_file_sum == 2
|
|
|
|
assert commits["commit6"].touched_prev_90_days_file_max == 2
|
|
|
|
assert commits["commit6"].touched_prev_90_days_file_min == 1
|
|
|
|
|
|
|
|
assert commits["commit1"].touched_prev_total_directory_sum == 0
|
|
|
|
assert commits["commit1"].touched_prev_total_directory_max == 0
|
|
|
|
assert commits["commit1"].touched_prev_total_directory_min == 0
|
|
|
|
assert commits["commit2"].touched_prev_total_directory_sum == 1
|
|
|
|
assert commits["commit2"].touched_prev_total_directory_max == 1
|
|
|
|
assert commits["commit2"].touched_prev_total_directory_min == 1
|
|
|
|
assert commits["commit3"].touched_prev_total_directory_sum == 2
|
|
|
|
assert commits["commit3"].touched_prev_total_directory_max == 2
|
|
|
|
assert commits["commit3"].touched_prev_total_directory_min == 1
|
|
|
|
assert commits["commit4"].touched_prev_total_directory_sum == 3
|
|
|
|
assert commits["commit4"].touched_prev_total_directory_max == 3
|
|
|
|
assert commits["commit4"].touched_prev_total_directory_min == 2
|
|
|
|
assert commits["commit5"].touched_prev_total_directory_sum == 4
|
|
|
|
assert commits["commit5"].touched_prev_total_directory_max == 4
|
|
|
|
assert commits["commit5"].touched_prev_total_directory_min == 4
|
|
|
|
assert commits["commit6"].touched_prev_total_directory_sum == 5
|
|
|
|
assert commits["commit6"].touched_prev_total_directory_max == 5
|
|
|
|
assert commits["commit6"].touched_prev_total_directory_min == 5
|
|
|
|
|
|
|
|
assert commits["commit1"].touched_prev_90_days_directory_sum == 0
|
|
|
|
assert commits["commit1"].touched_prev_90_days_directory_max == 0
|
|
|
|
assert commits["commit1"].touched_prev_90_days_directory_min == 0
|
|
|
|
assert commits["commit2"].touched_prev_90_days_directory_sum == 1
|
|
|
|
assert commits["commit2"].touched_prev_90_days_directory_max == 1
|
|
|
|
assert commits["commit2"].touched_prev_90_days_directory_min == 1
|
|
|
|
assert commits["commit3"].touched_prev_90_days_directory_sum == 2
|
|
|
|
assert commits["commit3"].touched_prev_90_days_directory_max == 2
|
|
|
|
assert commits["commit3"].touched_prev_90_days_directory_min == 1
|
|
|
|
assert commits["commit4"].touched_prev_90_days_directory_sum == 0
|
|
|
|
assert commits["commit4"].touched_prev_90_days_directory_max == 0
|
|
|
|
assert commits["commit4"].touched_prev_90_days_directory_min == 0
|
|
|
|
assert commits["commit5"].touched_prev_90_days_directory_sum == 1
|
|
|
|
assert commits["commit5"].touched_prev_90_days_directory_max == 1
|
|
|
|
assert commits["commit5"].touched_prev_90_days_directory_min == 1
|
|
|
|
assert commits["commit6"].touched_prev_90_days_directory_sum == 2
|
|
|
|
assert commits["commit6"].touched_prev_90_days_directory_max == 2
|
|
|
|
assert commits["commit6"].touched_prev_90_days_directory_min == 2
|
|
|
|
|
|
|
|
assert commits["commit1"].touched_prev_total_component_sum == 0
|
|
|
|
assert commits["commit1"].touched_prev_total_component_max == 0
|
|
|
|
assert commits["commit1"].touched_prev_total_component_min == 0
|
|
|
|
assert commits["commit2"].touched_prev_total_component_sum == 1
|
|
|
|
assert commits["commit2"].touched_prev_total_component_max == 1
|
|
|
|
assert commits["commit2"].touched_prev_total_component_min == 1
|
|
|
|
assert commits["commit3"].touched_prev_total_component_sum == 1
|
|
|
|
assert commits["commit3"].touched_prev_total_component_max == 1
|
|
|
|
assert commits["commit3"].touched_prev_total_component_min == 0
|
|
|
|
assert commits["commit4"].touched_prev_total_component_sum == 3
|
|
|
|
assert commits["commit4"].touched_prev_total_component_max == 2
|
|
|
|
assert commits["commit4"].touched_prev_total_component_min == 2
|
|
|
|
assert commits["commit5"].touched_prev_total_component_sum == 3
|
|
|
|
assert commits["commit5"].touched_prev_total_component_max == 3
|
|
|
|
assert commits["commit5"].touched_prev_total_component_min == 3
|
|
|
|
assert commits["commit6"].touched_prev_total_component_sum == 4
|
|
|
|
assert commits["commit6"].touched_prev_total_component_max == 4
|
|
|
|
assert commits["commit6"].touched_prev_total_component_min == 4
|
|
|
|
|
|
|
|
assert commits["commit1"].touched_prev_90_days_component_sum == 0
|
|
|
|
assert commits["commit1"].touched_prev_90_days_component_max == 0
|
|
|
|
assert commits["commit1"].touched_prev_90_days_component_min == 0
|
|
|
|
assert commits["commit2"].touched_prev_90_days_component_sum == 1
|
|
|
|
assert commits["commit2"].touched_prev_90_days_component_max == 1
|
|
|
|
assert commits["commit2"].touched_prev_90_days_component_min == 1
|
|
|
|
assert commits["commit3"].touched_prev_90_days_component_sum == 1
|
|
|
|
assert commits["commit3"].touched_prev_90_days_component_max == 1
|
|
|
|
assert commits["commit3"].touched_prev_90_days_component_min == 0
|
|
|
|
assert commits["commit4"].touched_prev_90_days_component_sum == 0
|
|
|
|
assert commits["commit4"].touched_prev_90_days_component_max == 0
|
|
|
|
assert commits["commit4"].touched_prev_90_days_component_min == 0
|
|
|
|
assert commits["commit5"].touched_prev_90_days_component_sum == 1
|
|
|
|
assert commits["commit5"].touched_prev_90_days_component_max == 1
|
|
|
|
assert commits["commit5"].touched_prev_90_days_component_min == 1
|
|
|
|
assert commits["commit6"].touched_prev_90_days_component_sum == 2
|
|
|
|
assert commits["commit6"].touched_prev_90_days_component_max == 2
|
|
|
|
assert commits["commit6"].touched_prev_90_days_component_min == 2
|