aboutsummaryrefslogtreecommitdiff
path: root/Remote.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-11-07 18:02:00 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-11-07 18:02:00 -0400
commitcffc5e74129be798801086c612efd099fe7148ac (patch)
treed9f1849379ded21dcf1b604c1eb76d8fecdf2900 /Remote.hs
parent38af1ef22c6da0ade33208021f51141eff986e94 (diff)
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.
Diffstat (limited to 'Remote.hs')
-rw-r--r--Remote.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/Remote.hs b/Remote.hs
index 71db09ce7..56a40c71e 100644
--- a/Remote.hs
+++ b/Remote.hs
@@ -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. -}