3 # A hack to count how many commits in a given mainline release were
4 # backported to a previous series of stable commits.
6 # git log stable..stable | count_backports v5.17
12 return v2
.startswith(v1
)
14 p_upstream
= re
.compile(r
'commit ([0-9a-f]+) upstream', re
.I
)
15 p_upstream2
= re
.compile(r
'upstream commit ([0-9a-f]+)', re
.I
)
18 m
= p_upstream
.search(patch
.changelog
) or \
19 p_upstream2
.search(patch
.changelog
)
24 db
= pickle
.load(open('committags.db', 'rb'))
26 # Add 12-char versions of all commit IDs since that's what appears
27 # in some stable commits. Copy it to a new dict since otherwise the
28 # keys iterator complains.
31 for commit
in db
.keys():
32 VDB
[commit
[:12]] = VDB
[commit
] = db
[commit
]
37 patch
= gitlog
.grabpatch(input)
44 versions
[VDB
[up
]] += 1
47 patch
= gitlog
.grabpatch(input)
49 print(f
'{seen} patches seen.')
50 for v
in sorted(versions
):
51 print(f
' {v}: {versions[v]} ({100*versions[v]/seen:.2f}%)')