[darcs-users] darcs patch: Highlight the global cache as a best pra... (and 1 more)

Max Battcher me at worldmaker.net
Fri Aug 8 01:30:55 UTC 2008


Eric Y. Kow wrote:
> The most appealing option so far -- I forget whose idea this was --
> would be to reinstate unpull as a new command that actually checks to
> make sure that the unpulled patch still exists in defaultrepo.
> 
> One slightly surprising aspect of this, however, would be that darcs
> unpull would now involve a potential (e.g. ssh) connection to a remote
> repo.

Eric, with lazy repos and the new _darcs/prefs/sources file its likely 
that just about every command might hit a potential ssh connection to a 
remote repo.  Which leads me to my next question: Could this be 
implemented just by checking the caches in sources for a copy?  This 
would be:

* Exit with an error if a user does not have at least one cache: or 
readonly: repository in _darcs/prefs/sources or ~/.darcs/prefs/sources.

* Insure the patch is stashed in at least one, if not all, of the 
caches, otherwise if there is a writable cache: store it, if there is 
only readonly: caches, stop with an error.

The only problem I can foresee with this is there would be a need for a 
method to pull a patch from a cache, in the weird case that a repository 
disappears or it was never pushed, and I'm not sure how the UI would be 
for that (a new pull cache:?  how would you tell which patches were 
applicable?), but it _seems_ like a potentially nicer/cheaper/easier 
thing to check than a remote repository (while allowing for the remote 
repository to be in sources as well).

Incidentally, this would make unpull equivalent to the long requested 
"stash" command, using the global cache as a meta-repository for stashed 
patches.  Thus one obvious name for a "pull a patch from the cache" 
might be "unstash".  (Depending on the way this "unstash from the cache" 
tool detects suitable patches it might make for an interesting tool in 
the weird case that "I want to pull a patch into this repository, but I 
forget which local repository I made it in, so let's just try unstash 
real quick because it should be cached by now...")

On a semi-related note I was already thinking earlier about some sort of 
UI to clean/verify what's in a darcs cache.  Among other things I was 
thinking about writing a simple python script to check the link count on 
files in the cache and if they are not linked in any other repo (link 
count of 1, right?), remove the file.  This would be useful in cases 
where you download someone's repository just to look at it and then 
remove it to move on to other projects or working on temporary/test 
repositories...  I'm wondering if some sort of cache 
management/optimization tool might be a better fit as a darcs command, 
but I'll probably right my quick and dirty python script anyway.

> Having hid the unpull command, I still use it :-)

I do as well, hence my forgetting to use the new name in the 
documentation I submitted.  Oops.

--
--Max Battcher--
http://www.worldmaker.net/


More information about the darcs-users mailing list