MCPcopy
hub / github.com/rsms/inter / main

Function main

misc/tools/show-changes.py:9–112  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7
8
9def main():
10 opts = ArgumentParser(description='Shows glyph-related changes.')
11
12 opts.add_argument(
13 'sinceCommit', metavar='<since-commit>', type=str,
14 help='Start commit.')
15
16 opts.add_argument(
17 'untilCommit', metavar='<until-commit>', type=str, nargs='?',
18 default='HEAD', help='End commit. Defaults to HEAD.')
19
20 opts.add_argument(
21 '-markdown', dest='markdown', action='store_const',
22 const=True, default=False,
23 help='Output text suitable for Markdown (rather than plain text.)')
24
25 a = opts.parse_args()
26
27 rootdir = os.path.abspath(os.path.join(
28 os.path.dirname(__file__),
29 os.pardir
30 ))
31
32 try:
33 out = subprocess.check_output(
34 [
35 'git',
36 '-C', rootdir,
37 'diff',
38 '--name-status',
39 a.sinceCommit + '..' + a.untilCommit,
40 '--', 'src'
41 ],
42 shell=False
43 ).strip()
44 except Exception as e:
45 print('Did you forget to `git fetch --tags` perhaps?', file=sys.stderr)
46 sys.exit(1)
47
48 ufoPrefix = 'src/Inter-'
49 changes = OrderedDict()
50 deleted = []
51
52 for line in out.split('\n'):
53 changeType, name = line.split('\t')
54 if name.startswith(ufoPrefix) and name.endswith('.glif'):
55 weight = name[len(ufoPrefix):name.find('.ufo/')]
56 filename = os.path.join(rootdir, name)
57 try:
58 doc = xmlParseFile(filename)
59 except:
60 deleted.append('%s/%s' % (weight, os.path.basename(name)))
61 continue
62
63 g = doc.documentElement
64 gname = g.attributes['name'].value
65 unicodes = set([
66 'U+' + u.attributes['hex'].value

Callers 1

show-changes.pyFile · 0.70

Calls 1

getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…