[darcs-users] [patch264] Resolve issue1817: --external-merge broken, by bumping

Petr Ročkai bugs at darcs.net
Sun Jun 6 14:39:29 UTC 2010


Petr Ročkai <me at mornfall.net> added the comment:

I have pushed the missing patches now, sorry for the inconvenience. This is the 
relevant diff:

Thu Jun  3 22:41:50 CEST 2010  Petr Rockai <me at mornfall.net>
  * Make readBlob work out of the original working directory for Index Trees.
diff -rN -u -p old-hashed-storage/Storage/Hashed/Index.hs new-hashed-
storage/Storage/Hashed/Index.hs
--- old-hashed-storage/Storage/Hashed/Index.hs  2010-06-06 16:40:45.000000000 
+0200
+++ new-hashed-storage/Storage/Hashed/Index.hs  2010-06-06 16:40:45.000000000 
+0200
@@ -50,13 +50,14 @@ import Bundled.Posix( getFileStatusBS, m
                       getFileStatus, fileSize, fileExists )
 import System.IO.MMap( mmapFileForeignPtr, mmapFileByteString, Mode(..) )
 import System.IO( )
-import System.Directory( doesFileExist )
+import System.Directory( doesFileExist, getCurrentDirectory )
 #if mingw32_HOST_OS
 import System.Directory( renameFile )
 import System.FilePath( (<.>) )
 #else
 import System.Directory( removeFile )
 #endif
+import System.FilePath( (</>) )
 
 import Control.Monad( when )
 import Control.Exception.Extensible
@@ -220,6 +221,7 @@ mmapIndex indexpath req_size = do
             return (x, size)
 
 data IndexM m = Index { mmap :: (ForeignPtr ())
+                      , basedir :: FilePath
                       , hashtree :: Tree m -> Hash
                       , predicate :: AnchoredPath -> TreeItem m -> Bool }
               | EmptyIndex
@@ -291,7 +293,7 @@ readFile index state item =
        size <- xlatePeek64 $ iSize item
        let mtime' = modificationTime st
            size' = fromIntegral $ fileSize st
-           readblob = readSegment (BSC.unpack $ iPath item, Nothing)
+           readblob = readSegment (basedir index </> BSC.unpack (iPath item), 
Nothing)
            exists = fileExists st
            we_changed = mtime /= mtime' || size /= size'
            hash = iHash' item
@@ -329,8 +331,10 @@ updateIndex index =
 readIndex :: FilePath -> (Tree IO -> Hash) -> IO Index
 readIndex indexpath ht = do
   (mmap_ptr, mmap_size) <- mmapIndex indexpath 0
+  base <- getCurrentDirectory
   return $ if mmap_size == 0 then EmptyIndex
                              else Index { mmap = mmap_ptr
+                                        , basedir = base
                                         , hashtree = ht
                                         , predicate = \_ _ -> True }

__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/patch264>
__________________________________


More information about the darcs-users mailing list