getncchanges.c: Refactor to track more state using repl_chunk