From 8bb17eaafb3a5413164f96cb432cf5d5efb88645 Mon Sep 17 00:00:00 2001 From: voidlizard Date: Mon, 20 Jan 2025 09:37:45 +0300 Subject: [PATCH] wip --- hbs2-git3/lib/HBS2/Git3/Repo.hs | 8 +++++--- hbs2-git3/lib/HBS2/Git3/Run.hs | 21 ++++++++++++++++----- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/hbs2-git3/lib/HBS2/Git3/Repo.hs b/hbs2-git3/lib/HBS2/Git3/Repo.hs index d14955c0..e20716e5 100644 --- a/hbs2-git3/lib/HBS2/Git3/Repo.hs +++ b/hbs2-git3/lib/HBS2/Git3/Repo.hs @@ -129,12 +129,14 @@ initRepo syn = do , mkForm "seed" [mkInt seed] , mkForm "public" [] , mkForm "reflog" [mkSym (show $ pretty (AsBase58 rpk))] - ] & vcat . fmap pretty + ] - tree <- createTreeWithMetadata sto Nothing mempty (LBS8.pack (show $ manifest)) + let mfs = vcat $ fmap pretty manifest + + tree <- createTreeWithMetadata sto Nothing mempty (LBS8.pack (show $ mfs)) >>= orThrowPassIO - liftIO $ print tree + liftIO $ print $ pretty $ mkForm "manifest" manifest let pt = toPTree (MaxSize defHashListChunk) (MaxNum defTreeChildNum) [tree] diff --git a/hbs2-git3/lib/HBS2/Git3/Run.hs b/hbs2-git3/lib/HBS2/Git3/Run.hs index 19da8c6e..a6f1c3cc 100644 --- a/hbs2-git3/lib/HBS2/Git3/Run.hs +++ b/hbs2-git3/lib/HBS2/Git3/Run.hs @@ -68,11 +68,21 @@ theDict = do [ StringLike x ] -> helpList False (Just x) >> quit _ -> helpList False Nothing >> quit - entry $ bindMatch "compression" $ nil_ $ \case - [ LitIntVal n ] -> lift do - setCompressionLevel (fromIntegral n) + brief "set zstd compression level" do + examples [qc| +compression best ; sets compression level to best (22) +compression 4 ; sets low compression level (faster) +compression ; prints compression level + |] do + entry $ bindMatch "compression" $ nil_ $ \case + [ LitIntVal n ] -> lift do + setCompressionLevel (fromIntegral n) - _ -> throwIO (BadFormException @C nil) + [] -> lift do + co <- getCompressionLevel + liftIO $ print $ pretty co + + _ -> throwIO (BadFormException @C nil) entry $ bindMatch "segment" $ nil_ $ \case [ LitIntVal n ] -> lift do @@ -462,7 +472,8 @@ theDict = do entry $ bindMatch "reflog:refs" $ nil_ $ \syn -> lift $ connectedDo do rrefs <- importedRefs - liftIO $ print $ pretty rrefs + for_ rrefs $ \(r,h) -> do + liftIO $ print $ fill 20 (pretty h) <+> pretty r entry $ bindMatch "reflog:imported" $ nil_ $ \syn -> lift $ connectedDo do p <- importedCheckpoint