improve messages around export conflicts
When an export conflict prevents accessing a special remote, be clearer about what the problem is and how to resolve it. This commit was sponsored by Trenton Cronholm on Patreon.
This commit is contained in:
parent
6a0618f7b3
commit
d65df7ab21
6 changed files with 64 additions and 24 deletions
|
@ -32,6 +32,7 @@ module Database.Export (
|
|||
ExportedDirectoryId,
|
||||
ExportTreeId,
|
||||
ExportTreeCurrentId,
|
||||
ExportUpdateResult(..),
|
||||
) where
|
||||
|
||||
import Database.Types
|
||||
|
@ -218,16 +219,21 @@ updateExportTree' h srcek dstek i = do
|
|||
Just k -> liftIO $ addExportTree h (asKey k) loc
|
||||
where
|
||||
loc = mkExportLocation $ getTopFilePath $ Git.DiffTree.file i
|
||||
|
||||
updateExportTreeFromLog :: ExportHandle -> Annex ()
|
||||
|
||||
data ExportUpdateResult = ExportUpdateSuccess | ExportUpdateConflict
|
||||
deriving (Eq)
|
||||
|
||||
updateExportTreeFromLog :: ExportHandle -> Annex ExportUpdateResult
|
||||
updateExportTreeFromLog db@(ExportHandle _ u) =
|
||||
withExclusiveLock (gitAnnexExportLock u) $ do
|
||||
old <- liftIO $ fromMaybe emptyTree
|
||||
<$> getExportTreeCurrent db
|
||||
l <- Log.getExport u
|
||||
case map Log.exportedTreeish l of
|
||||
[] -> return ExportUpdateSuccess
|
||||
(new:[]) | new /= old -> do
|
||||
updateExportTree db old new
|
||||
liftIO $ recordExportTreeCurrent db new
|
||||
liftIO $ flushDbQueue db
|
||||
_ -> return ()
|
||||
return ExportUpdateSuccess
|
||||
_ts -> return ExportUpdateConflict
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue