summaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2017-09-19 13:05:43 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2017-09-19 13:05:43 -0400
commitc1cfb595d426ebbad6b9778d03ecaef544df776b (patch)
treecbd69743deae06bd805ddb654f5b3ecea312ffd0 /Command
parentd1f97163ff320c21676528f70213112591ed38dd (diff)
configuration and docs for tracking exports
Not yet handled by sync or assistant. This commit was sponsored by Nick Daly on Patreon.
Diffstat (limited to 'Command')
-rw-r--r--Command/Export.hs11
1 files changed, 11 insertions, 0 deletions
diff --git a/Command/Export.hs b/Command/Export.hs
index 02c64eadf..81013ad47 100644
--- a/Command/Export.hs
+++ b/Command/Export.hs
@@ -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