Do any aircraft carry spare parts for making repairs?
South African Airways flights to 'less developed' locations in Africa often carry a mechanic and some spares on board. If there are no suitable repair facilities, supplies or maintenance personnel available at the destination, then their own guy can fix any minor mechanical issues. If there's a major problem then they would have to fly in additional repair supplies and staff (and fly out the stranded passengers).

I found this out on a flight from Johannesberg to Lilongwe (Malawi). A seat was broken in the passenger cabin and SAA's on-board mechanic was able to fix it after a short delay. The captain explained briefly why he was on board.

I assume that other airlines or operators who operate in undeveloped areas would do the same. It's a lot cheaper to carry a mechanic and a few spares than it is to have an aircraft, crew and passengers stranded. If anything on the MEL is broken then an airliner isn't airworthy so even a 'minor' issue can ground it.

I guess that the military might do the same for similar reasons, but I have no idea at all about that.