commits count limit
This commit is contained in:
parent
d3cee9463a
commit
4edbf9eb11
@ -5,10 +5,7 @@ RUN git clone https://gitea.parrrate.ru/PTV/radn-rs.git
|
|||||||
WORKDIR /code/radn-rs/
|
WORKDIR /code/radn-rs/
|
||||||
COPY metrics.py /code/metrics.py
|
COPY metrics.py /code/metrics.py
|
||||||
|
|
||||||
RUN git fetch && git checkout 664365ba728e5b566b85f4275aef556b2094f606
|
RUN git fetch && git checkout 54a6912baf715816e3dcbfd074c0e2d7b8c74fe3
|
||||||
RUN python3 /code/metrics.py
|
|
||||||
|
|
||||||
RUN git fetch && git checkout 82141aa35e01a71f190c1ee83dd467f4153406df
|
|
||||||
RUN python3 /code/metrics.py
|
RUN python3 /code/metrics.py
|
||||||
|
|
||||||
FROM python:3.11
|
FROM python:3.11
|
||||||
|
@ -11,7 +11,7 @@ ENV SRCPATTERN="*.cs"
|
|||||||
FROM metrics-base as metrics-radn
|
FROM metrics-base as metrics-radn
|
||||||
RUN git clone https://gitea.parrrate.ru/PTV/radn-rs.git
|
RUN git clone https://gitea.parrrate.ru/PTV/radn-rs.git
|
||||||
WORKDIR /code/radn-rs/
|
WORKDIR /code/radn-rs/
|
||||||
RUN git fetch && git checkout a60e4f09e0463b3b2fc0f91b21c9928d98d03213
|
RUN git fetch && git checkout f29ea3dbc8d10b83a0a1536f65d4b9f16f457d46
|
||||||
|
|
||||||
FROM metrics-base as metrics-mdbook
|
FROM metrics-base as metrics-mdbook
|
||||||
RUN git clone https://github.com/rust-lang/mdBook.git
|
RUN git clone https://github.com/rust-lang/mdBook.git
|
||||||
@ -23,6 +23,30 @@ RUN git clone https://github.com/rust-lang/rustup.git
|
|||||||
WORKDIR /code/rustup/
|
WORKDIR /code/rustup/
|
||||||
RUN git fetch && git checkout 849adb7c1b8c97e4145e350a934c3a665f61798e
|
RUN git fetch && git checkout 849adb7c1b8c97e4145e350a934c3a665f61798e
|
||||||
|
|
||||||
|
FROM metrics-base as metrics-cargo
|
||||||
|
RUN git clone https://github.com/rust-lang/cargo.git
|
||||||
|
WORKDIR /code/cargo/
|
||||||
|
RUN git fetch && git checkout 5b377cece0e0dd0af686cf53ce4637d5d85c2a10
|
||||||
|
|
||||||
|
FROM metrics-base as metrics-rust
|
||||||
|
RUN git clone https://github.com/rust-lang/rust.git
|
||||||
|
WORKDIR /code/rust/
|
||||||
|
RUN git fetch && git checkout 32d81eccd64513bacef9dfa1574543ada6b45d85
|
||||||
|
|
||||||
|
FROM metrics-base as metrics-ocen
|
||||||
|
RUN git clone https://github.com/ocen-lang/ocen.git
|
||||||
|
WORKDIR /code/ocen/
|
||||||
|
RUN git fetch && git checkout 0b1a63d0e141fc3032f10c70b5cae117429e2dcb
|
||||||
|
ENV SRCDIR="."
|
||||||
|
ENV SRCPATTERN="*.[oa][ec]"
|
||||||
|
|
||||||
|
FROM metrics-base as metrics-aecor
|
||||||
|
RUN git clone https://github.com/mustafaquraish/aecor.git
|
||||||
|
WORKDIR /code/aecor/
|
||||||
|
RUN git fetch && git checkout f81543a34ee363dcc00e8632fd7cfcd4a3478b23
|
||||||
|
ENV SRCDIR="."
|
||||||
|
ENV SRCPATTERN="*.[ach]*"
|
||||||
|
|
||||||
FROM metrics-radn as metrics
|
FROM metrics-radn as metrics
|
||||||
COPY metrics.py /code/metrics.py
|
COPY metrics.py /code/metrics.py
|
||||||
RUN python3 /code/metrics.py
|
RUN python3 /code/metrics.py
|
||||||
|
@ -4,19 +4,24 @@ from collections import Counter
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from subprocess import check_output
|
from subprocess import check_output
|
||||||
|
|
||||||
commits = check_output(["git", "log", "--pretty=%H", "--topo-order"], text=True).splitlines()
|
args = []
|
||||||
|
# args = ["--topo-order"]
|
||||||
|
commits = check_output(["git", "log", "--pretty=%H", *args], text=True).splitlines()
|
||||||
|
commits = commits[::len(commits) // min(len(commits), 4096)]
|
||||||
entries = []
|
entries = []
|
||||||
last_ctr = Counter()
|
last_ctr = Counter()
|
||||||
last_cor = []
|
last_cor = []
|
||||||
cors = []
|
cors = []
|
||||||
|
C = min(len(commits), 720)
|
||||||
for i, commit in enumerate(reversed(commits)):
|
for i, commit in enumerate(reversed(commits)):
|
||||||
print("running", commit)
|
print("running", commit, flush=True)
|
||||||
check_output(["git", "checkout", commit], text=True)
|
check_output(["git", "checkout", commit], text=True)
|
||||||
current_ctr = Counter()
|
current_ctr = Counter()
|
||||||
for path in Path(os.getenv("SRCDIR", "src")).rglob(os.getenv("SRCPATTERN", "*.rs")):
|
for path in Path(os.getenv("SRCDIR", "src")).rglob(os.getenv("SRCPATTERN", "*.rs")):
|
||||||
lines = path.read_bytes().splitlines()
|
lines = path.read_bytes().splitlines()
|
||||||
lines = (line.strip() for line in lines)
|
lines = (line.strip() for line in lines)
|
||||||
lines = (line for line in lines if line)
|
lines = (line for line in lines if line)
|
||||||
|
# lines = set(lines)
|
||||||
current_ctr.update(lines)
|
current_ctr.update(lines)
|
||||||
added = current_ctr - last_ctr
|
added = current_ctr - last_ctr
|
||||||
deleted = last_ctr - current_ctr
|
deleted = last_ctr - current_ctr
|
||||||
@ -28,15 +33,16 @@ for i, commit in enumerate(reversed(commits)):
|
|||||||
common_ctr[line] -= 1
|
common_ctr[line] -= 1
|
||||||
current_cor.append((j, line))
|
current_cor.append((j, line))
|
||||||
current_cor.reverse()
|
current_cor.reverse()
|
||||||
|
c = i * C // len(commits)
|
||||||
for line in added.elements():
|
for line in added.elements():
|
||||||
current_cor.append((i, line))
|
current_cor.append((c, line))
|
||||||
cor_ctr = Counter(j for j, _ in current_cor)
|
cor_ctr = Counter(j for j, _ in current_cor)
|
||||||
assert len(current_cor) == cor_ctr.total() == current_ctr.total()
|
assert len(current_cor) == cor_ctr.total() == current_ctr.total()
|
||||||
cors.append([0] * i)
|
while c >= len(cors):
|
||||||
|
cors.append([0] * i)
|
||||||
for j, cor in enumerate(cors):
|
for j, cor in enumerate(cors):
|
||||||
cor.append(cor_ctr[j])
|
cor.append(cor_ctr[j])
|
||||||
last_ctr = current_ctr
|
last_ctr = current_ctr
|
||||||
last_cor = current_cor
|
last_cor = current_cor
|
||||||
print(sum(sum(cor) for cor in cors))
|
|
||||||
with open("/code/metrics.json", "w") as file:
|
with open("/code/metrics.json", "w") as file:
|
||||||
json.dump({"entries": entries, "cors": cors}, file)
|
json.dump({"entries": entries, "cors": cors}, file)
|
||||||
|
@ -25,11 +25,12 @@ def render_ploc():
|
|||||||
|
|
||||||
|
|
||||||
def render_cors():
|
def render_cors():
|
||||||
|
M = len(cors)
|
||||||
N = len(cors[0])
|
N = len(cors[0])
|
||||||
X = np.arange(N)
|
X = np.arange(N)
|
||||||
Y = np.array(cors)
|
Y = np.array(cors)
|
||||||
plt.clf()
|
plt.clf()
|
||||||
C = N
|
C = M
|
||||||
plt.stackplot(
|
plt.stackplot(
|
||||||
X,
|
X,
|
||||||
Y,
|
Y,
|
||||||
|
Loading…
Reference in New Issue
Block a user