update export db after rename from annexobjects location
This allows git-annex post-receive, on the first push to the remote to see that it is able to get a key from it in order to upload it back. Also avoided actively checking if the source remote contains a key. The location log is good enough. If the location log is wrong, the export of that file will fail with an informative message.
This commit is contained in:
parent
a2eb3b450a
commit
c84d1a9462
1 changed files with 12 additions and 8 deletions
|
@ -43,6 +43,7 @@ import Utility.Matcher
|
||||||
import qualified Data.ByteString.Char8 as S8
|
import qualified Data.ByteString.Char8 as S8
|
||||||
import qualified Data.ByteString.Lazy as L
|
import qualified Data.ByteString.Lazy as L
|
||||||
import qualified Data.Map as M
|
import qualified Data.Map as M
|
||||||
|
import qualified Data.Set as S
|
||||||
import Control.Concurrent
|
import Control.Concurrent
|
||||||
|
|
||||||
cmd :: Command
|
cmd :: Command
|
||||||
|
@ -325,11 +326,13 @@ performExport r srcrs db ek af contentsha loc allfilledvar = do
|
||||||
|
|
||||||
sendannexobject = ifM (inAnnex ek)
|
sendannexobject = ifM (inAnnex ek)
|
||||||
( sendlocalannexobject
|
( sendlocalannexobject
|
||||||
, firstM remotehaskey srcrs >>= \case
|
, do
|
||||||
Nothing -> do
|
locs <- S.fromList <$> loggedLocations ek
|
||||||
showNote "not available"
|
case filter (\sr -> S.member (Remote.uuid sr) locs) srcrs of
|
||||||
return False
|
[] -> do
|
||||||
Just srcr -> getsendannexobject srcr
|
showNote "not available"
|
||||||
|
return False
|
||||||
|
(srcr:_) -> getsendannexobject srcr
|
||||||
)
|
)
|
||||||
|
|
||||||
sendlocalannexobject = sendwith $ \p -> do
|
sendlocalannexobject = sendwith $ \p -> do
|
||||||
|
@ -347,8 +350,6 @@ performExport r srcrs db ek af contentsha loc allfilledvar = do
|
||||||
-- of the content should still be allowed.
|
-- of the content should still be allowed.
|
||||||
alwaysUpload (uuid r) ek af Nothing stdRetry a
|
alwaysUpload (uuid r) ek af Nothing stdRetry a
|
||||||
|
|
||||||
remotehaskey srcr = either (const False) id <$> Remote.hasKey srcr ek
|
|
||||||
|
|
||||||
-- Similar to Command.Move.fromToPerform, use a regular download
|
-- Similar to Command.Move.fromToPerform, use a regular download
|
||||||
-- of a local copy, lock early, and drop the local copy after sending.
|
-- of a local copy, lock early, and drop the local copy after sending.
|
||||||
getsendannexobject srcr = do
|
getsendannexobject srcr = do
|
||||||
|
@ -370,7 +371,10 @@ performExport r srcrs db ek af contentsha loc allfilledvar = do
|
||||||
let objloc = exportAnnexObjectLocation gc ek
|
let objloc = exportAnnexObjectLocation gc ek
|
||||||
if Remote.uuid r `elem` locs
|
if Remote.uuid r `elem` locs
|
||||||
then tryNonAsync (renameaction ek objloc loc) >>= \case
|
then tryNonAsync (renameaction ek objloc loc) >>= \case
|
||||||
Right (Just ()) -> return True
|
Right (Just ()) -> do
|
||||||
|
liftIO $ addExportedLocation db ek loc
|
||||||
|
liftIO $ flushDbQueue db
|
||||||
|
return True
|
||||||
Left _err -> fallback
|
Left _err -> fallback
|
||||||
Right Nothing -> fallback
|
Right Nothing -> fallback
|
||||||
else fallback
|
else fallback
|
||||||
|
|
Loading…
Reference in a new issue