convert TopFilePath to use RawFilePath
Adds a dependency on filepath-bytestring, an as yet unreleased fork of filepath that operates on RawFilePath. Git.Repo also changed to use RawFilePath for the path to the repo. This does eliminate some RawFilePath -> FilePath -> RawFilePath conversions. And filepath-bytestring's </> is probably faster. But I don't expect a major performance improvement from this. This is mostly groundwork for making Annex.Location use RawFilePath, which will allow for a conversion-free pipleline.
This commit is contained in:
parent
a7004375ec
commit
bdec7fed9c
97 changed files with 323 additions and 271 deletions
|
@ -145,7 +145,7 @@ updateFromLog db (oldtree, currtree) = do
|
|||
recordAnnexBranchTree db currtree
|
||||
flushDbQueue db
|
||||
where
|
||||
go ti = case extLogFileKey remoteContentIdentifierExt (toRawFilePath (getTopFilePath (DiffTree.file ti))) of
|
||||
go ti = case extLogFileKey remoteContentIdentifierExt (getTopFilePath (DiffTree.file ti)) of
|
||||
Nothing -> return ()
|
||||
Just k -> do
|
||||
l <- Log.getContentIdentifiers k
|
||||
|
|
|
@ -220,7 +220,7 @@ mkExportDiffUpdater removeold addnew h srcek dstek i = do
|
|||
Nothing -> return ()
|
||||
Just k -> liftIO $ addnew h (asKey k) loc
|
||||
where
|
||||
loc = mkExportLocation $ toRawFilePath $ getTopFilePath $ Git.DiffTree.file i
|
||||
loc = mkExportLocation $ getTopFilePath $ Git.DiffTree.file i
|
||||
|
||||
runExportDiffUpdater :: ExportDiffUpdater -> ExportHandle -> Sha -> Sha -> Annex ()
|
||||
runExportDiffUpdater updater h old new = do
|
||||
|
|
|
@ -279,7 +279,7 @@ reconcileStaged qh = do
|
|||
((':':_srcmode):dstmode:_srcsha:dstsha:_change:[])
|
||||
-- Only want files, not symlinks
|
||||
| dstmode /= decodeBS' (fmtTreeItemType TreeSymlink) -> do
|
||||
maybe noop (reconcile (asTopFilePath file))
|
||||
maybe noop (reconcile (asTopFilePath (toRawFilePath file)))
|
||||
=<< catKey (Ref dstsha)
|
||||
procdiff rest True
|
||||
| otherwise -> procdiff rest changed
|
||||
|
@ -294,7 +294,7 @@ reconcileStaged qh = do
|
|||
caches <- liftIO $ SQL.getInodeCaches ikey (SQL.ReadHandle qh)
|
||||
keyloc <- calcRepo (gitAnnexLocation key)
|
||||
keypopulated <- sameInodeCache keyloc caches
|
||||
p <- fromRepo $ toRawFilePath . fromTopFilePath file
|
||||
p <- fromRepo $ fromTopFilePath file
|
||||
filepopulated <- sameInodeCache (fromRawFilePath p) caches
|
||||
case (keypopulated, filepopulated) of
|
||||
(True, False) ->
|
||||
|
|
|
@ -17,6 +17,7 @@ import Database.Types
|
|||
import Database.Handle
|
||||
import qualified Database.Queue as H
|
||||
import Utility.InodeCache
|
||||
import Utility.FileSystemEncoding
|
||||
import Git.FilePath
|
||||
|
||||
import Database.Persist.Sql
|
||||
|
@ -69,7 +70,7 @@ addAssociatedFile ik f = queueDb $ do
|
|||
deleteWhere [AssociatedFile ==. af, AssociatedKey !=. ik]
|
||||
void $ insertUnique $ Associated ik af
|
||||
where
|
||||
af = toSFilePath (getTopFilePath f)
|
||||
af = toSFilePath (fromRawFilePath (getTopFilePath f))
|
||||
|
||||
-- Does not remove any old association for a file, but less expensive
|
||||
-- than addAssociatedFile. Calling dropAllAssociatedFiles first and then
|
||||
|
@ -77,7 +78,7 @@ addAssociatedFile ik f = queueDb $ do
|
|||
addAssociatedFileFast :: IKey -> TopFilePath -> WriteHandle -> IO ()
|
||||
addAssociatedFileFast ik f = queueDb $ void $ insertUnique $ Associated ik af
|
||||
where
|
||||
af = toSFilePath (getTopFilePath f)
|
||||
af = toSFilePath (fromRawFilePath (getTopFilePath f))
|
||||
|
||||
dropAllAssociatedFiles :: WriteHandle -> IO ()
|
||||
dropAllAssociatedFiles = queueDb $
|
||||
|
@ -88,7 +89,7 @@ dropAllAssociatedFiles = queueDb $
|
|||
getAssociatedFiles :: IKey -> ReadHandle -> IO [TopFilePath]
|
||||
getAssociatedFiles ik = readDb $ do
|
||||
l <- selectList [AssociatedKey ==. ik] []
|
||||
return $ map (asTopFilePath . fromSFilePath . associatedFile . entityVal) l
|
||||
return $ map (asTopFilePath . toRawFilePath . fromSFilePath . associatedFile . entityVal) l
|
||||
|
||||
{- Gets any keys that are on record as having a particular associated file.
|
||||
- (Should be one or none but the database doesn't enforce that.) -}
|
||||
|
@ -97,13 +98,13 @@ getAssociatedKey f = readDb $ do
|
|||
l <- selectList [AssociatedFile ==. af] []
|
||||
return $ map (associatedKey . entityVal) l
|
||||
where
|
||||
af = toSFilePath (getTopFilePath f)
|
||||
af = toSFilePath (fromRawFilePath (getTopFilePath f))
|
||||
|
||||
removeAssociatedFile :: IKey -> TopFilePath -> WriteHandle -> IO ()
|
||||
removeAssociatedFile ik f = queueDb $
|
||||
deleteWhere [AssociatedKey ==. ik, AssociatedFile ==. af]
|
||||
where
|
||||
af = toSFilePath (getTopFilePath f)
|
||||
af = toSFilePath (fromRawFilePath (getTopFilePath f))
|
||||
|
||||
addInodeCaches :: IKey -> [InodeCache] -> WriteHandle -> IO ()
|
||||
addInodeCaches ik is = queueDb $
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue