-J for add/addurl/import

This commit is contained in:
Joey Hess 2015-11-05 18:24:15 -04:00
parent 31472161e4
commit 5db7d435e7
Failed to extract signature
7 changed files with 28 additions and 11 deletions

View file

@ -35,7 +35,7 @@ import Utility.Tmp
import Control.Exception (IOException)
cmd :: Command
cmd = notBareRepo $ withGlobalOptions fileMatchingOptions $
cmd = notBareRepo $ withGlobalOptions (jobsOption : fileMatchingOptions) $
command "add" SectionCommon "add files to annex"
paramPaths (seek <$$> optParser)
@ -56,7 +56,7 @@ optParser desc = AddOptions
-
- In direct mode, it acts on any files that have changed. -}
seek :: AddOptions -> CommandSeek
seek o = do
seek o = allowConcurrentOutput $ do
matcher <- largeFilesMatcher
let go a = flip a (addThese o) $ \file -> ifM (checkFileMatcher matcher file <||> Annex.getState Annex.force)
( start file

View file

@ -38,7 +38,7 @@ import qualified Utility.Quvi as Quvi
#endif
cmd :: Command
cmd = notBareRepo $
cmd = notBareRepo $ withGlobalOptions [jobsOption] $
command "addurl" SectionCommon "add urls to annex"
(paramRepeating paramUrl) (seek <$$> optParser)
@ -87,7 +87,8 @@ parseRawOption = switch
)
seek :: AddUrlOptions -> CommandSeek
seek o = forM_ (addUrls o) $ \u -> do
seek o = allowConcurrentOutput $
forM_ (addUrls o) $ \u -> do
r <- Remote.claimingUrl u
if Remote.uuid r == webUUID || rawOption o
then void $ commandAction $ startWeb o u

View file

@ -21,7 +21,7 @@ import Annex.CheckIgnore
import Annex.NumCopies
cmd :: Command
cmd = withGlobalOptions fileMatchingOptions $ notBareRepo $
cmd = withGlobalOptions (jobsOption : fileMatchingOptions) $ notBareRepo $
command "import" SectionCommon
"move and add files from outside git working copy"
paramPaths (seek <$$> optParser)
@ -59,7 +59,7 @@ duplicateModeParser =
)
seek :: ImportOptions -> CommandSeek
seek o = do
seek o = allowConcurrentOutput $ do
repopath <- liftIO . absPath =<< fromRepo Git.repoPath
inrepops <- liftIO $ filter (dirContains repopath) <$> mapM absPath (importFiles o)
unless (null inrepops) $ do

3
debian/changelog vendored
View file

@ -2,7 +2,8 @@ git-annex (5.20151102.2) UNRELEASED; urgency=medium
* Use concurrent-output library when configured with -fConcurrentOutput.
This allows nicely displayed messages when using the -J flag.
* Additional commands now suppport the -J flag: fsck, drop
* Additional commands now suppport the -J flag:
fsck, drop, add, addurl, import
-- Joey Hess <id@joeyh.name> Wed, 04 Nov 2015 12:50:20 -0400

View file

@ -43,6 +43,11 @@ annexed content, and other symlinks.
For example: `--largerthan=1GB`
* `--jobs=N` `-JN`
Adds multiple files in parallel. This may be faster.
For example: `-J4`
# SEE ALSO
[[git-annex]](1)

View file

@ -65,6 +65,11 @@ be used to get better filenames.
Use to adjust the filenames that are created by addurl. For example,
`--suffix=.mp3` can be used to add an extension to the file.
* `--jobs=N` `-JN`
Enables parallel downloads when multiple urls are being added.
For example: `-J4`
# SEE ALSO
[[git-annex]](1)

View file

@ -66,6 +66,11 @@ Several options can be used to adjust handling of duplicate files.
git annex import /dir --include='*.png'
* `--jobs=N` `-JN`
Imports multiple files in parallel. This may be faster.
For example: `-J4`
# CAVEATS
Note that using `--deduplicate` or `--clean-duplicates` with the WORM