state: only update API host ports if changed

If the API host ports haven't changed, don't
update them. This avoids spamming the transaction log
with unnecessary writes.

Fixes https://bugs.launchpad.net/juju-core/+bug/1345832
> I'm not sure assertions should be made on the way txn-revno's change (other than the fact that they increment).

Why? There's no concurrency here, so we know for a fact that there's only one revision change.

Other than that, I'm not really sure what you're suggesting. Your alternative does not work: txRevnoExpected is initially zero, so the assertion for i=0 will fail.