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 Logs.Export
|
||||||
import Database.Export
|
import Database.Export
|
||||||
import Messages.Progress
|
import Messages.Progress
|
||||||
|
import Config
|
||||||
import Utility.Tmp
|
import Utility.Tmp
|
||||||
|
|
||||||
import qualified Data.ByteString.Lazy as L
|
import qualified Data.ByteString.Lazy as L
|
||||||
|
@ -41,16 +42,22 @@ cmd = command "export" SectionCommon
|
||||||
data ExportOptions = ExportOptions
|
data ExportOptions = ExportOptions
|
||||||
{ exportTreeish :: Git.Ref
|
{ exportTreeish :: Git.Ref
|
||||||
, exportRemote :: DeferredParse Remote
|
, exportRemote :: DeferredParse Remote
|
||||||
|
, exportTracking :: Bool
|
||||||
}
|
}
|
||||||
|
|
||||||
optParser :: CmdParamsDesc -> Parser ExportOptions
|
optParser :: CmdParamsDesc -> Parser ExportOptions
|
||||||
optParser _ = ExportOptions
|
optParser _ = ExportOptions
|
||||||
<$> (Git.Ref <$> parsetreeish)
|
<$> (Git.Ref <$> parsetreeish)
|
||||||
<*> (parseRemoteOption <$> parseToOption)
|
<*> (parseRemoteOption <$> parseToOption)
|
||||||
|
<*> parsetracking
|
||||||
where
|
where
|
||||||
parsetreeish = argument str
|
parsetreeish = argument str
|
||||||
( metavar paramTreeish
|
( 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 handle renames which swap files, the exported file is first renamed
|
||||||
-- to a stable temporary name based on the key.
|
-- to a stable temporary name based on the key.
|
||||||
|
@ -75,6 +82,10 @@ seek' o r = do
|
||||||
db <- openDb (uuid r)
|
db <- openDb (uuid r)
|
||||||
ea <- exportActions r
|
ea <- exportActions r
|
||||||
recordExportBeginning (uuid r) new
|
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
|
-- Clean up after incomplete export of a tree, in which
|
||||||
-- the next block of code below may have renamed some files to
|
-- the next block of code below may have renamed some files to
|
||||||
|
|
|
@ -18,6 +18,7 @@ import Config.Cost
|
||||||
import Config.DynamicConfig
|
import Config.DynamicConfig
|
||||||
import Types.Availability
|
import Types.Availability
|
||||||
import Git.Types
|
import Git.Types
|
||||||
|
import qualified Types.Remote as Remote
|
||||||
|
|
||||||
type UnqualifiedConfigKey = String
|
type UnqualifiedConfigKey = String
|
||||||
data ConfigKey = ConfigKey String
|
data ConfigKey = ConfigKey String
|
||||||
|
@ -55,6 +56,9 @@ instance RemoteNameable Git.Repo where
|
||||||
instance RemoteNameable RemoteName where
|
instance RemoteNameable RemoteName where
|
||||||
getRemoteName = id
|
getRemoteName = id
|
||||||
|
|
||||||
|
instance RemoteNameable Remote where
|
||||||
|
getRemoteName = Remote.name
|
||||||
|
|
||||||
{- A per-remote config setting in git config. -}
|
{- A per-remote config setting in git config. -}
|
||||||
remoteConfig :: RemoteNameable r => r -> UnqualifiedConfigKey -> ConfigKey
|
remoteConfig :: RemoteNameable r => r -> UnqualifiedConfigKey -> ConfigKey
|
||||||
remoteConfig r key = ConfigKey $
|
remoteConfig r key = ConfigKey $
|
||||||
|
|
|
@ -199,6 +199,7 @@ data RemoteGitConfig = RemoteGitConfig
|
||||||
, remoteAnnexPush :: Bool
|
, remoteAnnexPush :: Bool
|
||||||
, remoteAnnexReadOnly :: Bool
|
, remoteAnnexReadOnly :: Bool
|
||||||
, remoteAnnexVerify :: Bool
|
, remoteAnnexVerify :: Bool
|
||||||
|
, remoteAnnexExportTracking :: Maybe Git.Ref
|
||||||
, remoteAnnexTrustLevel :: Maybe String
|
, remoteAnnexTrustLevel :: Maybe String
|
||||||
, remoteAnnexStartCommand :: Maybe String
|
, remoteAnnexStartCommand :: Maybe String
|
||||||
, remoteAnnexStopCommand :: Maybe String
|
, remoteAnnexStopCommand :: Maybe String
|
||||||
|
@ -247,6 +248,8 @@ extractRemoteGitConfig r remotename = do
|
||||||
, remoteAnnexPush = getbool "push" True
|
, remoteAnnexPush = getbool "push" True
|
||||||
, remoteAnnexReadOnly = getbool "readonly" False
|
, remoteAnnexReadOnly = getbool "readonly" False
|
||||||
, remoteAnnexVerify = getbool "verify" True
|
, remoteAnnexVerify = getbool "verify" True
|
||||||
|
, remoteAnnexExportTracking = Git.Ref
|
||||||
|
<$> notempty (getmaybe "export-tracking")
|
||||||
, remoteAnnexTrustLevel = notempty $ getmaybe "trustlevel"
|
, remoteAnnexTrustLevel = notempty $ getmaybe "trustlevel"
|
||||||
, remoteAnnexStartCommand = notempty $ getmaybe "start-command"
|
, remoteAnnexStartCommand = notempty $ getmaybe "start-command"
|
||||||
, remoteAnnexStopCommand = notempty $ getmaybe "stop-command"
|
, remoteAnnexStopCommand = notempty $ getmaybe "stop-command"
|
||||||
|
|
|
@ -6,6 +6,8 @@ git-annex export - export content to a remote
|
||||||
|
|
||||||
git annex export `treeish --to remote`
|
git annex export `treeish --to remote`
|
||||||
|
|
||||||
|
git annex export `--tracking treeish --to remote`
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
Use this command to export a tree of files from a git-annex repository.
|
Use this command to export a tree of files from a git-annex repository.
|
||||||
|
@ -36,6 +38,18 @@ verification of content downloaded from an export. Some types of keys,
|
||||||
that are not based on checksums, cannot be downloaded from an export.
|
that are not based on checksums, cannot be downloaded from an export.
|
||||||
And, git-annex will never trust an export to retain the content of a key.
|
And, git-annex will never trust an export to retain the content of a key.
|
||||||
|
|
||||||
|
# OPTIONS
|
||||||
|
|
||||||
|
* `--to=remote`
|
||||||
|
|
||||||
|
Specify the special remote to export to.
|
||||||
|
|
||||||
|
* `--tracking`
|
||||||
|
|
||||||
|
This makes the export track changes that are committed to
|
||||||
|
the branch. `git annex sync --content` and the git-annex assistant
|
||||||
|
will update exports when it commits to the branch they are tracking.
|
||||||
|
|
||||||
# EXAMPLE
|
# EXAMPLE
|
||||||
|
|
||||||
git annex initremote myexport type=directory directory=/mnt/myexport \
|
git annex initremote myexport type=directory directory=/mnt/myexport \
|
||||||
|
@ -56,6 +70,10 @@ That updates /mnt/myexport to reflect the renamed file.
|
||||||
That updates /mnt/myexport, to contain only the files in the "subdir"
|
That updates /mnt/myexport, to contain only the files in the "subdir"
|
||||||
directory of the master branch.
|
directory of the master branch.
|
||||||
|
|
||||||
|
git annex export --tracking master --to myexport
|
||||||
|
|
||||||
|
That makes myexport track changes that are committed to the master branch.
|
||||||
|
|
||||||
# EXPORT CONFLICTS
|
# EXPORT CONFLICTS
|
||||||
|
|
||||||
If two different git-annex repositories are both exporting different trees
|
If two different git-annex repositories are both exporting different trees
|
||||||
|
@ -81,6 +99,8 @@ export`, it will detect the export conflict, and resolve it.
|
||||||
|
|
||||||
[[git-annex-initremote]](1)
|
[[git-annex-initremote]](1)
|
||||||
|
|
||||||
|
[[git-annex-sync]](1)
|
||||||
|
|
||||||
# AUTHOR
|
# AUTHOR
|
||||||
|
|
||||||
Joey Hess <id@joeyh.name>
|
Joey Hess <id@joeyh.name>
|
||||||
|
|
|
@ -82,6 +82,10 @@ by running "git annex sync" on the remote.
|
||||||
This behavior can be overridden by configuring the preferred content
|
This behavior can be overridden by configuring the preferred content
|
||||||
of a repository. See [[git-annex-preferred-content]](1).
|
of a repository. See [[git-annex-preferred-content]](1).
|
||||||
|
|
||||||
|
When a special remote is configured as an export and is tracking a branch,
|
||||||
|
the export will be updated to the current content of the branch.
|
||||||
|
See [[git-annex-export]](1).
|
||||||
|
|
||||||
* `--content-of=path` `-C path`
|
* `--content-of=path` `-C path`
|
||||||
|
|
||||||
While --content operates on all annexed files in the work tree,
|
While --content operates on all annexed files in the work tree,
|
||||||
|
|
|
@ -1210,6 +1210,14 @@ Here are all the supported configuration settings.
|
||||||
from remotes. If you trust a remote and don't want the overhead
|
from remotes. If you trust a remote and don't want the overhead
|
||||||
of these checksums, you can set this to `false`.
|
of these checksums, you can set this to `false`.
|
||||||
|
|
||||||
|
* `remote.<name>.annex-export-tracking`
|
||||||
|
|
||||||
|
When set to a branch name or other treeish, this makes what's exported
|
||||||
|
to the special remote track changes to the branch. See
|
||||||
|
[[git-annex-export]](1). `git-annex sync --content` and the
|
||||||
|
git-annex assistant update exports when changes have been
|
||||||
|
committed to the tracking branch.
|
||||||
|
|
||||||
* `remote.<name>.annexUrl`
|
* `remote.<name>.annexUrl`
|
||||||
|
|
||||||
Can be used to specify a different url than the regular `remote.<name>.url`
|
Can be used to specify a different url than the regular `remote.<name>.url`
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue