I'll apply this first patch, but I have question about the second one Resolve issue 1176: caches interfere with --remote-repo flag ------------------------------------------------------------ > - addLocal repo repos = modifyCache repo $ \ (Ca cache) -> Ca $ [Cache > DarcsCache.Repo NotWritable r | r <- repos, isFile r ] ++ cache > + addReposToCache repos (Ca cache) = Ca $ [ toReadOnlyCache r | r <- > repos ] ++ cache > + toReadOnlyCache = Cache DarcsCache.Repo NotWritable
Adolfo explained to me on IRC that the defaultrepo/remote repo are
actually treated as explicitly requested repos (via Darcs.RunCommand)
if no other arguments are passed.
So this looks fine.
I'll just say that
> + addReposToCache repos (Ca cache) = Ca $ [ toReadOnlyCache r | r <-
> repos ] ++ cache
probably is cleaner written like
addReposToCache repos (Ca cache) = Ca $ map toReadOnlyCache repos ++
cache
but I don't mind either way
> --- | Modifies the cache of a given repository with the function f
> +-- | Modifies the cache of a given repository with the function f.
> +-- No matter which modification is done over the cache, it always
> +-- returns a sorted cache where local < http < ssh
> modifyCache :: FORALL(p r u t) (RepoPatch p) => Repository p C(r u t) ->
> (Cache -> Cache) -> Repository p C(r u t)
> hunk ./src/Darcs/Repository/InternalTypes.hs 53
> -modifyCache (Repo dir opts rf (DarcsRepository pristine cache)) f =
> - Repo dir opts rf (DarcsRepository pristine (f cache))
> -
> +modifyCache (Repo dir opts rf (DarcsRepository pristine cache)) f = Repo dir
> opts rf dr
> + where dr = DarcsRepository pristine newCache
> + newCache = ( \ (Ca c) -> Ca $ sortBy compareByLocality c) $ f cache
Maybe Ca should be a Functor so you could just fmap (sortBy compareByLocality)
on it? (This could end up being one of those really bad ideas)
Removing duplicated entries in addReposToCache
----------------------------------------------
> [email protected]**20100615150306
> Ignore-this: 47fbcc3221eee93719681bad059dafe2
> ] hunk ./src/Darcs/Commands/Pull.lhs 181
> applyPatches opts' repository r
> where
> opts' = mergeOpts opts
> - addReposToCache repos (Ca cache) = Ca $ [ toReadOnlyCache r | r <-
> repos ] ++ cache
> + addReposToCache repos (Ca cache) = Ca $ nub $ [ toReadOnlyCache r | r
> <- repos ] ++ cache
> toReadOnlyCache = Cache DarcsCache.Repo NotWritable
This seems like an improvement anyway, but why don't we nub in
modifyCache since we're happy to sort there?
--
Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow>
PGP Key ID: 08AC04F9
signature.asc
Description: Digital signature
_______________________________________________ darcs-users mailing list [email protected] http://lists.osuosl.org/mailman/listinfo/darcs-users
