[darcs-users] Darcs wiki update
Gwern Branwen
gwern0 at gmail.com
Fri Aug 14 16:53:50 UTC 2009
On Fri, Aug 14, 2009 at 12:46 PM, Eric Kow<kowey at darcs.net> wrote:
> On Wed, Aug 12, 2009 at 08:36:39 -0400, gwern0 at gmail.com wrote:
>> So editors of the wiki might be pleased to know that we've recently
>> updated the installation of Gitit on wiki.darcs.net. The previous
>> installation was weeks/months old.
>
> ...
>
>> It also changes the caching framework to cache entire pages, and
>> stores them in a disk cache. John reports this gives him a 10x speedup
>> using Git; using Darcs, it does seem a little faster.
>
> I've added a script to the repo (posthook.sh) which expires the cache
> for any files we push and which automatically creates a tag every 150
> patches.
>
> Edit away!
In the future, we could use John's expireGititCache (which doesn't do
a tag/checkpoint, though), which goes:
module Main
where
import Network.HTTP
import System.Environment
import Network.URI
import System.FilePath
import Control.Monad
import System.IO
import System.Exit
main :: IO ()
main = do
args <- getArgs
(uriString : files) <- if length args < 2
then usageMessage >> return [""]
else return args
uri <- case parseURI uriString of
Just u -> return u
Nothing -> do
hPutStrLn stderr ("Could not parse URI " ++ uriString)
exitWith (ExitFailure 5)
forM_ files (expireFile uri)
usageMessage :: IO ()
usageMessage = do
hPutStrLn stderr $ "Usage: expireGititCache base-url [file..]\n" ++
"Example: expireGititCache http://localhost:5001 page1.page foo/bar.hs"
exitWith (ExitFailure 1)
expireFile :: URI -> FilePath -> IO ()
expireFile uri file = do
let path' = if takeExtension file == ".page"
then dropExtension file
else file
let uri' = uri{uriPath = "/_expire/" ++ urlEncode path'}
resResp <- simpleHTTP Request{rqURI = uri', rqMethod = POST,
rqHeaders = [], rqBody = ""}
case resResp of
Left connErr -> error $ show connErr
Right (Response (2,0,0) _ _ _) -> return ()
_ -> do
hPutStrLn stderr ("Request for " ++ show uri' ++ " did not
return success status")
exitWith (ExitFailure 3)
--
gwern
More information about the darcs-users
mailing list