Make reinstall transaction safe.

* Aborting during reinstall will now restore the originally installed keg.
More robust exception handling.

* It is possible that install_formula of install may raise exception
  that got swallowed.  So implement another helper that reraise the
  exception and hand it over to clean up routine.
Avoid duplicated code.

* Reuse install_formula from install.
* Don't handle CannotInstallFormulaError anymore.
  - The exception message will still be printed when brew abort.
  - Now reinstall can catch this, print e.message, and do recovery
    work.
* Add directory check before reinstate reinstall stage directory.