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:
parent
a6268b79b2
commit
527f734492
6 changed files with 50 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue