I've heard from many sources that the ending to Monty Python and the Holy Grail (where it abruptly ends just before an invasion on the French castle, due to the police arriving to arrest the cast) was put in at the last moment because they were essentially out of money.

This doesn't really strike me as true, given the foreshadowing that built up to it (the historian scenes). I suppose they could have been filmed later as well and interspersed, but the impression I had always had was that they just cut the last bits of the movie, replacing them with the arrest scene, not filmed several other short scenes to mix in earlier.

Is this the case? Were all those scenes last-minute changes? If so, what was the original ending supposed to be?