[darcs-devel] [patch1180] Garbage collection of global cache.

Marcio Díaz marcio.diaz at gmail.com
Thu Jul 17 20:13:26 UTC 2014


On Wed, Jul 16, 2014 at 8:13 PM, Ganesh Sittampalam <bugs at darcs.net> wrote:

>
> Ganesh Sittampalam <ganesh at earth.li> added the comment:
>
> Some partial comments:
>
> > hunk ./src/Darcs/Repository/HashedRepo.hs 670
> >  -- with inventory" hashes. This function does not attempt to download
> missing
> >  -- inventory files.
> > -listPatchesLocal :: IO [String]
> > -listPatchesLocal = do
> > -    inventory <- readInventoryPrivate darcsdir hashedInventory
> > +listPatchesLocal :: String -> IO [String]
> > +listPatchesLocal darcsDir = do
> > +    inventory <- readInventoryPrivate darcsDir hashedInventory
> >      followStartingWiths (fst inventory) (getPatches inventory)
> >      where
> >          followStartingWiths Nothing patches = return patches
>
> How does this interact with lazy repositories, as we discussed last week?
>

It doesn't interact with lazy repositories. I just realized that we can only
read the hashed_inventory file from the repository and then read the other
inventories from the global cache.


> I think we also discussed an approach of just GCing the user
> repositories first, then GCing the global cache. Which algorithm is
> being used in this patch?
>

This patch doesn't garbage collect the repositories. I don't like the idea
of ​​doing two things at the same time, and there is a command that does
that.


> > hunk ./src/Darcs/Repository/HashedRepo.hs 658
> >      if b then readInventoryPrivate dir invName
> >          else return (Nothing, [])
> >
> > -
> >  -- |listInventoriesLocal this function does not attempt to retrieve
> missing
> >  -- inventory files.
> >  listInventoriesLocal :: IO [String]
>
> Please amend out this unnecessary whitespace change (adds noise, risk of
> conflicts with other changes).
>
>
Ok.


> > +-- | getRecursiveDarcsRepos returns all directories under topdir that
> have
> > +-- a child directory named darcsdir ("_darcs").
> > +getRecursiveDarcsRepos :: FilePath -> IO [FilePath]
> > +getRecursiveDarcsRepos topdir = do
> > +  names <- getDirectoryContents topdir
> > +  let properNames = filter (`notElem` [".", ".."]) names
> > +  paths <- forM properNames $ \name -> do
> > +    let path = topdir </> name
> > +    isDir <- doesDirectoryExist path
> > +    if isDir && (name /= darcsdir)
> > +      then getRecursiveDarcsRepos path
> > +      else if name == darcsdir
>
> This logic feels a bit convoluted. Wouldn't it lead to a file named
> "_darcs" being recognised? I think the outer if should check 'isDir',
> and the inner if check 'name == darcsdir'
>
>
The idea is to recognize the parents of "_darcs" directories.


> __________________________________
> Darcs bug tracker <bugs at darcs.net>
> <http://bugs.darcs.net/patch1180>
> __________________________________
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osuosl.org/pipermail/darcs-devel/attachments/20140717/861ea971/attachment.html>


More information about the darcs-devel mailing list