Closed felipec closed 1 year ago
I like this and also #298. I will merge #298 first, then convert my (not published) smoke test to Sharness, merge that and then merge this PR. If this PR results in NFC, the smoke-test should produce the same result.
@felipec: I have now merged both @298 and #299, thank you for your contribution!
Great! I presume you tried to clone different repositories and the result was exactly the same.
Yes, I tested with the gmp, hg, lemon, nginx, pidgin, and xine-lib repos. git fast-export --all | sha1sum
produces the same hash for both versions.
This code hasn't been touched in decades, but most of it is not necessary. In git-remote-hg we've been using a simplified version of
get_filechanges
+split_dict
for many years (maybe a decade?).All that is needed is to compare the files of the new commit with the ones of the first parent.
To test the different versions of the code I wrote a benchmarking tool filechanges-perf. The new version of the code is reliably faster, and produces the same resulting repos. In the case of
hg
it's almost twice as fast.I tested with
hg
,mozilla-central
, andhg-git
:Same output, faster execution, and simpler code.