diff --git a/.fixme-new/log b/.fixme-new/log index 05f1b080..d48b3191 100644 Binary files a/.fixme-new/log and b/.fixme-new/log differ diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..0b4845a9 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +.fixme-new/log merge=fixme-log-merge diff --git a/fixme-new/fixme.cabal b/fixme-new/fixme.cabal index 53d1a3a9..534da05e 100644 --- a/fixme-new/fixme.cabal +++ b/fixme-new/fixme.cabal @@ -84,10 +84,10 @@ common shared-properties , streaming , stm , text + , temporary , time , timeit , transformers - , typed-process , unordered-containers , unliftio diff --git a/fixme-new/lib/Fixme/Run.hs b/fixme-new/lib/Fixme/Run.hs index 5aa1bcb5..33902703 100644 --- a/fixme-new/lib/Fixme/Run.hs +++ b/fixme-new/lib/Fixme/Run.hs @@ -39,6 +39,8 @@ import Lens.Micro.Platform import System.Process.Typed import Control.Monad.Trans.Cont import Control.Monad.Trans.Maybe +import System.IO.Temp as Temp + import Streaming.Prelude qualified as S @@ -558,6 +560,26 @@ run what = do 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 setLoggingOff @DEBUG diff --git a/fixme-new/lib/Fixme/Scan.hs b/fixme-new/lib/Fixme/Scan.hs index 03a65412..7c021044 100644 --- a/fixme-new/lib/Fixme/Scan.hs +++ b/fixme-new/lib/Fixme/Scan.hs @@ -117,7 +117,6 @@ scanBlob fpath lbs = do next (S (Sf (succEln env bs)) xs) S _ [] -> pure () - -- debug $ vcat (fmap viaShow parts) S.toList_ do diff --git a/hbs2-core/lib/HBS2/System/Dir.hs b/hbs2-core/lib/HBS2/System/Dir.hs index ca7a83c0..643490bb 100644 --- a/hbs2-core/lib/HBS2/System/Dir.hs +++ b/hbs2-core/lib/HBS2/System/Dir.hs @@ -69,6 +69,12 @@ expandPath = liftIO . D.canonicalizePath doesDirectoryExist :: MonadIO m => FilePath -> m Bool 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 = liftIO D.getHomeDirectory