[darcs-users] [patch266] Resolve Issue1210 [status=amend-requested]

Eric Kow kowey at darcs.net
Sun Jun 6 19:19:41 UTC 2010

Hi Adolfo,

On Sun, Jun 06, 2010 at 01:57:50 +0000, Adolfo Builes wrote:
> Sat Jun  5 20:39:05 COT 2010  builes.adolfo at googlemail.com
>   * Resolve Issue1210: global cache gets recorded in _darcs/prefs/sources

Probably a good idea to lowercase that 'Issue1210'.  Not a big deal, but it
increases the probability of somebody finding this patch later on when they're
looking for it.

The actual reason I'm asking for a (possible) amend is in my review below.

> The sources files is written each time we are copying a repository, what                                                                                   
> happens is that when darcs tries to identify a repository it calls                                                                                         
> Repository.Prefs.getCache , this function always include in  the cache the                                                                                 
> global one unless --no-cache is given, and then when saving it to sources,                                                                                 
> it just copies everything that is in the Cache of the repository.                                                                                          
> My first approach was appending NoCache to the list of flags, but then I                                                                                   
> realized that darcs wouldn't use the global cache, because it wasn't in the                                                                                
> Cache, so in that case we were losing the advantages offered by it,                                                                                        
> specially if we were getting a remote one. So I modified the cache just                                                                                    
> before saving it to the sources file, dropping the global cache out of the                                                                                 
> list of sources.                                                                                                                                           

Resolve Issue1210: global cache gets recorded in _darcs/prefs/sources
>  import Darcs.Commands ( DarcsCommand(..), nodefaults, commandAlias, putInfo )
>  import Darcs.Arguments ( DarcsFlag( NewRepo, Partial, Lazy,
>                                      UseFormat2, UseOldFashionedInventory, UseHashedInventory,
> -                                    SetScriptsExecutable, OnePattern ),
> +                                    SetScriptsExecutable, OnePattern, NoCache ),

Presumably this is leftover and should be removed?

> -    appendBinFile (outr++"/"++darcsdir++"/prefs/sources") (show $ repo2cache inr `unionCaches` extractCache repo)
> +    (Just d) <- globalCacheDir
> +    let globalCache = Cache DarcsCache.Directory Writable d
> +    let repoCache   = extractCache $ modifyCache repo (dropLocalCache globalCache)
> +    appendBinFile (outr++"/"++darcsdir++"/prefs/sources") (show $ repo2cache inr `unionCaches` repoCache )

Most of this makes sense, but what if the global cache dir is Nothing?
Does this whole function fail?

Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow>
PGP Key ID: 08AC04F9
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/darcs-users/attachments/20100606/1de482fb/attachment.pgp>

More information about the darcs-users mailing list