darcs

Patch 574 Ignore thisrepo source.

Title Ignore thisrepo source.
Superseder Nosy List owst
Related Issues
Status accepted Assigned To
Milestone

Created on 2011-04-01.14:33:31 by owst, last changed 2011-05-18.11:50:46 by galbolle.

Files
File name Status Uploaded Type Edit Remove
ignore-thisrepo-source_.dpatch owst, 2011-04-01.14:33:31 application/x-darcs-patch
unnamed owst, 2011-04-01.14:33:31 text/x-darcs-patch
unnamed owst, 2011-04-01.14:33:31
See mailing list archives for discussion on individual patches.
Messages
msg13853 (view) Author: owst Date: 2011-04-01.14:33:31
1 patch for repository http://darcs.net/screened:

Fri Apr  1 16:21:06 BST 2011  Owen Stephens <darcs@owenstephens.co.uk>
  * Ignore thisrepo source.
  Do not read or write the 'thisrepo' source to the prefs/sources file.
Attachments
msg13860 (view) Author: kowey Date: 2011-04-01.14:58:32
Hi,

I'm going to apply this, thanks!

Ignore thisrepo source.
-----------------------
> hunk ./src/Darcs/Repository/HashedRepo.hs 307
> -    let repoCache = extractCache $ modifyCache repo dropGlobalCaches
> +    let repoCache = extractCache $ modifyCache repo dropNonRepos
>      appendBinFile (outr++"/"++darcsdir++"/prefs/sources") (show $ repo2cache inr `unionCaches` repoCache )
>    where
> hunk ./src/Darcs/Repository/HashedRepo.hs 310
> -    dropGlobalCaches (Ca cache) = Ca $ filter notGlobalCache cache
> -    notGlobalCache xs = case xs of
> -                         Cache DarcsCache.Directory _ _ -> False
> -                         _                              -> True
> +    dropNonRepos (Ca cache) = Ca $ filter notRepo cache
> +    notRepo xs = case xs of
> +        Cache DarcsCache.Directory _ _ -> False
> +        Cache _ DarcsCache.Writable _  -> False
> +        _                              -> True

I tend to like boolean checks to be expressed as affirmatives rather
than negatives.  This is to avoid stupid Erics getting confused
when they do a mental not.  Basically, instead of having to think about
what notFoo = False, better to ask about Foo = True

Also, is this overly aggressive?  You pointed out that this only adds
one new case to notGlobalCache

>  writeAndReadPatch :: RepoPatch p => Cache -> Compression -> PatchInfoAnd p C(x y)
>                       -> IO (PatchInfoAnd p C(x y))
> hunk ./src/Darcs/Repository/Prefs.hs 416
>        where
>              parsehs = mapMaybe readln . noncomments
>              readln l | "repo:"     `isPrefixOf` l = Just (Cache Repo NotWritable (drop 5 l))
> -                     | "thisrepo:" `isPrefixOf` l = Just (Cache Repo Writable    (drop 9 l))
>                       | nocache = Nothing
>                       | "cache:"    `isPrefixOf` l = Just (Cache Directory Writable    (drop 6 l))
>                       | "readonly:" `isPrefixOf` l = Just (Cache Directory NotWritable (drop 9 l))
> 

What happens if the entry exists?
Will Darcs barf because of parse failure?

AH! You told me live that the missing context line is | otherwise ->
Nothing

-- 
Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow>
For a faster response, try +44 (0)1273 64 2905 or
xmpp:kowey@jabber.fr (Jabber or Google Talk only)
msg14446 (view) Author: galbolle Date: 2011-05-18.11:50:44
This seem to have been applied, but overlooked by the bot.
History
Date User Action Args
2011-04-01 14:33:31owstcreate
2011-04-01 14:58:32koweysetmessages: + msg13860
2011-05-18 11:50:46galbollesetstatus: needs-review -> accepted
messages: + msg14446