(bug 46476) count idle passes against --max-passes

This change avoids process pile-up when dispatchChanges is run from cron
with no --max-time given, while no changes happen on the repo.

Also improved debug output and code structure a bit.

Change-Id: I525152d356f33580116c235a19e9c0d2ff066cd4