configuration and docs for tracking exports

Not yet handled by sync or assistant.

This commit was sponsored by Nick Daly on Patreon.
This commit is contained in:
Joey Hess 2017-09-19 13:05:43 -04:00
parent a6268b79b2
commit 527f734492
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
6 changed files with 50 additions and 0 deletions

View file

@ -28,6 +28,7 @@ import Logs.Location
import Logs.Export
import Database.Export
import Messages.Progress
import Config
import Utility.Tmp
import qualified Data.ByteString.Lazy as L
@ -41,16 +42,22 @@ cmd = command "export" SectionCommon
data ExportOptions = ExportOptions
{ exportTreeish :: Git.Ref
, exportRemote :: DeferredParse Remote
, exportTracking :: Bool
}
optParser :: CmdParamsDesc -> Parser ExportOptions
optParser _ = ExportOptions
<$> (Git.Ref <$> parsetreeish)
<*> (parseRemoteOption <$> parseToOption)
<*> parsetracking
where
parsetreeish = argument str
( metavar paramTreeish
)
parsetracking = switch
( long "tracking"
<> help ("track changes to the " ++ paramTreeish)
)
-- To handle renames which swap files, the exported file is first renamed
-- to a stable temporary name based on the key.
@ -75,6 +82,10 @@ seek' o r = do
db <- openDb (uuid r)
ea <- exportActions r
recordExportBeginning (uuid r) new
when (exportTracking o) $
setConfig (remoteConfig r "export-tracking")
(fromRef $ exportTreeish o)
-- Clean up after incomplete export of a tree, in which
-- the next block of code below may have renamed some files to