git-annex/Command/Assist.hs
Joey Hess 3c1d18cb3b
assist: With --jobs, parallelize transferring content to/from remotes
Command.Add.seek starts concurrency with CommandStages. And for
Command.Sync, it needs TransferStages. So, to get both types of concurrency
for the two different parts, it either needs to change the type of
concurrency in between, or just call startConcurrency once for each.

It seems safe enough to call startConcurrency twice, because it does shut
down concurrency (mostly) at the end, and eg the old Annex.workers get
emptied.

Sponsored-by: unqueued on Patreon
2023-07-05 12:47:30 -04:00

42 lines
1.2 KiB
Haskell

{- git-annex command
-
- Copyright 2023 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU AGPL version 3 or higher.
-}
module Command.Assist (cmd) where
import Command
import qualified Command.Sync
import qualified Command.Add
import Annex.CheckIgnore
import qualified Annex.Queue
cmd :: Command
cmd = withAnnexOptions [jobsOption, backendOption] $
command "assist" SectionCommon
"add files and sync changes with remotes"
(paramRepeating paramRemote)
(myseek <--< Command.Sync.optParser Command.Sync.AssistMode)
myseek :: Command.Sync.SyncOptions -> CommandSeek
myseek o = do
-- Changes to top of repository, so when this is run in a
-- subdirectory, it will still default to adding files anywhere in
-- the working tree.
Command.Sync.prepMerge
Command.Add.seek Command.Add.AddOptions
{ Command.Add.addThese = Command.Sync.contentOfOption o
, Command.Add.batchOption = NoBatch
, Command.Add.updateOnly = False
, Command.Add.largeFilesOverride = Nothing
, Command.Add.checkGitIgnoreOption = CheckGitIgnore True
, Command.Add.dryRunOption = DryRun False
}
finishCommandActions
-- Flush added files to index so they will be committed.
Annex.Queue.flush
Command.Sync.seek' o