improve messages around export/import conflicts

A conflict can be caused by either export or import when the remote
supports both.
This commit is contained in:
Joey Hess 2019-04-09 13:03:59 -04:00
parent b51eceb326
commit 37041b629d
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 11 additions and 7 deletions

View file

@ -42,8 +42,12 @@ exportKey sha = mk <$> catKey sha
, keyChunkNum = Nothing , keyChunkNum = Nothing
} }
warnExportConflict :: Remote -> Annex () warnExportImportConflict :: Remote -> Annex ()
warnExportConflict r = toplevelWarning True $ warnExportImportConflict r = do
"Export conflict detected. Different trees have been exported to " ++ ops <- Remote.isImportSupported r >>= return . \case
Remote.name r ++ True -> "exported to and/or imported from"
". Use git-annex export to resolve this conflict." False -> "exported to"
toplevelWarning True $
"Conflict detected. Different trees have been " ++ ops ++
Remote.name r ++
". Use git-annex export to resolve this conflict."

View file

@ -156,7 +156,7 @@ changeExport r db new = do
startMoveFromTempName r db ek newf startMoveFromTempName r db ek newf
_ -> stop _ -> stop
ts -> do ts -> do
warning "Export conflict detected. Different trees have been exported to the same special remote. Resolving.." warning "Resolving export conflict.."
forM_ ts $ \oldtreesha -> do forM_ ts $ \oldtreesha -> do
-- Unexport both the srcsha and the dstsha, -- Unexport both the srcsha and the dstsha,
-- because the wrong content may have -- because the wrong content may have

View file

@ -755,7 +755,7 @@ seekExportContent o rs (currbranch, _) = or <$> forM rs go
fillexport _ _ [] _ = return False fillexport _ _ [] _ = return False
fillexport r db (t:[]) mtbcommitsha = Command.Export.fillExport r db t mtbcommitsha fillexport r db (t:[]) mtbcommitsha = Command.Export.fillExport r db t mtbcommitsha
fillexport r _ _ _ = do fillexport r _ _ _ = do
warnExportConflict r warnExportImportConflict r
return False return False
cleanupLocal :: CurrBranch -> CommandStart cleanupLocal :: CurrBranch -> CommandStart