summaryrefslogtreecommitdiff
path: root/Remotes.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Remotes.hs')
-rw-r--r--Remotes.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/Remotes.hs b/Remotes.hs
index cf49b624b..725348a6a 100644
--- a/Remotes.hs
+++ b/Remotes.hs
@@ -12,6 +12,7 @@ module Remotes (
inAnnex,
same,
commandLineRemote,
+ byName,
copyFromRemote,
copyToRemote,
runCmd
@@ -156,6 +157,11 @@ commandLineRemote = do
fromName <- Annex.flagGet "fromrepository"
toName <- Annex.flagGet "torepository"
let name = if null fromName then toName else fromName
+ byName name
+
+{- Looks up a remote by name. -}
+byName :: String -> Annex Git.Repo
+byName name = do
when (null name) $ error "no remote specified"
g <- Annex.gitRepo
let match = filter (\r -> name == Git.repoRemoteName r) $