summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-10-22 20:35:39 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-10-22 20:35:39 -0400
commitff38e49eb453ccfd58ce0e424aeca97389ab0100 (patch)
treea16c87b4fde45cc3ce640dade31080927110783f
parent8ff3c73556704f94dcf80a1ddbed9430a1579a54 (diff)
--from/--to can be used to limit the remote repository that git-annex uses.
-rw-r--r--Commands.hs6
-rw-r--r--Remotes.hs17
-rw-r--r--debian/changelog2
-rw-r--r--doc/git-annex.mdwn9
4 files changed, 26 insertions, 8 deletions
diff --git a/Commands.hs b/Commands.hs
index 62eb08e83..3e7447c5b 100644
--- a/Commands.hs
+++ b/Commands.hs
@@ -62,8 +62,10 @@ options = [
"specify default key-value backend to use"
, Option ['k'] ["key"] (ReqArg (storestring "key") "KEY")
"specify a key to use"
- , Option ['r'] ["repository"] (ReqArg (storestring "repository") "REPOSITORY")
- "specify a repository"
+ , Option ['t'] ["to"] (ReqArg (storestring "repository") "REPOSITORY")
+ "specify a repository to transfer content to"
+ , Option ['f'] ["from"] (ReqArg (storestring "repository") "REPOSITORY")
+ "specify a repository to transfer content from"
]
where
storebool n b = Annex.flagChange n $ FlagBool b
diff --git a/Remotes.hs b/Remotes.hs
index 0e7dd31ea..8418a4225 100644
--- a/Remotes.hs
+++ b/Remotes.hs
@@ -70,7 +70,7 @@ remotesByCost = do
g <- Annex.gitRepo
reposByCost $ Git.remotes g
-{- Orders a list of git repos by cost, and throws out ignored ones. -}
+{- Orders a list of git repos by cost. Throws out ignored ones. -}
reposByCost :: [Git.Repo] -> Annex [Git.Repo]
reposByCost l = do
notignored <- filterM repoNotIgnored l
@@ -99,14 +99,21 @@ repoCost r = do
config g r = Git.configGet g (configkey r) ""
configkey r = "remote." ++ (Git.repoRemoteName r) ++ ".annex-cost"
-{- Checks if a repo should be ignored. -}
+{- Checks if a repo should be ignored, based either on annex-ignore
+ - setting, or on command-line options. Allows command-line to override
+ - annex-ignore. -}
repoNotIgnored :: Git.Repo -> Annex Bool
repoNotIgnored r = do
g <- Annex.gitRepo
- return ("true" /= config g r)
+ name <- Annex.flagGet "repository"
+ if (not $ null name)
+ then return $ match name
+ else return $ notignored g
where
- config g r = Git.configGet g (configkey r) ""
- configkey r = "remote." ++ (Git.repoRemoteName r) ++ ".annex-ignore"
+ match name = name == Git.repoRemoteName r
+ notignored g = "true" /= config g
+ config g = Git.configGet g configkey ""
+ configkey = "remote." ++ (Git.repoRemoteName r) ++ ".annex-ignore"
{- The git configs for the git repo's remotes is not read on startup
- because reading it may be expensive. This function tries to read the
diff --git a/debian/changelog b/debian/changelog
index 68f9f02cd..0a27cd12e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,8 @@ git-annex (0.02) UNRELEASED; urgency=low
file content when dropping files.
* Add remote.annex-ignore git config setting to allow completly disabling
a given remote.
+ * --from/--to can be used to limit the remote repository that git-annex
+ uses.
-- Joey Hess <joeyh@debian.org> Thu, 21 Oct 2010 16:38:00 -0400
diff --git a/doc/git-annex.mdwn b/doc/git-annex.mdwn
index 37100fcee..e67d9092c 100644
--- a/doc/git-annex.mdwn
+++ b/doc/git-annex.mdwn
@@ -133,10 +133,17 @@ Many git-annex subcommands will stage changes for later `git commit` by you.
Specifies a key to operate on, for use with the addkey subcommand.
+* --from=repository
+
+ Specifies a repository that content will be retrieved from.
+ It should be specified using the name of a configured git remote.
+
+ This can be used to limit the repository used by 'git annex get'.
+
* --to=repository
Specifies a git repository that content will be sent to.
- It can be specified by a path, url, or remote name.
+ It should be specified using the name of a configured git remote.
## CONFIGURATION