New submission from Ben Franksen <[email protected]>:

1 patch for repository https://darcs.net/screened:

patch 95bd9bd8c6b400d9752621031793b3967ddb7722
Author: Ben Franksen <[email protected]>
Date:   Thu Sep 16 08:48:26 CEST 2021
  * refactor getOnePatchset -> matchOnePatchset

  Darcs.Repository.Match.getOnePatchSet only needed the Repository argument to
  call readPatches. However, in all use cases we have already done that, so we
  can as well pass the PatchSet directly. The new function matchOnePatchSet
  was then moved to Darcs.Patch.Match as it no longer depends on the
  Repository layer.

----------
files: patch-preview.txt, refactor-getonepatchset-__-matchonepatchset.dpatch
messages: 24151
nosy: bfrk
status: needs-screening
title: refactor getOnePatchset -> matchOnePatchset

__________________________________
Darcs bug tracker <[email protected]>
<https://bugs.darcs.net/patch2444>
__________________________________
[refactor getOnePatchset -> matchOnePatchset
Ben Franksen <[email protected]>**20210916064826
 Ignore-this: fdfd1c83a97bdf09bc6cd59bf9dad24bf918520d2192a1e977a6bcbefbde465e4fd8eb44e78577d7
 
 Darcs.Repository.Match.getOnePatchSet only needed the Repository argument to
 call readPatches. However, in all use cases we have already done that, so we
 can as well pass the PatchSet directly. The new function matchOnePatchSet
 was then moved to Darcs.Patch.Match as it no longer depends on the
 Repository layer.
] hunk ./src/Darcs/Patch/Match.hs 56
-    , PatchSetMatch(..)
+    , PatchSetMatch
hunk ./src/Darcs/Patch/Match.hs 62
+    , matchOnePatchset
hunk ./src/Darcs/Patch/Match.hs 103
-import Darcs.Util.Path ( AbsolutePath )
+import Darcs.Util.Path ( AbsolutePath, toFilePath )
hunk ./src/Darcs/Patch/Match.hs 105
+import Darcs.Patch.Bundle ( readContextFile )
hunk ./src/Darcs/Patch/Match.hs 650
+-- | Return the patches in a 'PatchSet' up to the given 'PatchSetMatch'.
+matchOnePatchset
+  :: MatchableRP p
+  => PatchSet p Origin wR
+  -> PatchSetMatch
+  -> IO (SealedPatchSet p Origin)
+matchOnePatchset ps (IndexMatch   n   ) = return $ patchSetDrop (n - 1) ps
+matchOnePatchset ps (PatchMatch   m   ) = return $ matchAPatchset m ps
+matchOnePatchset ps (TagMatch     m   ) = return $ getMatchingTag m ps
+matchOnePatchset ps (ContextMatch path) = readContextFile ps (toFilePath path)
+
hunk ./src/Darcs/Repository/Clone.hs 69
-import Darcs.Repository.Match ( getOnePatchset )
hunk ./src/Darcs/Repository/Clone.hs 122
-import Darcs.Patch.Match ( MatchFlag(..), patchSetMatch )
+import Darcs.Patch.Match ( MatchFlag(..), patchSetMatch, matchOnePatchset )
hunk ./src/Darcs/Repository/Clone.hs 230
-        Sealed context <- getOnePatchset _toRepo psm
+        Sealed context <- matchOnePatchset patches psm
hunk ./src/Darcs/Repository/Match.hs 19
-    (
-      getPristineUpToMatch
-    , getOnePatchset
+    ( getPristineUpToMatch
hunk ./src/Darcs/Repository/Match.hs 24
-import Darcs.Patch.Match
-    ( rollbackToPatchSetMatch
-    , PatchSetMatch(..)
-    , getMatchingTag
-    , matchAPatchset
-    )
-
-import Darcs.Patch.Bundle ( readContextFile )
-import Darcs.Patch.Apply( ApplyState )
hunk ./src/Darcs/Repository/Match.hs 25
-import Darcs.Patch.Set ( Origin, SealedPatchSet, patchSetDrop )
-
+import Darcs.Patch.Apply ( ApplyState )
+import Darcs.Patch.Match ( PatchSetMatch, rollbackToPatchSetMatch )
+
+import Darcs.Repository.Hashed ( readPatches )
hunk ./src/Darcs/Repository/Match.hs 30
-import Darcs.Repository.Hashed ( readPatches )
hunk ./src/Darcs/Repository/Match.hs 35
-import Darcs.Util.Path ( toFilePath )
-
hunk ./src/Darcs/Repository/Match.hs 47
-
--- | Return the patches up to the given 'PatchSetMatch'.
-getOnePatchset :: RepoPatch p
-               => Repository rt p wU wR
-               -> PatchSetMatch
-               -> IO (SealedPatchSet p Origin)
-getOnePatchset repository pm =
-  case pm of
-    IndexMatch n -> patchSetDrop (n-1) <$> readPatches repository
-    PatchMatch m -> matchAPatchset m <$> readPatches repository
-    TagMatch m -> getMatchingTag m <$> readPatches repository
-    ContextMatch path -> do
-      ref <- readPatches repository
-      readContextFile ref (toFilePath path)
hunk ./src/Darcs/UI/Commands/Annotate.hs 45
-import Darcs.Repository.Match ( getOnePatchset )
+import Darcs.Patch.Match ( matchOnePatchset )
hunk ./src/Darcs/UI/Commands/Annotate.hs 107
-        Sealed x <- getOnePatchset repository psm
+        Sealed x <- matchOnePatchset r psm

Attachment: refactor-getonepatchset-__-matchonepatchset.dpatch
Description: application/darcs-patch

_______________________________________________
darcs-devel mailing list
[email protected]
https://lists.darcs.net/mailman/listinfo/darcs-devel

Reply via email to