[darcs-devel] [issue1942] "darcs pull" regression with darcs-1 repos: all patches are being pulled each time

Petr Ročkai bugs at darcs.net
Fri Sep 3 16:09:55 UTC 2010


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

It seems that the following fixes the problem. Patch against adventure, but should be 
straightforward to backport. It needs cleaning up anyway. The original file is 
src/Darcs/Repository/DarcsRepo.hs, function readRepoPrivate. Took a while to figure, 
but at least I understand the code better now. The problem was that looking just at 
the info forced download of the patch.

diff -rN -u -p old-adventure/src/Darcs/Repository/Old.lhs new-
adventure/src/Darcs/Repository/Old.lhs
--- old-adventure/src/Darcs/Repository/Old.lhs  2010-09-03 18:09:46.000000000 +0200
+++ new-adventure/src/Darcs/Repository/Old.lhs  2010-09-03 18:09:48.000000000 +0200
@@ -152,15 +152,15 @@ readOldRepo k (Repo d _ _ _) = do
                  return $ seal $ Tagged tag00 Nothing ps :<: ts
           parse2 :: RepoPatch p => PatchInfo -> FilePath
                                 -> IO (Sealed (PatchInfoAnd p C(x)))
-          parse2 i fn = do ps <- gzFetchFilePS fn Cachable
-                           return $ hopefullyNoParseError i (toPath fn) (readPatch 
ps)
-          hopefullyNoParseError :: PatchInfo -> String
+          parse2 i fn = do ps <- unsafeInterleaveIO $ do putStrLn $ "grabbed patch: 
" ++ show i
+                                                         gzFetchFilePS fn Cachable
+                           putStrLn $ "parse2 patch: " ++ show i
+                           return $ seal $ patchInfoAndPatch i $ 
hopefullyNoParseError (toPath fn) (readPatch ps)
+          {- hopefullyNoParseError :: PatchInfo -> String
                                 -> Maybe (Sealed (Named a1dr C(x)), b)
-                                -> Sealed (PatchInfoAnd a1dr C(x))
-          hopefullyNoParseError i _ (Just (Sealed x, _)) =
-              seal $ patchInfoAndPatch i $ actually x
-          hopefullyNoParseError i s Nothing =
-              seal $ patchInfoAndPatch i $ unavailable $ "Couldn't parse file "++s
+                                -> Sealed (PatchInfoAnd a1dr C(x)) -}
+          hopefullyNoParseError _ (Just (Sealed x, _)) = actually x
+          hopefullyNoParseError s Nothing = unavailable $ "Couldn't parse file "++s
           read_patches :: RepoPatch p =>
                           (FORALL(b) PatchInfo -> IO (Sealed (PatchInfoAnd p C(b))))
                        -> [PatchInfo] -> IO (Sealed (RL (PatchInfoAnd p) C(x)))


Hopefully (pun?) someone can pick up from there.

Yours,
   Petr.

----------
milestone:  -> 2.5.0 CURRENT

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


More information about the darcs-devel mailing list