--from/--to can be used to limit the remote repository that git-annex uses.

This commit is contained in:
Joey Hess 2010-10-22 20:35:39 -04:00
parent 8ff3c73556
commit ff38e49eb4
4 changed files with 26 additions and 8 deletions

View file

@ -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

View file

@ -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

2
debian/changelog vendored
View file

@ -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

View file

@ -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