Skip to content

Commit

Permalink
screened 2024-06-29 10:15:19+00:00
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Franksen authored and Ben Franksen committed Jun 29, 2024
1 parent 22e80c5 commit aadc35c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
4 changes: 1 addition & 3 deletions src/Darcs/Repository/Clone.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import Darcs.Repository.Identify ( identifyRepositoryFor, ReadingOrWriting(..) )
import Darcs.Repository.Pristine
( applyToTentativePristine
, createPristineDirectoryTree
, writePristine
)
import Darcs.Repository.Hashed
( copyHashedInventory
Expand Down Expand Up @@ -136,7 +135,7 @@ import Darcs.Patch.Witnesses.Ordered
)
import Darcs.Patch.PatchInfoAnd ( PatchInfoAnd, extractHash )

import Darcs.Util.Tree( Tree, emptyTree )
import Darcs.Util.Tree( Tree )

import Darcs.Util.Exception ( catchall )
import Darcs.Util.English ( englishNum, Noun(..) )
Expand Down Expand Up @@ -389,7 +388,6 @@ copyRepoOldFashioned :: forall p wU wR. (RepoPatch p, ApplyState p ~ Tree)
-> IO ()
copyRepoOldFashioned fromRepo _toRepo verb withWorkingDir = do
_toRepo <- revertRepositoryChanges _toRepo
_ <- writePristine _toRepo emptyTree
patches <- readPatches fromRepo
let k = "Copying patch"
beginTedious k
Expand Down
4 changes: 1 addition & 3 deletions src/Darcs/UI/Commands/Diff.hs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ import Darcs.Util.Lock ( withTempDir )
import Darcs.Util.Path ( AbsolutePath, AnchoredPath, isPrefix, toFilePath )
import Darcs.Util.Printer ( Doc, putDocLn, text, vcat )
import Darcs.Util.Prompt ( askEnter )
import Darcs.Util.Tree.Hashed ( hashedTreeIO, writeDarcsHashed )
import Darcs.Util.Tree.Hashed ( hashedTreeIO )
import Darcs.Util.Tree.Plain ( writePlainTree )
import Darcs.Util.Workaround ( getCurrentDirectory )

Expand Down Expand Up @@ -199,8 +199,6 @@ doDiff opts mpaths = withRepository (useCache ? opts) $ RepoJob $ \repository ->
-- during the 'apply' and 'unapply' operations below.
let cache = mkDirCache tdir
pristine <- readPristine repository
-- fill our temporary cache
_ <- writeDarcsHashed pristine cache

-- @base@ will be like our working tree, /except/ that it contains only
-- the unrecorded changes that affect the given file paths, see comment
Expand Down
13 changes: 6 additions & 7 deletions src/Darcs/Util/Tree/Hashed.hs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import Darcs.Util.Hash
)
import Darcs.Util.Parser
import Darcs.Util.Path ( Name, decodeWhiteName, encodeWhiteName )
import Darcs.Util.Progress ( debugMessage, finishedOneIO, withSizedProgress )
import Darcs.Util.Progress ( debugMessage )
import Darcs.Util.Tree
( Blob(..)
, ItemType(..)
Expand Down Expand Up @@ -197,14 +197,13 @@ writeDarcsHashed tree' cache = do
debugMessage "writeDarcsHashed"
t <- darcsUpdateDirHashes <$> expand tree'
let items = list t
withSizedProgress "Getting pristine" (length items) $ \k -> do
sequence_ [readAndWriteBlob k b | (_, File b) <- items]
let dirs = darcsFormatDir t : [darcsFormatDir d | (_, SubTree d) <- items]
mapM_ (dump k) dirs
sequence_ [readAndWriteBlob b | (_, File b) <- items]
let dirs = darcsFormatDir t : [darcsFormatDir d | (_, SubTree d) <- items]
mapM_ dump dirs
return (fromHash (darcsTreeHash t))
where
readAndWriteBlob k b = readBlob b >>= dump k
dump k x = fsCreateHashedFile cache x >>= finishedOneIO k . encodeValidHash
readAndWriteBlob b = readBlob b >>= dump
dump x = fsCreateHashedFile cache x

-- | Create a hashed file from a 'Cache' and file content. In case the file
-- exists it is kept untouched and is assumed to have the right content.
Expand Down

0 comments on commit aadc35c

Please sign in to comment.