[darcs-devel] [issue2372] Please remove "HINT: I could not reach..." message

Ben Franksen ben.franksen at online.de
Tue Jun 30 01:00:07 UTC 2015


Just an update:

I have been starting to implement the change as agreed below. This needs 
some preliminary re-factorings, which I have just now completed. The main 
point here is that marking a CacheLoc as inaccessible is currently hacked in 
with global mutable variables. A clean solution needs to treat the Cache 
type as something mutable. I am currently going for

  newtype Cache = Ca (MVar [CacheLoc])

This inevitably changes the type of some of the functions defined on caches. 
The resulting breakage is fortunately not too wide-spread (since most of the 
cache functions are already in the IO monad). A nice side-effect is that the 
code in Darcs.Repository.Clone can be further simplified. In particular we 
can dispense with the ugly toCache2, toCache3 etc. I also think that I can 
massage out the excessively repeated calls to identifyRepository(For).

I'll now start to modify the cache implementation to actually make use of 
the mutability of the locations in a cache and thus dispensing with the 
global variable hack. The last piece of work will be to make sure that we 
automatically modify the corresponding sources files (global and local), 
marking unreachable entries with a "noaccess:<location>" line; and issuing 
the appropriate messages when doing this for the global sources file.

Keep tuned...

Cheers
Ben

Ben Franksen wrote:
> Ganesh Sittampalam wrote:
> 
>> On 07/03/2015 17:07, Ben Franksen wrote:
>> 
>>> (1) Stop accessing ~/.darcs/cache unconditionally. Instead,
>>> automatically create ~/.darcs/sources (if and only if it does not yet
>>> exist), with ~/.darcs/cache as the single (default) entry. We can do
>>> this every time Darcs is invoked or just before it starts reading patch
>>> files.
>> 
>> I like this idea.
>> 
>>> (2) Similarly, for each repo create _darcs/prefs/sources that by default
>>> is a copy of ~/.darcs/sources. Again, do this only if no such file
>>> exists (i.e. *not* if it exists and is empty).
>> 
>> What's the advantage of copying it rather than falling through to it? I
>> guess it means that you can stop entries in the global sources being
>> used, but that strikes me as quite a rare/unlikely case.
> 
> Yes, that's better. It means we keep global and local sources separate:
> the global one for global caches, the local one (only) for related repos.
> This means there is no longer any need to manually modify a local sources
> file, which is a good thing.
> 
>> Conversely, if we fall through then it's easier for people to add/remove
>> global sources without touching every repository.
> 
> Right. BTW, I didn't mention it but of course Darcs should always consider
> the global *and* local sources files. (I think this is how things are
> currently.)
> 
>>> (3) Whenever an entry in _darcs/prefs/sources or ~/.darcs/sources is
>>> inaccessible, it gets removed (permanently) from both files.
>> 
>> Would the user be told, so they could re-add it in the case of a problem
>> they knew to be transient?
> 
> Yes, for the global sources file a one line notification a la
> 
>   Removing inaccessible /path/to/cache from ~/.darcs/sources.
> 
> would be nice. Or perhaps the line should just be disabled (with a comment
> marker or some such), and the message changed to
> 
>   Disabling inaccessible /path/to/cache in ~/.darcs/sources.
> 
> making it easier to re-enable it. BTW, if editing the file fails for some
> reason, we should just change the message to
> 
>   Not disabling inaccessible /path/to/cache in ~/.darcs/sources
>   (<reason>).
> 
> 
> OTOH, the local sources file is dynamically modified almost every time we
> interact with another branch/repo, so it wouldn't make much sense to issue
> a message.
> 
>>> (4) New entries are auto-added to _darcs/prefs/sources as before i.e.
>>> whenever we are told to fetch something from a specified repo.
>> 
>> Makes sense.
>> 
>>> This allows users to reset the caching behaviour of a repo to defaults
>>> by simply removing _darcs/prefs/sources. In the same way, removing
>>> ~/.darcs/sources resets the global default to the single entry for
>>> ~/.darcs/cache. Everything else is taken care of automatically.
>> 
>> Sounds good to me (modulo the copying versus fallthrough question).
> 
> Good. It's on my TODO list now.
> 
> Cheers
> Ben
-- 
"Make it so they have to reboot after every typo." ― Scott Adams




More information about the darcs-devel mailing list