From ea7dc8c893299331684ac0f68b78e96ad037baef Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 18 Dec 2012 17:15:16 -0400 Subject: partial and incomplete automatic merging in direct mode Handles our file right, but not theirs. --- Command/Direct.hs | 2 +- Command/Sync.hs | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'Command') diff --git a/Command/Direct.hs b/Command/Direct.hs index 991930c38..8e7f40145 100644 --- a/Command/Direct.hs +++ b/Command/Direct.hs @@ -41,7 +41,7 @@ perform = do next cleanup where go = whenAnnexed $ \f (k, _) -> do - r <- toDirect k f + r <- toDirectGen k f case r of Nothing -> noop Just a -> do diff --git a/Command/Sync.hs b/Command/Sync.hs index 2d1b2fb9c..d6736a616 100644 --- a/Command/Sync.hs +++ b/Command/Sync.hs @@ -15,6 +15,7 @@ import qualified Annex import qualified Annex.Branch import qualified Annex.Queue import Annex.Content +import Annex.Content.Direct import Annex.Direct import Annex.CatFile import qualified Git.Command @@ -234,7 +235,8 @@ resolveMerge' :: LsFiles.Unmerged -> Annex Bool resolveMerge' u | issymlink LsFiles.valUs && issymlink LsFiles.valThem = withKey LsFiles.valUs $ \keyUs -> - withKey LsFiles.valThem $ \keyThem -> go keyUs keyThem + withKey LsFiles.valThem $ \keyThem -> do + go keyUs keyThem | otherwise = return False where go keyUs keyThem @@ -242,7 +244,10 @@ resolveMerge' u makelink keyUs return True | otherwise = do - liftIO $ nukeFile file + ifM isDirect + ( maybe noop (\k -> removeDirect k file) keyUs + , liftIO $ nukeFile file + ) Annex.Queue.addCommand "rm" [Params "--quiet -f --"] [file] makelink keyUs makelink keyThem @@ -257,6 +262,8 @@ resolveMerge' u nukeFile dest createSymbolicLink l dest Annex.Queue.addCommand "add" [Param "--force", Param "--"] [dest] + whenM (isDirect) $ + toDirect key dest makelink _ = noop withKey select a = do let msha = select $ LsFiles.unmergedSha u -- cgit v1.2.3