diff options
-rw-r--r-- | CmdLine/Batch.hs | 22 | ||||
-rw-r--r-- | Command/AddUrl.hs | 26 | ||||
-rw-r--r-- | debian/changelog | 2 | ||||
-rw-r--r-- | doc/bugs/info_--json_lists_backend_usage_stats_as_a_list_of_lists.mdwn | 32 | ||||
-rw-r--r-- | doc/forum/Purge_whereis/comment_4_72b6c28d8a4865ad8c84b1f7dfefb78a._comment | 10 | ||||
-rw-r--r-- | doc/git-annex-addurl.mdwn | 8 | ||||
-rw-r--r-- | doc/install.mdwn | 2 | ||||
-rw-r--r-- | doc/install/Debian.mdwn | 8 | ||||
-rw-r--r-- | doc/install/Ubuntu.mdwn | 8 |
9 files changed, 95 insertions, 23 deletions
diff --git a/CmdLine/Batch.hs b/CmdLine/Batch.hs index ce9127975..d8d210de4 100644 --- a/CmdLine/Batch.hs +++ b/CmdLine/Batch.hs @@ -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 diff --git a/Command/AddUrl.hs b/Command/AddUrl.hs index 659274e49..746a6725c 100644 --- a/Command/AddUrl.hs +++ b/Command/AddUrl.hs @@ -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 diff --git a/debian/changelog b/debian/changelog index d1c649a51..1ce79936e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 diff --git a/doc/bugs/info_--json_lists_backend_usage_stats_as_a_list_of_lists.mdwn b/doc/bugs/info_--json_lists_backend_usage_stats_as_a_list_of_lists.mdwn new file mode 100644 index 000000000..8d9fa8c99 --- /dev/null +++ b/doc/bugs/info_--json_lists_backend_usage_stats_as_a_list_of_lists.mdwn @@ -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]] diff --git a/doc/forum/Purge_whereis/comment_4_72b6c28d8a4865ad8c84b1f7dfefb78a._comment b/doc/forum/Purge_whereis/comment_4_72b6c28d8a4865ad8c84b1f7dfefb78a._comment new file mode 100644 index 000000000..0e0cab11c --- /dev/null +++ b/doc/forum/Purge_whereis/comment_4_72b6c28d8a4865ad8c84b1f7dfefb78a._comment @@ -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? +"""]] diff --git a/doc/git-annex-addurl.mdwn b/doc/git-annex-addurl.mdwn index eecc2c2bd..20cec9259 100644 --- a/doc/git-annex-addurl.mdwn +++ b/doc/git-annex-addurl.mdwn @@ -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) diff --git a/doc/install.mdwn b/doc/install.mdwn index 5c6c65bc6..31626d7b0 100644 --- a/doc/install.mdwn +++ b/doc/install.mdwn @@ -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]]. diff --git a/doc/install/Debian.mdwn b/doc/install/Debian.mdwn index 3401afded..ce928e51f 100644 --- a/doc/install/Debian.mdwn +++ b/doc/install/Debian.mdwn @@ -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. diff --git a/doc/install/Ubuntu.mdwn b/doc/install/Ubuntu.mdwn index fde0e1c12..1e44226af 100644 --- a/doc/install/Ubuntu.mdwn +++ b/doc/install/Ubuntu.mdwn @@ -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. |