Hi,
some remarks inside.
Scott Lawrence <bugs@darcs.net> writes:
> hunk ./src/Darcs/Flags.hs 133
> | otherwise = DefaultRemoteDarcs
>
> data UseIndex = UseIndex | IgnoreIndex
> -data ScanKnown = ScanKnown | ScanAll
> +data ScanKnown = ScanKnown | ScanAll | ScanAllWithBoring
Maybe just ScanBoring?
> hunk ./src/Darcs/Repository/State.hs 150
> (ScanKnown, IgnoreIndex) -> do
> guide <- expand current
> applyTreeFilter relevant <$> restrict guide <$> readPlainTree "."
> - (ScanAll, _) -> do
> + _ -> do
> index <- getIndex
> nonboring <- restrictBoring index
> hunk ./src/Darcs/Repository/State.hs 153
> - plain <- applyTreeFilter relevant <$> applyTreeFilter nonboring <$> readPlainTree "."
> + plain <- case scan of
> + ScanAll -> applyTreeFilter relevant <$>
> + applyTreeFilter nonboring <$> readPlainTree "."
> + ScanAllWithBoring -> applyTreeFilter relevant <$>
> + readPlainTree "."
> return $ case useidx of
> UseIndex -> plain `overlay` index
> IgnoreIndex -> plain
> [Fix warnings in new unrecordedChanges code via slight refactoring
> Scott Lawrence <bytbox@gmail.com>**20110509025948
> Ignore-this: 51ac5e312ba190c9819e96c8a7a5712f
> ] hunk ./src/Darcs/Repository/State.hs 145
> let getIndex = I.updateIndex =<< (applyTreeFilter relevant <$> readIndex repo)
> current = applyTreeFilter relevant all_current
>
> - working <- case (scan, useidx) of
> - (ScanKnown, UseIndex) -> getIndex
> - (ScanKnown, IgnoreIndex) -> do
> - guide <- expand current
> - applyTreeFilter relevant <$> restrict guide <$> readPlainTree "."
> - _ -> do
> - index <- getIndex
> - nonboring <- restrictBoring index
> - plain <- case scan of
> - ScanAll -> applyTreeFilter relevant <$>
> - applyTreeFilter nonboring <$> readPlainTree "."
> - ScanAllWithBoring -> applyTreeFilter relevant <$>
> - readPlainTree "."
> - return $ case useidx of
> - UseIndex -> plain `overlay` index
> - IgnoreIndex -> plain
> + index <- getIndex
> + working <- case scan of
> + ScanKnown -> case useidx of
> + UseIndex -> getIndex
> + IgnoreIndex -> do
> + guide <- expand current
> + applyTreeFilter relevant <$> restrict guide <$> readPlainTree "."
> + ScanAll -> do
> + nonboring <- restrictBoring index
> + plain <- applyTreeFilter relevant <$> applyTreeFilter nonboring <$> readPlainTree "."
> + return $ case useidx of
> + UseIndex -> plain `overlay` index
> + IgnoreIndex -> plain
> + ScanAllWithBoring -> do
> + plain <- applyTreeFilter relevant <$> readPlainTree "."
> + return $ case useidx of
> + UseIndex -> plain `overlay` index
> + IgnoreIndex -> plain
I liked the previous version with less repetition more.
>
> ft <- filetypeFunction
> Sealed (diff :: FL (PrimOf p) C(x y)) <- (unFreeLeft `fmap` treeDiff ft current working) :: IO (Sealed (FL (PrimOf p) C(x)))
> [Ignore files in darcsdir, even with --boring
> Scott Lawrence <bytbox@gmail.com>**20110509053505
> Ignore-this: f8d5c65b1e67992a086693b1bf092601
> ] hunk ./src/Darcs/Repository/Prefs.hs 34
> getCaches,
> binariesFileHelp, boringFileHelp,
> globalCacheDir,
> - globalPrefsDirDoc
> + globalPrefsDirDoc,
> ) where
>
> import System.IO.Error ( isDoesNotExistError )
> hunk ./src/Darcs/Repository/State.hs 38
> import Prelude hiding ( filter )
> import Control.Monad( when )
> import Control.Applicative( (<$>) )
> -import Data.Maybe( isJust )
> +import Data.Maybe( isJust, isNothing )
> import Data.List( union )
> hunk ./src/Darcs/Repository/State.hs 40
> -import Text.Regex( matchRegex )
> +import Text.Regex( mkRegex, matchRegex )
>
> import System.Directory( removeFile, doesFileExist, doesDirectoryExist, renameFile )
> import System.FilePath ( (</>) )
> hunk ./src/Darcs/Repository/State.hs 115
> _ -> True
> return (TreeFilter restrictTree)
>
> +restrictDarcsdir :: forall m . TreeFilter m
> +restrictDarcsdir = TreeFilter $ filter $ \p _ -> isNothing $
> + matchRegex (mkRegex $ "(^|/)"++darcsdir++"($|/)") $ anchorPath "" p
> +
I don't like the use of regex for this. We already have a better way to
do the same thing, it should just be lifted out of restrictBoring:
boring' (AnchoredPath (Name x:_)) | x == BSC.pack darcsdir = False
> -- | For a repository and an optional list of paths (when Nothing, take
> -- everything) compute a (forward) list of prims (i.e. a patch) going from the
> -- recorded state of the repository (pristine) to the unrecorded state of the
> hunk ./src/Darcs/Repository/State.hs 150
> current = applyTreeFilter relevant all_current
>
> index <- getIndex
> - working <- case scan of
> + working <- applyTreeFilter restrictDarcsdir <$> case scan of
> ScanKnown -> case useidx of
> UseIndex -> getIndex
> IgnoreIndex -> do
Yours,
Petr
--
id' Ash = Ash; id' Dust = Dust; id' _ = undefined
|