File: check-implementer-notes.py

package info (click to toggle)
libreoffice 4%3A26.2.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 3,838,464 kB
  • sloc: cpp: 4,398,766; xml: 499,253; java: 254,438; python: 81,885; ansic: 33,826; perl: 30,297; javascript: 19,722; sh: 12,042; makefile: 10,848; cs: 8,865; yacc: 8,549; objc: 2,131; lex: 1,385; asm: 1,231; awk: 996; pascal: 914; csh: 20; sed: 5
file content (35 lines) | stat: -rwxr-xr-x 1,421 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python

import json
import re
import subprocess
import sys
import urllib3

http = urllib3.PoolManager()

# TDF implementer notes pages for LibreOffice
wiki_pages = [
    'https://wiki.documentfoundation.org/api.php?action=parse&format=json&page=Development/ODF_Implementer_Notes/List_of_LibreOffice_ODF_Extensions&prop=wikitext',
    'https://wiki.documentfoundation.org/api.php?action=parse&format=json&page=Development/ODF_Implementer_Notes/List_of_LibreOffice_OpenFormula_Extensions&prop=wikitext']

# get all commit hashes mentioned in implementer notes
wiki_commit_hashes = {}
query = re.compile(r'\{\{commit\|(\w+)\|\w*\|\w*\}\}', re.IGNORECASE)
for page in wiki_pages:
    r = http.request('GET', page)
    data = json.loads(r.data.decode('utf-8'))
    for line in data['parse']['wikitext']['*'].split('\n'):
        for res in query.finditer(line):
            wiki_commit_hashes[res.group(1)] = ''

# get all commits that change core/schema/* - and are _not_ mentioned
# in the wiki page
# Cut-off is May 18th 2020, when Michael Stahl had finished cleaning this up
for commit in subprocess.check_output(
        ['git', '--no-pager', '-C', sys.path[0]+'/..', 'log',
         '--since=2020-05-18', '--format=%H', '--', 'schema/'],
        stderr=subprocess.STDOUT).decode("utf-8").split("\n"):
    if commit != '' and commit not in wiki_commit_hashes:
        print('missing commit: %s' % commit)