if ! git diff --exit-code $outputs; then
error "sync and async files... out of sync!"
fi
+
+ # Verify that all the transformed files are included in this script
+ # Note: the 'cd' early in the script ensures that cwd is the project root.
+ checked=0
+ errors=0
+ for fn in $(find psycopg psycopg_pool tests -type f -name \*.py); do
+ # Skip files ignored by git (build artifacts)
+ ! git status --porcelain --ignored "${fn}" | grep -q '!!' || continue
+ # Skip non-auto-generated files
+ grep -q "auto-generated by 'async_to_sync.py'" "${fn}" || continue
+
+ checked=$(( $checked + 1 ))
+ afn=${fn/.py/_async.py}
+ if ! grep -q $afn tools/$(basename $0); then
+ errors=$(( $errors + 1 ))
+ log "file '${fn}' seems converted but not included in '$(basename $0)'"
+ fi
+ done
+ [[ $checked -gt 0 ]] || error "No file found to check. Script bitrot?"
+ [[ $errors -eq 0 ]] || error "Some files are not included in async-to-sync conversion."
fi