capistrano/capistrano — pull request #514 by jondavidjohn (2013-06-18 16:05:56+00:00)
Title: make rollback context aware, standalone vs deploy

The issue here is that when a deploy fails, in our case on `deploy:cleanup`, the wrong release is symlinked.

It is currently symlinking the `previous_release` which is actually the release before the most recently successful release during a deploy.

When called standalone `deploy:rollback`, this is the correct behavior.

Example of current behaviour.

Before Deploy => http://d.pr/i/gWAY

Deploy Fails and attempts Roll back => http://d.pr/i/H7cP

Notice it rolls back to a release that is **before** the release that was active before the deploy started.