Strange issues with msgout/msgin
Sorry, I don't have a simple reproducer for this; it occurs while processing the msgout stream of a gcc conversion.
While reading back a modified event stream, produced directly from a script processing the result of a msgout command, I'm getting errors of the form:
reposurgeon: event number 1680778 out of range in update 42887
reposurgeon: event number 1680833 out of range in update 42888
reposurgeon: event number 1680903 out of range in update 42889
reposurgeon: event number 1681436 out of range in update 42890
reposurgeon: event number 1681547 out of range in update 42891
reposurgeon: event number 1681558 out of range in update 42892
reposurgeon: event number 1681584 out of range in update 42893
reposurgeon: event number 1681594 out of range in update 42894
reposurgeon: event number 1681609 out of range in update 42895
reposurgeon: event number 1681643 out of range in update 42896
reposurgeon: event number 1686907 out of range in update 42897
The main problem is that none of these event numbers exist in the msgin file. This only occurs right at the end.
Looking at the code I see,
eventnum-- if eventnum < 0 || eventnum >= len(repo.events) { croak("event number %d out of range in update %d",
And indeed looking at the input stream, events which are one more than the printed number do exist.
This suggests perhaps two problems. Firstly, the croak message is printing the wrong number. Secondly, since these event numbers are in the output stream produced by msgout, this suggests some other problem. Since it is only events right at the end of the stream, I wonder if some events have somehow been deleted, so that the event numbering in repo.events is no-longer contiguous?
A reproducer would probably just be to run msgout >eventstream msgin <eventstream
I don't think the intermediate processing is changing any of the event numbers (as you can see, it successfully handled the first 42886 commits, each of which has the check-text present to ensure the commit is applied to the correct event.
I'm using https://gitlab.com/frnchfrgg/reposurgeon/tree/mergeinfo-bug, but rebased onto 150e06d9 to pick up the changelogs fix.
Just in case it is relevant, I'm running the msgout/in steps after the changelog processing.