Florent Becker <florent.bec...@ens-lyon.org> added the comment:

hunk ./src/Darcs/Repository.hs 87
>  #endif
>  import URL ( maxPipelineLength )
>  
> -import Control.Applicative ( (<$>) )
>  import Control.Exception ( finally )
>  import Control.Concurrent ( forkIO )
>  import Control.Concurrent.MVar ( MVar, newMVar, putMVar, takeMVar )

hunk ./src/Darcs/Repository.hs 260
>    debugMessage "Copying prefs"
>    copyFileOrUrl (remoteDarcs opts) (fromDir ++ "/" ++ darcsdir ++ 
"/prefs/prefs")
>      (darcsdir ++ "/prefs/prefs") (MaxAge 600) `catchall` return ()
> -  if isFile fromDir && Packs `elem` opts && NoPacks `notElem` opts
> -    then copyNotPackedRepository fromRepo
> -    else do
> -      b <- (Just <$> fetchFileLazyPS (fromDir ++ "/" ++ darcsdir ++
> -        "/packs/basic.tar.gz") Uncachable) `catchall` return Nothing
> -      case b of
> -        Nothing -> copyNotPackedRepository fromRepo
> -        Just b' -> copyPackedRepository fromRepo b'
> +  -- try packs for remote repositories
> +  if (not . isFile) fromDir && Packs `elem` opts && NoPacks `notElem` 
opts
> +    then copyPackedRepository fromRepo
> +    else copyNotPackedRepository fromRepo
>  
>  putInfo :: [DarcsFlag] -> Doc -> IO ()
>  putInfo opts = unless (Quiet `elem` opts) . hPutDocLn stderr

If I understand correctly, your patch does not change what effectively
happens, but makes the code clearer.

By the way, using (Packs `elem` opts && NoPacks `notElem` opts) is
probably not what you want: you want to give priority to whichever
flag is passed last on the command line. Ie, if i put --no-packs in
my _darcs/prefs, I should be able to override it later on the
command-line. Can you fix that in a followup? You can use getBoolFlag
from Flags.hs for that.


hunk ./src/Darcs/Repository.hs 293
>                     pristineFromWorking torepository
>  
>  copyPackedRepository :: forall p C(r u t). RepoPatch p =>
> -  Repository p C(r u t) -> BL.ByteString -> IO ()
> -copyPackedRepository fromRepo@(Repo fromDir opts _ (DarcsRepository _ 
fromCache)) b = do
> +  Repository p C(r u t) -> IO ()
> +copyPackedRepository r =
> +  -- fallback to no-packs get in case of error
> +  copyPackedRepository2 r `catchall` copyNotPackedRepository r
> +
> +copyPackedRepository2 :: forall p C(r u t). RepoPatch p =>
> +  Repository p C(r u t) -> IO ()
> +copyPackedRepository2 fromRepo@(Repo fromDir opts _ (DarcsRepository 
_ fromCache)) = do
> +  b <- fetchFileLazyPS (fromDir ++ "/" ++ darcsdir ++ 
"/packs/basic.tar.gz") Uncachable
>    Repo toDir _ toFormat (DarcsRepository toPristine toCache) <-
>      identifyRepositoryFor fromRepo "."
>    toCache2 <- unionRemoteCaches toCache fromCache fromDir

This is clearer.

----------
status: needs-screening -> followup-requested

__________________________________
Darcs bug tracker <b...@darcs.net>
<http://bugs.darcs.net/patch450>
__________________________________
_______________________________________________
darcs-users mailing list
darcs-users@darcs.net
http://lists.osuosl.org/mailman/listinfo/darcs-users

Reply via email to