[RFC] ChangeLog generation script
Siddhesh Poyarekar
siddhesh@gotplt.org
Mon Nov 19 19:57:00 GMT 2018
Hello,
I am back from under my rock with a draft of the ChangeLog generation
script. I've had this ready for a while but was trying to make it run
faster - it currently takes a little under 30 seconds to generate the
ChangeLog between glibc-2.27 and glibc-2.28. I hae a few ideas to
reduce the time spent (like using git diff -U100000 instead of the two
files) but I can pursue them after the script has gone in as well.
At a high level the script accepts two inputs, a from-ref and a to-ref
and generates a ChangeLog like output between these refs. Note that
this is not a proper ChangeLog; it provides a lot of the information
that a ChangeLog would give and some additional information in context
of its origin, i.e. the git history.
The script goes through each ref in the range and for each ref, gets the
before and after refs of each change. For non-C code (i.e anything that
is not *.c or *.h), it indicates whether the file was added, deleted,
modified or renamed.
For C code, it goes further for modifications and renames where the old
and new file are not identical, by generating parse trees for the old
and new files and compares those trees to generate a source level ChangeLog.
What it can detect:
- Adds, modifications, renames and deletions.
- Top level objects like static variables, function declarations and
definitions, structs and unions and assignments.
- Nesting within macro conditions. It's not perfect, but pretty decent.
What it cannot do yet:
- Detect changes to comments. It's just dropping all comments right
now, so changes that are comment-only end up seeming identical.
- Changes within function definitions, struct members. The script only
knows that it changed, not what changed inside.
- Weird macro nesting will break things. I tried to adjust for some
weirdness that I encountered in my testing, but I am confident that an
'innovative' C programmer can break this.
Overall I reckon that this is good to go in terms of concept, but that's
only because I'm the script's mommy and mommies always think their
babies are the best.
Comments welcome!
Siddhesh
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gen-changed-entities.py
Type: text/x-python
Size: 24538 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20181119/4a1b8181/attachment.py>
More information about the Libc-alpha
mailing list