[darcs-users] [patch277] Resolve issue 1176: caches interfere with --remote-rep...
Eric Kow
kowey at darcs.net
Thu Jun 10 22:15:19 UTC 2010
On Thu, Jun 10, 2010 at 21:46:22 +0000, Adolfo Builes wrote:
> - addLocal repo repos = modifyCache repo $ \ (Ca cache) -> Ca $ [Cache DarcsCache.Repo NotWritable r | r <- repos, isFile r ] ++ cache
> + addLocal repo repos = modifyCache repo $ \ (Ca cache) -> Ca $ [Cache DarcsCache.Repo NotWritable r | r <- repos, isFile r ] ++
> + [Cache DarcsCache.Repo NotWritable r | RemoteRepo r <- opts] ++ cache
So in this code, we assume that the remote repository is more easily
accessible than the other entries in the sources file. Is that
desirable?
Code-wise: it's probably good to make Cache DarcsCache.Repo NotWritable
a helper function.
Also on IRC, we'd discussed a possible simplification to this scheme
where we add *all* of the explicitly requested repositories (not just
the local ones) and then sort everything. (Why?) What I would suggest
is doing something like that first and then building this patch on top
of that work.
Also, not related to this patch review, I claim that there is a real
world (in other words, not contrived) scenario in which you will
actually find both a remote-repo flag *and* some explicitly
requested repositories. Can you find it? It may be a useful exercise
to think about what that may me (It takes some more familiarity with
Darcs as a user than you may have, so don't worry if you don't find it,
but if you do find it, I think the "ah-hah!" moment may be moderately
rewarding...)
I also think it'd be useful if you could explain to me why we add the
explicitly requested repos and the remote repo to the these caches,
but not the defaultrepo. I have a reason that makes sense to me, but
I'd like to see what you think just to double check.
> compareByLocality (Cache _ _ x) (Cache _ _ y)
> | isLocal x && isRemote y = LT
> | isRemote x && isLocal y = GT
> + | isUrl x && isSsh y = LT
> + | isSsh x && isUrl y = GT
That seems to make sense. You may want to haddock this
function, maybe just saying the order things are sorted in,
ie. local < http < ssh
--
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/20100610/4d0b5497/attachment.pgp>
More information about the darcs-users
mailing list