repo: Tweak traversal API

It's convenient for bindings if we have a version that doesn't mutate
the hash table, because they pass temporary hash tables as input.