How do early transmissions know when to shift? How do they go to the right gears for the right conditions (heavy acceleration, going up a hill etc.)? I cannot imagine how it is done without electrical components, but it seems like they were purely using hydraulics.
//edit: This answer is based on assumption that "purely mechanical" excludes torque converters and we're talking about actual gears shifting, as in "manual gearbox with a mind of it's own".
When RPM goes beyond certain range, it's a cue to shift up. When RPM drops below another threshold, to downshift. That's all.
The whole point of a gearbox is to maintain engine RPM in optimal range. All other things are just tweaking this match in anticipation of a future change Eg. going uphill you're mentioning is merely a prediction that the speed of the vehicle won't actually increase enough to make the most out of upshift. By applying this prediction you defer shifting - but disregarding the condition and shifting as usual will not make the gearbox unusable, it'll just have to shift down again soon.
Also keep in mind that the bigger the engine, the more the power margin the system as a whole has. So while a tiny, overworked engine needs a lot of skillful shifting to stay in this one tiny rpm spot where it can manage, a big, overpowered engine will easily cover for any shifting mistakes. (That's the original reason why automatics are ubiquitous in USA but unpopular in Europe: US engines are bigger, so the gearbox has so much less work to do.)
Also, as some early mechanical automatics still depended on driver pressing the clutch, all the sophisticated decision making on "when to shift" was still done by a protein-based electrical computer. The gearbox only had to decide if and which way to shift, which is a very simple decision to make based on - wait for it - RPM alone.