-J for add/addurl/import
authorJoey Hess <joeyh@joeyh.name>
Thu, 5 Nov 2015 22:24:15 +0000 (18:24 -0400)
committerJoey Hess <joeyh@joeyh.name>
Thu, 5 Nov 2015 22:24:15 +0000 (18:24 -0400)
Command/Add.hs
Command/AddUrl.hs
Command/Import.hs
debian/changelog
doc/git-annex-add.mdwn
doc/git-annex-addurl.mdwn
doc/git-annex-import.mdwn

index 11682207e018aa847464e6cae7e86699df5bef63..94a19fba5cacf886c8d45d89f66443eb8ac51e4e 100644 (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
index 4b34051e9c63d492371023d6c2e86928904d273e..6ed4fb2e2d5fd36ec0ff0ecf9f654fc2e3312b3e 100644 (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,11 +87,12 @@ parseRawOption = switch
        )
 
 seek :: AddUrlOptions -> CommandSeek
-seek o = forM_ (addUrls 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
+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
+                       else checkUrl r o u
 
 checkUrl :: Remote -> AddUrlOptions -> URLString -> Annex ()
 checkUrl r o u = do
index a96c080556ddb5f7bad5b771e1bde28614109aa5..3ace2d2b0592d070b7fef7f477eddd1eef728b3e 100644 (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
index 44ed24a604cf11b5185c846940c2c037d7c94d27..da322b50eaba56875ec9b7ce44be06045b5bd0b4 100644 (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
 
index ee5f499d9c42fbd797282b007045c3af3135f5f4..cfeb8a98e58205d1d0cfb6873c231b2f74ad9616 100644 (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)
index 1503a284ea767b02de6794f2fc8762b5bd425348..0f5a763bc1f3ab4f39430749f0d27a9724a8872f 100644 (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)
index 48c087aec285db6b7c9fc838654f55a2b2ce301f..ca37b81ebb81dfcfe9099a5dd7a87749a0ff965b 100644 (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