webapp: Improve UI around remote that have no annex.uuid set, either because setup of them is incomplete, or because the remote git repository is not a git-annex repository.

Complicated by such repositories potentially being repos that should have
an annex.uuid, but it failed to be gotten, perhaps due to the past ssh repo
setup bugs. This is handled now by an Upgrade Repository button.
This commit is contained in:
Joey Hess 2013-11-07 18:02:00 -04:00
parent b7c15f3b60
commit 958312885f
26 changed files with 209 additions and 156 deletions

View file

@ -24,6 +24,7 @@ module Remote (
remoteMap,
uuidDescriptions,
byName,
byNameOnly,
byNameWithUUID,
byCost,
prettyPrintUUIDs,
@ -58,7 +59,7 @@ import Logs.Trust
import Logs.Location hiding (logStatus)
import Remote.List
import Config
import Git.Remote
import Git.Types (RemoteName)
{- Map from UUIDs of Remotes to a calculated value. -}
remoteMap :: (Remote -> a) -> Annex (M.Map UUID a)
@ -104,6 +105,12 @@ byName' n = handle . filter matching <$> remoteList
handle (match:_) = Right match
matching r = n == name r || toUUID n == uuid r
{- Only matches remote name, not UUID -}
byNameOnly :: RemoteName -> Annex (Maybe Remote)
byNameOnly n = headMaybe . filter matching <$> remoteList
where
matching r = n == name r
{- Looks up a remote by name (or by UUID, or even by description),
- and returns its UUID. Finds even remotes that are not configured in
- .git/config. -}