mxcl/homebrew — pull request #8958 by dylanahsmith (2011-12-04 04:31:45+00:00)
Title: Allow brew link or unlink to work with multiple keg versions installed.

I would like to be able to switch versions for some package (e.g. between node 0.4.x & node 0.6.x) easily.

Without this change I would need to do the following to switch from node 0.6.4 to 0.4.12 without uninstalling:

```shell
mkdir -p ~/tmp/node
mv /usr/local/Cellar/node/* ~/tmp/node
mv ~/tmp/node/0.6.4 /usr/local/Cellar/node
brew unlink node
mv /usr/local/Cellar/node/* ~/tmp/node
mv ~/tmp/node/0.4.12 /usr/local/Cellar/node
brew link node
mv ~/tmp/node/* /usr/local/Cellar/node
```

With this change it is at least a little bit more manageable:

```shell
brew unlink node
`brew versions node | grep 0.4.12 | grep -o 'git checkout .*'`
brew link node
```

This also satisfies another use case of temporarily making a package be keg only to avoid conflicts when compiling other software:

```shell
brew unlink libevent
make
brew link libevent
```