On Mon, Dec 25, 2006 at 06:02:29PM +0100, Eric Y. Kow wrote: > On Wed, Dec 20, 2006 at 14:32:33 +0100, Juliusz Chroboczek wrote: > > > (I don't really know what a Population is, so I'll need some time to > > > poke around and learn) > > > > When you find out, please summarise for the list. > > Ok, here goes. > > A Population, much like a Slurpy is a representation of a directory > tree. Populations contain far less information than slurpies. Each > file/directory name is associated with metadata, what patch they > were last modified by (PatchInfo), who created the file, etc. > > It seems that Populations are used for informational "read-only" > purposes only. There is code in the core Patch routines > (PatchApply.applyToPop) which applies patches to a population, but such > code only exists to update the metadata in the tree. For example, hunk > patches are ignored.
Right. > Some of the Population code looks like it is presently unused. > Population.popUnfold is one such example. Do we have a future use for > these? Are they cruft from the past? I think they're cruft from the past. (See below.) > (*) I wonder why we do it this way. One would think that, since we are > running the patches backwards anyway, we can get the information from > there. Maybe it's something to do with partial repositories? Maybe > it's just so much more convenient that way? It is mostly just that it seemed convenient this way, in that we could write a single function to apply patches to a Population that keeps track of everything, and then just look inside it to get the information we want. On the other hand, this is among the oldest code in darcs that wasn't written by myself (and therefore that I'm less likely to have cleaned up, since it's not quite in my style), and could certainly do with some work to make it more similar to the rest of the code. For one thing, it'd be nice to make a WriteableDirectory monad for modifying Populations, so that we can use the same apply function on Populations as we do on Slurpies, lists of FilePaths and IO. It'd require a bit of an extension to the WriteableDirectory monad so that we'd not lose the patch name information, but a little function in the class (with null default) such as withNamedPatch :: PatchInfo -> m a -> m a withNamedPatch _ f = f which in the PopulationMonad would cause these changes to be annotated with the relevant patch id. If we made this change, it might also come in handy for other purposes. For example, when applying in the IO monad, we could automatically add to error messages a note indicating which patch failed, which would unify our error messages a bit, so that we wouldn't need to have quite so many cases where we catch errors in applying a patch just so we can add extra information about which patch was being applied. It could also be helpful if we ever were to develop a "pre-annotated" pristine cache. -- David Roundy http://www.darcs.net
signature.asc
Description: Digital signature
_______________________________________________ darcs-devel mailing list [email protected] http://lists.osuosl.org/mailman/listinfo/darcs-devel
