Fix adding new repositories and checking for new versions.

There was a regression which caused repository adds to always fail because a branch "~master" was being searched instead of "master". After this was fixed, `swap()` strangely complained about `Tuple` assignment, so a struct is now used.