mirror of https://github.com/voidlizard/hbs2
wip, merge driver
This commit is contained in:
parent
91f6577a6e
commit
5a3900ad34
BIN
.fixme-new/log
BIN
.fixme-new/log
Binary file not shown.
|
@ -0,0 +1 @@
|
||||||
|
.fixme-new/log merge=fixme-log-merge
|
|
@ -84,10 +84,10 @@ common shared-properties
|
||||||
, streaming
|
, streaming
|
||||||
, stm
|
, stm
|
||||||
, text
|
, text
|
||||||
|
, temporary
|
||||||
, time
|
, time
|
||||||
, timeit
|
, timeit
|
||||||
, transformers
|
, transformers
|
||||||
|
|
||||||
, typed-process
|
, typed-process
|
||||||
, unordered-containers
|
, unordered-containers
|
||||||
, unliftio
|
, unliftio
|
||||||
|
|
|
@ -39,6 +39,8 @@ import Lens.Micro.Platform
|
||||||
import System.Process.Typed
|
import System.Process.Typed
|
||||||
import Control.Monad.Trans.Cont
|
import Control.Monad.Trans.Cont
|
||||||
import Control.Monad.Trans.Maybe
|
import Control.Monad.Trans.Maybe
|
||||||
|
import System.IO.Temp as Temp
|
||||||
|
|
||||||
|
|
||||||
import Streaming.Prelude qualified as S
|
import Streaming.Prelude qualified as S
|
||||||
|
|
||||||
|
@ -558,6 +560,26 @@ run what = do
|
||||||
|
|
||||||
compactStorageClose sto
|
compactStorageClose sto
|
||||||
|
|
||||||
|
ListVal [SymbolVal "git:merge",StringLike o, StringLike target, StringLike b] -> do
|
||||||
|
debug $ red "git:merge" <+> pretty o <+> pretty target <+> pretty b
|
||||||
|
|
||||||
|
temp <- liftIO $ emptyTempFile "." "merge-result"
|
||||||
|
sa <- compactStorageOpen @HbSync readonly o
|
||||||
|
sb <- compactStorageOpen @HbSync readonly b
|
||||||
|
r <- compactStorageOpen @HbSync mempty temp
|
||||||
|
|
||||||
|
for_ [sa,sb] $ \sto -> do
|
||||||
|
ks <- keys sto
|
||||||
|
for_ ks $ \k -> runMaybeT do
|
||||||
|
v <- get sto k & MaybeT
|
||||||
|
put r k v
|
||||||
|
|
||||||
|
compactStorageClose r
|
||||||
|
compactStorageClose sa
|
||||||
|
compactStorageClose sb
|
||||||
|
|
||||||
|
mv temp target
|
||||||
|
|
||||||
ListVal [SymbolVal "no-debug"] -> do
|
ListVal [SymbolVal "no-debug"] -> do
|
||||||
setLoggingOff @DEBUG
|
setLoggingOff @DEBUG
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,6 @@ scanBlob fpath lbs = do
|
||||||
next (S (Sf (succEln env bs)) xs)
|
next (S (Sf (succEln env bs)) xs)
|
||||||
|
|
||||||
S _ [] -> pure ()
|
S _ [] -> pure ()
|
||||||
|
|
||||||
-- debug $ vcat (fmap viaShow parts)
|
-- debug $ vcat (fmap viaShow parts)
|
||||||
|
|
||||||
S.toList_ do
|
S.toList_ do
|
||||||
|
|
|
@ -69,6 +69,12 @@ expandPath = liftIO . D.canonicalizePath
|
||||||
doesDirectoryExist :: MonadIO m => FilePath -> m Bool
|
doesDirectoryExist :: MonadIO m => FilePath -> m Bool
|
||||||
doesDirectoryExist = liftIO . D.doesDirectoryExist
|
doesDirectoryExist = liftIO . D.doesDirectoryExist
|
||||||
|
|
||||||
|
fileSize :: MonadIO m => FilePath -> m Integer
|
||||||
|
fileSize = liftIO . D.getFileSize
|
||||||
|
|
||||||
|
mv :: MonadIO m => FilePath -> FilePath -> m ()
|
||||||
|
mv a b = liftIO $ D.renamePath a b
|
||||||
|
|
||||||
home :: MonadIO m => m FilePath
|
home :: MonadIO m => m FilePath
|
||||||
home = liftIO D.getHomeDirectory
|
home = liftIO D.getHomeDirectory
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue