When looking at the ancestors of https://hg.mozilla.org/mozilla-central/graph/5f217a0d0473, I see a child parent emitted before it's child, which I don't expect. The comment says reversed topological order. ancestors=repo.changelog.ancestors([494205], inclusive=True) print('\n'.join('{} {} {}'.format(repo[r].hex()[:20], i, r) for r, i in zip(ancestors, range(21)))) ends in ca7b0659636ce6e6c836 18 494156 d14aaf65a80b3baddb19 19 494154 1c08b566a5c51e7c4f50 20 494183 The last is a parent of the second, hg log -r 'd14aaf65a80b3baddb19::1c08b566a5c51e7c4f50' -T'{node|short} {desc|firstline}\n' hg log -r 1c08b566a5c51e7c4f50 -v changeset: 494183:1c08b566a5c5 parent: 494182:99bfc4e1be4d parent: 494154:d14aaf65a80b user: Daniel Varga <dvarga@mozilla.com> date: Tue Sep 04 01:05:40 2018 +0300 files: devtools/client/debugger/debugger-commands.js devtools/client/inspector/inspector-commands.js devtools/client/responsive.html/commands.js devtools/client/scratchpad/scratchpad-commands.js devtools/client/styleeditor/styleeditor-commands.js devtools/client/webconsole/console-commands.js description: Merge mozilla-central to mozilla-inbound Tested on 4.7.1
Created attachment 2019 [details] test case I wrote an ancestors iterator for my project, and this is the part of the testcase that I use that demonstrates yielding the parent (0) before the child (1)
We confirm the issue, we have seen it in other cases. We are working on a patch to fix it.
Fixed by https://mercurial-scm.org/repo/hg/rev/b6db2e80a9ce Boris Feld <boris.feld@octobus.net> ancestors: actually iterate over ancestors in topological order (issue5979) This code previously used a dequeue logic, the first ancestors seen were the first ancestors to be emitted. In branching/merging situations, it can result in ancestors being yielded before their descendants, breaking the object contract. We got affected by this issue while working on the copy tracing code. At about the same time, Axel Hecht <axel@mozilla.com> reported the issue and provided the test case used in this changeset. Thanks Axel. Running `hg perfancestors` does not show a significant difference between the old and the new version. (please test the fix)
Bug was set to TESTING for 7 days, resolving