Reimplement mergechanges in Python
This avoids the relatively heavyweight process of starting an
environment and installing devscripts in it. It also avoids a mawk
segfault that happened when that environment was for Debian buster.
Fixes: #512 (closed)