On Mon, Jun 07, 2010 at 20:01:43 +0000, Petr Ročkai wrote: > This has been sitting around on my mainline branch for a while. Guess I just > forgot to send it... Should be self-explanatory (I hope).
Seems to make sense. I was going to ask "what if the user does not pass in any paths on the command line?", but I think this tells restrictSubpaths helper tells me the answer, restrictPaths :: FilterTree t m => t m -> t m restrictPaths = if null subpaths then id else filter (filterPaths anchored) By the way, I seem to remember having seen and reported a recent bug where 'whatsnew .' would break but 'whatsnew' without any arguments would be fine. Do you know what I'm referring to? I can't find it on the tracker or in my local list! The comments below are just Eric-reads-the-patch, no action on your part needed. > Sun May 9 12:22:48 CEST 2010 Petr Rockai <m...@mornfall.net> > * Limit index updates to relevant subtree in a few cases. Limit index updates to relevant subtree in a few cases. ------------------------------------------------------- > Petr Rockai <m...@mornfall.net>**20100509102248 > Ignore-this: fea041133d039cecead73935f0cd6762 > ] hunk ./src/Darcs/Commands/Diff.lhs 210 > - restrict <- restrictSubpaths repository subpaths > - restrict `fmap` readUnrecorded repository >>= (flip > writePlainTree (toFilePath ndir)) > + readUnrecorded repository subpaths >>= (flip writePlainTree > (toFilePath ndir)) Basically, it looks like we're taking these smarts from the diff command and refactoring them into readUnrecorded. The smarts in question are explained in Petr's haddock: > -- | Obtains a Tree corresponding to the "unrecorded" state of the > repository: > +-- the working tree plus the "pending" patch. The optional list of paths (it > is > +-- ignored if empty) allows to restrict the query to a subtree. > +-- > +-- Limiting the query may be more efficient, since hashes on the > uninteresting > +-- parts of the index do not need to go through an up-to-date check (which > +-- involves a relatively expensive lstat(2) per file. The commands that consequently inherit said smarts are > hunk ./src/Darcs/Commands/Remove.lhs 101 > hunk ./src/Darcs/Commands/Replace.lhs 171 > hunk ./src/Darcs/Commands/WhatsNew.lhs 113 There's also this bit which does not change any behaviour > hunk ./src/Darcs/Repository/Merge.hs 71 > debugMessage "Checking for unrecorded conflicts..." > have_unrecorded_conflicts <- checkUnrecordedConflicts opts pc > debugMessage "Reading working directory..." > - working <- readUnrecorded r > + working <- readUnrecorded r [] > -readUnrecorded :: (RepoPatch p) => Repository p C(r u t) -> IO (Tree IO) > -readUnrecorded repo = readIndex repo >>= I.updateIndex > +readUnrecorded :: (RepoPatch p) => Repository p C(r u t) -> [SubPath] -> IO > (Tree IO) > +readUnrecorded repo paths = do > + relevant <- restrictSubpaths repo paths > + readIndex repo >>= I.updateIndex . relevant And here's the meat of the change. -- Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow> PGP Key ID: 08AC04F9
signature.asc
Description: Digital signature
_______________________________________________ darcs-users mailing list darcs-users@darcs.net http://lists.osuosl.org/mailman/listinfo/darcs-users