Merge branch 'master' into smudge
This commit is contained in:
commit
39048e4568
9 changed files with 95 additions and 23 deletions
|
@ -31,15 +31,7 @@ batchable handler parser paramdesc = batchseeker <$> batchparser
|
|||
<*> cmdParams paramdesc
|
||||
|
||||
batchseeker (opts, NoBatch, params) = mapM_ (go NoBatch opts) params
|
||||
batchseeker (opts, Batch, _) = batchloop opts
|
||||
|
||||
batchloop opts = do
|
||||
mp <- liftIO $ catchMaybeIO getLine
|
||||
case mp of
|
||||
Nothing -> return ()
|
||||
Just p -> do
|
||||
go Batch opts p
|
||||
batchloop opts
|
||||
batchseeker (opts, Batch, _) = batchInput Right (go Batch opts)
|
||||
|
||||
go batchmode opts p =
|
||||
unlessM (handler opts p) $
|
||||
|
@ -52,11 +44,13 @@ batchBadInput NoBatch = liftIO exitFailure
|
|||
batchBadInput Batch = liftIO $ putStrLn ""
|
||||
|
||||
-- Reads lines of batch mode input and passes to the action to handle.
|
||||
batchSeek :: (String -> Annex ()) -> Annex ()
|
||||
batchSeek a = do
|
||||
batchInput :: (String -> Either String a) -> (a -> Annex ()) -> Annex ()
|
||||
batchInput parser a = do
|
||||
mp <- liftIO $ catchMaybeIO getLine
|
||||
case mp of
|
||||
Nothing -> return ()
|
||||
Just p -> do
|
||||
a p
|
||||
batchSeek a
|
||||
Just v -> do
|
||||
either parseerr a (parser v)
|
||||
batchInput parser a
|
||||
where
|
||||
parseerr s = error $ "Batch input parse failure: " ++ s
|
||||
|
|
|
@ -54,6 +54,7 @@ data AddUrlOptions = AddUrlOptions
|
|||
, relaxedOption :: Bool
|
||||
, rawOption :: Bool
|
||||
, batchOption :: BatchMode
|
||||
, batchFilesOption :: Bool
|
||||
}
|
||||
|
||||
optParser :: CmdParamsDesc -> Parser AddUrlOptions
|
||||
|
@ -78,6 +79,10 @@ optParser desc = AddUrlOptions
|
|||
<*> parseRelaxedOption
|
||||
<*> parseRawOption
|
||||
<*> parseBatchOption
|
||||
<*> switch
|
||||
( long "with-files"
|
||||
<> help "parse batch mode lines of the form \"$url $file\""
|
||||
)
|
||||
|
||||
parseRelaxedOption :: Parser Bool
|
||||
parseRelaxedOption = switch
|
||||
|
@ -93,16 +98,25 @@ parseRawOption = switch
|
|||
|
||||
seek :: AddUrlOptions -> CommandSeek
|
||||
seek o = allowConcurrentOutput $ do
|
||||
forM_ (addUrls o) go
|
||||
forM_ (addUrls o) (\u -> go (o, u))
|
||||
case batchOption o of
|
||||
Batch -> batchSeek go
|
||||
Batch -> batchInput (parseBatchInput o) go
|
||||
NoBatch -> noop
|
||||
where
|
||||
go u = do
|
||||
go (o', u) = do
|
||||
r <- Remote.claimingUrl u
|
||||
if Remote.uuid r == webUUID || rawOption o
|
||||
then void $ commandAction $ startWeb o u
|
||||
else checkUrl r o u
|
||||
if Remote.uuid r == webUUID || rawOption o'
|
||||
then void $ commandAction $ startWeb o' u
|
||||
else checkUrl r o' u
|
||||
|
||||
parseBatchInput :: AddUrlOptions -> String -> Either String (AddUrlOptions, URLString)
|
||||
parseBatchInput o s
|
||||
| batchFilesOption o =
|
||||
let (u, f) = separate (== ' ') s
|
||||
in if null u || null f
|
||||
then Left ("parsed empty url or filename in input: " ++ s)
|
||||
else Right (o { fileOption = Just f }, u)
|
||||
| otherwise = Right (o, s)
|
||||
|
||||
checkUrl :: Remote -> AddUrlOptions -> URLString -> Annex ()
|
||||
checkUrl r o u = do
|
||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -25,7 +25,7 @@ git-annex (5.20151219) UNRELEASED; urgency=medium
|
|||
that were present. Probably caused by a change to what git status
|
||||
displays in this situation. Fixed by treating files git thinks are
|
||||
modified the same as typechanged files.
|
||||
* addurl: Added --batch option.
|
||||
* addurl: Added --batch and --with-files options.
|
||||
|
||||
-- Joey Hess <id@joeyh.name> Sat, 19 Dec 2015 13:31:17 -0400
|
||||
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
### What version of git-annex are you using? On what operating system?
|
||||
|
||||
5.20151116+gitg5416a1a-1~ndall+1
|
||||
|
||||
### Please provide any additional information below.
|
||||
|
||||
[[!format sh """
|
||||
"backend usage": [
|
||||
[
|
||||
"MD5E",
|
||||
2
|
||||
],
|
||||
[
|
||||
"SHA256E",
|
||||
2
|
||||
]
|
||||
],
|
||||
"""]]
|
||||
|
||||
instead of more logical
|
||||
|
||||
[[!format sh """
|
||||
|
||||
"backend usage": {
|
||||
"MD5E": 2,
|
||||
"SHA256E": 2
|
||||
}
|
||||
"""]]
|
||||
|
||||
also it seems it just doubles them since I have only 2 files, 1 for each backend (as reported also by info "local annex keys": 2).
|
||||
|
||||
[[!meta author=yoh]]
|
|
@ -0,0 +1,10 @@
|
|||
[[!comment format=mdwn
|
||||
username="frost.kristian@75a6b6a25121f985cd8708f98c691d41716ac720"
|
||||
nickname="frost.kristian"
|
||||
subject="comment 4"
|
||||
date="2015-12-21T17:47:13Z"
|
||||
content="""
|
||||
I did some digging. When creating a repo from the webapp, it is per default in direct mode. In direct mode, I am not able to run any git commands such as git commit. Subsequently, when running git annex sync. Files added when sync is disabled from the webapp are not committed.
|
||||
|
||||
Is git-annex behaving as expected here?
|
||||
"""]]
|
|
@ -75,6 +75,14 @@ be used to get better filenames.
|
|||
Enables batch mode, in which lines containing urls to add are read from
|
||||
stdin.
|
||||
|
||||
* `--with-files`
|
||||
|
||||
When batch mode is enabled, makes it parse lines of the form: "$url $file"
|
||||
|
||||
That adds the specified url to the specified file, downloading its
|
||||
content if the file does not yet exist; the same as
|
||||
`git annex addurl $url --file $file`
|
||||
|
||||
# SEE ALSO
|
||||
|
||||
[[git-annex]](1)
|
||||
|
|
|
@ -20,8 +20,6 @@ detailed instructions | quick install
|
|||
[[Windows]] | [download installer](https://downloads.kitenet.net/git-annex/windows/current/) **beta**
|
||||
"""]]
|
||||
|
||||
Note: [[todo/git-annex_in_debian_sid]] is somewhat outdated, which makes the above Debian and Ubuntu release not quite up to date. The [NeuroDebian team](http://neuro.debian.net/) provides a [standalone build package](http://neuro.debian.net/pkgs/git-annex-standalone.html) that is regularly updated and that should work across all releases of Ubuntu and Debian. See [[todo/git-annex-standalone_Debian_package/]] for more information.
|
||||
|
||||
All the download links above use https for security. For added security, see
|
||||
[[verifying_downloads]].
|
||||
|
||||
|
|
|
@ -22,3 +22,11 @@ Follow the instructions to [enable backports](http://backports.debian.org/Instru
|
|||
Follow the instructions to [enable backports](http://backports.debian.org/Instructions/).
|
||||
|
||||
sudo apt-get -t squeeze-backports install git-annex
|
||||
|
||||
## backport
|
||||
|
||||
If the version shipped with Debian is too old,
|
||||
the [NeuroDebian team](http://neuro.debian.net/) provides a
|
||||
[standalone build package](http://neuro.debian.net/pkgs/git-annex-standalone.html)
|
||||
that is regularly updated and that should work across all releases of
|
||||
Debian.
|
||||
|
|
|
@ -42,3 +42,11 @@ If you don't have add-apt-repository installed run this command first:
|
|||
Warning: The version of git-annex shipped in Ubuntu Oneiric
|
||||
had [a bug that prevents upgrades from v1 git-annex repositories](https://bugs.launchpad.net/ubuntu/+source/git-annex/+bug/875958).
|
||||
If you need to upgrade such a repository, get a newer version of git-annex.
|
||||
|
||||
## backport
|
||||
|
||||
If the version shipped with Ubuntu is too old,
|
||||
the [NeuroDebian team](http://neuro.debian.net/) provides a
|
||||
[standalone build package](http://neuro.debian.net/pkgs/git-annex-standalone.html)
|
||||
that is regularly updated and that should work across all releases of
|
||||
Ubuntu.
|
||||
|
|
Loading…
Add table
Reference in a new issue