From 54437c2ee331c668c874732d2abed562481599ad Mon Sep 17 00:00:00 2001 From: convert-repo Date: Mon, 11 Oct 2010 07:00:27 +0000 Subject: [PATCH 01/24] update tags --- .hgtags | 1 + 1 file changed, 1 insertion(+) create mode 100644 .hgtags diff --git a/.hgtags b/.hgtags new file mode 100644 index 0000000..b94f031 --- /dev/null +++ b/.hgtags @@ -0,0 +1 @@ +f76fcbbbfead7acb4d8323fb230155f06d2aad5b 0.3.3 From 497f1f11c5bbb0e8f5fdc06db727ec8ad1bfa40c Mon Sep 17 00:00:00 2001 From: Bryan O'Sullivan Date: Sun, 10 Oct 2010 16:03:56 -0700 Subject: [PATCH 02/24] Start to clean things up --- .hgignore | 5 +++++ FileManip.cabal => filemanip.cabal | 13 +++---------- 2 files changed, 8 insertions(+), 10 deletions(-) create mode 100644 .hgignore rename FileManip.cabal => filemanip.cabal (65%) diff --git a/.hgignore b/.hgignore new file mode 100644 index 0000000..cd7fdde --- /dev/null +++ b/.hgignore @@ -0,0 +1,5 @@ +^dist$ +\.(?:aux|eventlog|h[ip]|log|[oa]|orig|prof|ps|swp)$ +~$ +syntax: glob +.\#* diff --git a/FileManip.cabal b/filemanip.cabal similarity index 65% rename from FileManip.cabal rename to filemanip.cabal index 0efd770..d643f80 100644 --- a/FileManip.cabal +++ b/filemanip.cabal @@ -1,5 +1,5 @@ -Name: FileManip -Version: 0.3.3 +Name: filemanip +Version: 0.4.0.0 License: BSD3 License-File: LICENSE Author: Bryan O'Sullivan @@ -9,19 +9,12 @@ Category: System Description: A Haskell library for working with files and directories. Includes code for pattern matching, finding files, modifying file contents, and more. -Cabal-version: >= 1.2 +Cabal-version: >= 1.6 Build-type: Simple Extra-Source-Files: README -Flag splitBase - Description: Choose the new, split-up base package. - Library - if flag(splitBase) - Build-Depends: base >= 2 && < 5, bytestring, directory, filepath, mtl, unix, extensible-exceptions - else - Build-Depends: base >= 2 && < 5, filepath, mtl, unix, extensible-exceptions GHC-Options: -Wall Exposed-Modules: From 9a21d9a8dca382feaaa868503b2ef62f2e8f1b17 Mon Sep 17 00:00:00 2001 From: Bryan O'Sullivan Date: Sun, 10 Oct 2010 16:05:33 -0700 Subject: [PATCH 03/24] Update README --- README | 50 ------------------------------------------------- README.markdown | 26 +++++++++++++++++++++++++ filemanip.cabal | 2 +- 3 files changed, 27 insertions(+), 51 deletions(-) delete mode 100644 README create mode 100644 README.markdown diff --git a/README b/README deleted file mode 100644 index 8f2735c..0000000 --- a/README +++ /dev/null @@ -1,50 +0,0 @@ -FileManip: expressive file manipulation ---------------------------------------- - -This package provides functions and combinators for searching, -matching, and manipulating files. - -It provides four modules. - -System.FilePath.Find lets you search a filesystem hierarchy efficiently: - - find always (extension ==? ".pl") >>= mapM_ remove - -System.FilePath.GlobPattern lets you perform glob-style pattern -matching, without going through a regexp engine: - - "foo.c" ~~ "*.c" ==> True - -System.FilePath.Glob lets you do simple glob-style file name searches: - - namesMatching "*/*.c" ==> ["foo/bar.c"] - -System.FilePath.Manip lets you rename files procedurally, edit files -in place, or save old copies as backups: - - modifyWithBackup (<.> "bak") - (unlines . map (takeWhile (/= ',')) . lines) - "myPoorFile.csv" - - -To build and install: - - runhaskell Setup configure - runhaskell Setup build - runhaskell Setup install - - -To understand: - - http://darcs.serpentine.com/filemanip/dist/doc/html/FileManip/ - - - -To contribute: - - darcs get http://darcs.serpentine.com/filemanip - - -Contributors: - - Bryan O'Sullivan diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..f0e49fd --- /dev/null +++ b/README.markdown @@ -0,0 +1,26 @@ +# filemanip: expressive file manipulation + +This package provides functions and combinators for searching, +matching, and manipulating files. + + +# Get involved! + +Please report bugs via the +[bitbucket issue tracker](http://bitbucket.org/bos/attoparsec/filemanip). + +Master [Mercurial repository](http://bitbucket.org/bos/filemanip): + +* `hg clone http://bitbucket.org/bos/filemanip` + +There's also a [git mirror](http://github.com/bos/filemanip): + +* `git clone git://github.com/bos/filemanip.git` + +(You can create and contribute changes using either Mercurial or git.) + + +# Authors + +This library is written and maintained by Bryan O'Sullivan, +. diff --git a/filemanip.cabal b/filemanip.cabal index d643f80..64ed0cf 100644 --- a/filemanip.cabal +++ b/filemanip.cabal @@ -12,7 +12,7 @@ Description: A Haskell library for working with files and directories. Cabal-version: >= 1.6 Build-type: Simple -Extra-Source-Files: README +Extra-Source-Files: README.markdown Library From 76491aebb1e3f4ea476aa784ca0f75f3b508b217 Mon Sep 17 00:00:00 2001 From: Bryan O'Sullivan Date: Sun, 10 Oct 2010 16:16:47 -0700 Subject: [PATCH 04/24] Get things building again --- System/FilePath/Error.hs | 42 ---------------------------------------- System/FilePath/Find.hs | 34 +++++++++++++++++--------------- System/FilePath/Glob.hs | 6 +++--- System/FilePath/Manip.hs | 11 +++++------ filemanip.cabal | 12 ++++++++---- 5 files changed, 34 insertions(+), 71 deletions(-) delete mode 100644 System/FilePath/Error.hs diff --git a/System/FilePath/Error.hs b/System/FilePath/Error.hs deleted file mode 100644 index aabce41..0000000 --- a/System/FilePath/Error.hs +++ /dev/null @@ -1,42 +0,0 @@ -{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-} - --- | --- Module: System.FilePath.Manip --- Copyright: Sergei Trofimovich --- License: BSD3 --- Maintainer: Bryan O'Sullivan --- Stability: unstable --- Portability: Unix-like systems (requires flexible instances) - -module System.FilePath.Error - ( - bracket - , bracket_ - , catch - , handle - , throwIO - , Exception - ) where - -import qualified Control.Exception.Extensible as EE -import Prelude hiding (catch) - --- we can catch any exceptions if we need to --- type Exception = SomeException -type Exception = EE.IOException - --- we just pin down 'EE.Exception e' to local Exception -bracket :: IO a -> (a -> IO b) -> (a -> IO c) -> IO c -bracket = EE.bracket - -bracket_ :: IO a -> IO b -> IO c -> IO c -bracket_ = EE.bracket_ - -catch :: IO a -> (Exception -> IO a) -> IO a -catch = EE.catch - -handle :: (Exception -> IO a) -> IO a -> IO a -handle = EE.handle - -throwIO :: (EE.Exception e) => e -> IO a -throwIO = EE.throwIO diff --git a/System/FilePath/Find.hs b/System/FilePath/Find.hs index 73aa90c..b66ff55 100644 --- a/System/FilePath/Find.hs +++ b/System/FilePath/Find.hs @@ -1,4 +1,5 @@ -{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE GeneralizedNewtypeDeriving, ScopedTypeVariables #-} +{-# OPTIONS_GHC -fno-warn-orphans #-} -- | -- Module: System.FilePath.Find @@ -110,6 +111,7 @@ module System.FilePath.Find ( , (||?) ) where +import Control.Exception import Control.Monad (foldM, forM, liftM, liftM2) import Control.Monad.State (State(..), evalState) import Data.Bits (Bits, (.&.)) @@ -119,9 +121,9 @@ import System.FilePath ((), takeDirectory, takeExtension, takeFileName) import System.FilePath.GlobPattern (GlobPattern, (~~), (/~)) import System.IO (hPutStrLn, stderr) import System.IO.Unsafe (unsafeInterleaveIO, unsafePerformIO) -import qualified System.FilePath.Error as E -import qualified System.Posix.Files as F -import qualified System.Posix.Types as T +import qualified System.PosixCompat.Files as F +import qualified System.PosixCompat.Types as T +import Prelude hiding (catch) -- | Information collected during the traversal of a directory. data FileInfo = FileInfo @@ -210,27 +212,27 @@ getDirContents dir = (sort . filter goodName) `liftM` getDirectoryContents dir -- matching the given 'FilterPredicate'. Any errors that occur are -- dealt with by the given handler. findWithHandler :: - (FilePath -> E.Exception -> IO [FilePath]) -- ^ error handler + (FilePath -> IOException -> IO [FilePath]) -- ^ error handler -> RecursionPredicate -- ^ control recursion into subdirectories -> FilterPredicate -- ^ decide whether a file appears in the result -> FilePath -- ^ directory to start searching -> IO [FilePath] -- ^ files that matched the 'FilterPredicate' -findWithHandler errHandler recurse filter path = - E.handle (errHandler path) $ F.getSymbolicLinkStatus path >>= visit path 0 +findWithHandler errHandler recurse filt path0 = + handle (errHandler path0) $ F.getSymbolicLinkStatus path0 >>= visit path0 0 where visit path depth st = if F.isDirectory st && evalFI recurse path depth st then unsafeInterleaveIO (traverse path (succ depth) st) else filterPath path depth st [] traverse dir depth dirSt = do - names <- E.catch (getDirContents dir) (errHandler dir) + names <- catch (getDirContents dir) (errHandler dir) filteredPaths <- forM names $ \name -> do let path = dir name - unsafeInterleaveIO $ E.handle (errHandler path) + unsafeInterleaveIO $ handle (errHandler path) (F.getSymbolicLinkStatus path >>= visit path depth) filterPath dir depth dirSt (concat filteredPaths) filterPath path depth st result = - return $ if evalFI filter path depth st + return $ if evalFI filt path depth st then path:result else result @@ -255,7 +257,7 @@ find = findWithHandler warnOnError -- right-to-left fold, use 'foldr' on the result of 'findWithHandler' -- instead. foldWithHandler - :: (FilePath -> a -> E.Exception -> IO a) -- ^ error handler + :: (FilePath -> a -> IOException -> IO a) -- ^ error handler -> RecursionPredicate -- ^ control recursion into subdirectories -> (a -> FileInfo -> a) -- ^ function to fold with -> a -- ^ seed value for fold @@ -263,18 +265,18 @@ foldWithHandler -> IO a -- ^ final value after folding foldWithHandler errHandler recurse f state path = - E.handle (errHandler path state) $ + handle (errHandler path state) $ F.getSymbolicLinkStatus path >>= visit state path 0 where visit state path depth st = if F.isDirectory st && evalFI recurse path depth st then traverse state path (succ depth) st else let state' = f state (mkFI path depth st) in state' `seq` return state' - traverse state dir depth dirSt = E.handle (errHandler dir state) $ + traverse state dir depth dirSt = handle (errHandler dir state) $ getDirContents dir >>= let state' = f state (mkFI dir depth dirSt) in state' `seq` flip foldM state' (\state name -> - E.handle (errHandler dir state) $ + handle (errHandler dir state) $ let path = dir name in F.getSymbolicLinkStatus path >>= visit state path depth) @@ -351,7 +353,7 @@ withLink f = do path <- filePath st <- fileStatus return $ if F.isSymbolicLink st - then unsafePerformIO $ E.handle (const (return Nothing)) $ + then unsafePerformIO $ handle (\(_::IOException) -> return Nothing) $ Just `liftM` f path else Nothing @@ -475,7 +477,7 @@ contains :: FilePath -> FindClause Bool contains p = do d <- filePath return $ unsafePerformIO $ - E.handle (const (return False)) $ + handle (\(_::IOException) -> return False) $ F.getFileStatus (d p) >> return True -- | Lift a binary operator into the 'FindClause' monad, so that it diff --git a/System/FilePath/Glob.hs b/System/FilePath/Glob.hs index 0164608..1a31c63 100644 --- a/System/FilePath/Glob.hs +++ b/System/FilePath/Glob.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE ScopedTypeVariables #-} -- | -- Module: System.FilePath.Glob -- Copyright: Bryan O'Sullivan @@ -10,6 +11,7 @@ module System.FilePath.Glob ( namesMatching ) where +import Control.Exception import Control.Monad (forM) import System.FilePath.GlobPattern ((~~)) import System.Directory (doesDirectoryExist, doesFileExist, @@ -17,8 +19,6 @@ import System.Directory (doesDirectoryExist, doesFileExist, import System.FilePath (dropTrailingPathSeparator, splitFileName, ()) import System.IO.Unsafe (unsafeInterleaveIO) -import System.FilePath.Error (handle) - -- | Return a list of names matching a glob pattern. The list is -- generated lazily. namesMatching :: String -> IO [FilePath] @@ -49,7 +49,7 @@ listMatches dirName pat = do dirName' <- if null dirName then getCurrentDirectory else return dirName - names <- unsafeInterleaveIO (handle (const (return [])) $ + names <- unsafeInterleaveIO (handle (\(_::IOException) -> return []) $ getDirectoryContents dirName') let names' = if isHidden pat then filter isHidden names diff --git a/System/FilePath/Manip.hs b/System/FilePath/Manip.hs index 2dad4a9..a8019c0 100644 --- a/System/FilePath/Manip.hs +++ b/System/FilePath/Manip.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-} +{-# LANGUAGE FlexibleInstances, ScopedTypeVariables, TypeSynonymInstances #-} -- | -- Module: System.FilePath.Manip @@ -16,8 +16,7 @@ module System.FilePath.Manip ( , modifyInPlace ) where -import System.FilePath.Error (bracket, bracket_, handle, throwIO) - +import Control.Exception import Control.Monad (liftM) import Data.Bits ((.&.)) import System.Directory (removeFile) @@ -104,11 +103,11 @@ modifyWith after transform path = bracket (openFile path ReadMode) hClose $ \ih -> do (tmpPath, oh) <- mkstemp (path ++ "XXXXXX") let ignore = return () - nukeTmp = handle (const ignore) (removeFile tmpPath) - handle (\e -> nukeTmp >> throwIO e) $ do + nukeTmp = handle (\(_::IOException) -> ignore) (removeFile tmpPath) + handle (\(e::IOException) -> nukeTmp >> throw e) $ do bracket_ ignore (hClose oh) $ readAll ih >>= return . transform >>= writeAll oh - handle (const nukeTmp) $ do + handle (\(_::IOException) -> nukeTmp) $ do mode <- fileMode `liftM` getFileStatus path setFileMode tmpPath (mode .&. 0777) after path tmpPath diff --git a/filemanip.cabal b/filemanip.cabal index 64ed0cf..481eb65 100644 --- a/filemanip.cabal +++ b/filemanip.cabal @@ -1,5 +1,5 @@ Name: filemanip -Version: 0.4.0.0 +Version: 0.3.5.0 License: BSD3 License-File: LICENSE Author: Bryan O'Sullivan @@ -15,12 +15,16 @@ Build-type: Simple Extra-Source-Files: README.markdown Library - + build-depends: base < 5, bytestring, directory, filepath, mtl, unix-compat + if !os(windows) + build-depends: unix + if impl(ghc >= 6.10) + build-depends: + base >= 4 + GHC-Options: -Wall Exposed-Modules: System.FilePath.Find, System.FilePath.Glob, System.FilePath.GlobPattern, System.FilePath.Manip - Other-Modules: - System.FilePath.Error From 1d0ad34ff57f350d7749e392afe598ab6314b107 Mon Sep 17 00:00:00 2001 From: Bryan O'Sullivan Date: Sun, 10 Oct 2010 16:17:07 -0700 Subject: [PATCH 05/24] Added tag 0.3.5.0 for changeset 64cd3627a707 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index b94f031..070e7f6 100644 --- a/.hgtags +++ b/.hgtags @@ -1 +1,2 @@ f76fcbbbfead7acb4d8323fb230155f06d2aad5b 0.3.3 +64cd3627a7075b9d49ec0a0f4c8eca7f72588015 0.3.5.0 From 5ce500b6ec78e7ee8597565abf9ea96e84645521 Mon Sep 17 00:00:00 2001 From: Bryan O'Sullivan Date: Mon, 1 Nov 2010 21:21:12 -0700 Subject: [PATCH 06/24] Fix dependency on mtl --- filemanip.cabal | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/filemanip.cabal b/filemanip.cabal index 481eb65..7fb9bcb 100644 --- a/filemanip.cabal +++ b/filemanip.cabal @@ -1,5 +1,5 @@ Name: filemanip -Version: 0.3.5.0 +Version: 0.3.5.1 License: BSD3 License-File: LICENSE Author: Bryan O'Sullivan @@ -15,7 +15,7 @@ Build-type: Simple Extra-Source-Files: README.markdown Library - build-depends: base < 5, bytestring, directory, filepath, mtl, unix-compat + build-depends: base < 5, bytestring, directory, filepath, mtl == 1.1.*, unix-compat if !os(windows) build-depends: unix if impl(ghc >= 6.10) From d9162f14f8a92d56cb3c6830a74d14600dc5b6e0 Mon Sep 17 00:00:00 2001 From: Bryan O'Sullivan Date: Mon, 1 Nov 2010 21:21:43 -0700 Subject: [PATCH 07/24] Added tag 0.3.5.1 for changeset 072c321a639d --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 070e7f6..88473c5 100644 --- a/.hgtags +++ b/.hgtags @@ -1,2 +1,3 @@ f76fcbbbfead7acb4d8323fb230155f06d2aad5b 0.3.3 64cd3627a7075b9d49ec0a0f4c8eca7f72588015 0.3.5.0 +072c321a639de2c184f4c14337d8e817ab459873 0.3.5.1 From 39fb1fd3cc248265dc3b12bf99b5f91e924517e4 Mon Sep 17 00:00:00 2001 From: Bryan O'Sullivan Date: Tue, 8 Feb 2011 13:44:01 -0800 Subject: [PATCH 08/24] Get working with newer mtl (and GHC 7) --- System/FilePath/Find.hs | 7 ++----- filemanip.cabal | 12 ++++++++++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/System/FilePath/Find.hs b/System/FilePath/Find.hs index b66ff55..0f7244d 100644 --- a/System/FilePath/Find.hs +++ b/System/FilePath/Find.hs @@ -113,7 +113,7 @@ module System.FilePath.Find ( import Control.Exception import Control.Monad (foldM, forM, liftM, liftM2) -import Control.Monad.State (State(..), evalState) +import Control.Monad.State (State, evalState, get) import Data.Bits (Bits, (.&.)) import Data.List (sort) import System.Directory (getDirectoryContents) @@ -172,13 +172,10 @@ evalFI :: FindClause a -> a evalFI m p d s = evalClause m (mkFI p d s) -mkFindClause :: (FileInfo -> (a, FileInfo)) -> FindClause a -mkFindClause = FC . State - -- | Return the current 'FileInfo'. fileInfo :: FindClause FileInfo -fileInfo = mkFindClause $ \st -> (st, st) +fileInfo = FC $ get -- | Return the name of the file being visited. filePath :: FindClause FilePath diff --git a/filemanip.cabal b/filemanip.cabal index 7fb9bcb..0898903 100644 --- a/filemanip.cabal +++ b/filemanip.cabal @@ -1,5 +1,5 @@ Name: filemanip -Version: 0.3.5.1 +Version: 0.3.5.2 License: BSD3 License-File: LICENSE Author: Bryan O'Sullivan @@ -15,7 +15,7 @@ Build-type: Simple Extra-Source-Files: README.markdown Library - build-depends: base < 5, bytestring, directory, filepath, mtl == 1.1.*, unix-compat + build-depends: base < 5, bytestring, directory, filepath, mtl, unix-compat if !os(windows) build-depends: unix if impl(ghc >= 6.10) @@ -28,3 +28,11 @@ Library System.FilePath.Glob, System.FilePath.GlobPattern, System.FilePath.Manip + +source-repository head + type: mercurial + location: http://bitbucket.org/bos/filemanip + +source-repository head + type: git + location: http://github.com/bos/filemanip From e9737bb26a8d66a3a5445aa90c122996ddd3ed2b Mon Sep 17 00:00:00 2001 From: Bryan O'Sullivan Date: Tue, 8 Feb 2011 13:46:06 -0800 Subject: [PATCH 09/24] Add bug report and homepage links --- filemanip.cabal | 2 ++ 1 file changed, 2 insertions(+) diff --git a/filemanip.cabal b/filemanip.cabal index 0898903..f2aa94f 100644 --- a/filemanip.cabal +++ b/filemanip.cabal @@ -4,6 +4,8 @@ License: BSD3 License-File: LICENSE Author: Bryan O'Sullivan Maintainer: Bryan O'Sullivan +Homepage: http://bitbucket.org/bos/filemanip +Bug-reports: http://bitbucket.org/bos/filemanip/issues Synopsis: Expressive file and directory manipulation for Haskell. Category: System Description: A Haskell library for working with files and directories. From d4e83187d9c5d32cdee7edfc5d8fb34f527e1250 Mon Sep 17 00:00:00 2001 From: Bryan O'Sullivan Date: Tue, 8 Feb 2011 13:46:09 -0800 Subject: [PATCH 10/24] Added tag 0.3.5.2 for changeset 26a8ade60b05 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 88473c5..90cbbcd 100644 --- a/.hgtags +++ b/.hgtags @@ -1,3 +1,4 @@ f76fcbbbfead7acb4d8323fb230155f06d2aad5b 0.3.3 64cd3627a7075b9d49ec0a0f4c8eca7f72588015 0.3.5.0 072c321a639de2c184f4c14337d8e817ab459873 0.3.5.1 +26a8ade60b05e19a8a169aaddd4f06ec029247c6 0.3.5.2 From e5c916fbc76f12197abb95a8a429b6a65ed34cf0 Mon Sep 17 00:00:00 2001 From: Jacob Stanley Date: Mon, 7 Nov 2011 10:16:43 +0800 Subject: [PATCH 11/24] Use System.PosixCompat instead of System.Posix This uses the unix-compat wrappers instead of unix directly so that the functionality can be emulated on Windows. --- System/FilePath/Manip.hs | 4 ++-- filemanip.cabal | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/System/FilePath/Manip.hs b/System/FilePath/Manip.hs index a8019c0..82c601b 100644 --- a/System/FilePath/Manip.hs +++ b/System/FilePath/Manip.hs @@ -21,8 +21,8 @@ import Control.Monad (liftM) import Data.Bits ((.&.)) import System.Directory (removeFile) import System.IO (Handle, IOMode(..), hClose, openFile) -import System.Posix.Files (fileMode, getFileStatus, rename, setFileMode) -import System.Posix.Temp (mkstemp) +import System.PosixCompat.Files (fileMode, getFileStatus, rename, setFileMode) +import System.PosixCompat.Temp (mkstemp) import qualified Data.ByteString.Char8 as B import qualified Data.ByteString.Lazy.Char8 as L import qualified System.IO as I diff --git a/filemanip.cabal b/filemanip.cabal index f2aa94f..bebefbf 100644 --- a/filemanip.cabal +++ b/filemanip.cabal @@ -18,8 +18,6 @@ Extra-Source-Files: README.markdown Library build-depends: base < 5, bytestring, directory, filepath, mtl, unix-compat - if !os(windows) - build-depends: unix if impl(ghc >= 6.10) build-depends: base >= 4 From db1abce8006de842668768220f8e3f7d35875d02 Mon Sep 17 00:00:00 2001 From: Bryan O'Sullivan Date: Sun, 13 Nov 2011 19:24:59 -0800 Subject: [PATCH 12/24] Update URLs --- README.markdown | 12 ++++++------ filemanip.cabal | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.markdown b/README.markdown index f0e49fd..62ea015 100644 --- a/README.markdown +++ b/README.markdown @@ -7,16 +7,16 @@ matching, and manipulating files. # Get involved! Please report bugs via the -[bitbucket issue tracker](http://bitbucket.org/bos/attoparsec/filemanip). +[github issue tracker](https://github.com/bos/filemanip/issues). -Master [Mercurial repository](http://bitbucket.org/bos/filemanip): - -* `hg clone http://bitbucket.org/bos/filemanip` - -There's also a [git mirror](http://github.com/bos/filemanip): +Master [git repository](http://github.com/bos/filemanip): * `git clone git://github.com/bos/filemanip.git` +There's also a [Mercurial mirror](http://bitbucket.org/bos/filemanip): + +* `hg clone https://bitbucket.org/bos/filemanip` + (You can create and contribute changes using either Mercurial or git.) diff --git a/filemanip.cabal b/filemanip.cabal index f2aa94f..146b332 100644 --- a/filemanip.cabal +++ b/filemanip.cabal @@ -4,8 +4,8 @@ License: BSD3 License-File: LICENSE Author: Bryan O'Sullivan Maintainer: Bryan O'Sullivan -Homepage: http://bitbucket.org/bos/filemanip -Bug-reports: http://bitbucket.org/bos/filemanip/issues +Homepage: https://github.com/bos/filemanip +Bug-reports: https://github.com/bos/filemanip/issues Synopsis: Expressive file and directory manipulation for Haskell. Category: System Description: A Haskell library for working with files and directories. @@ -32,9 +32,9 @@ Library System.FilePath.Manip source-repository head - type: mercurial - location: http://bitbucket.org/bos/filemanip + type: git + location: git://github.com/bos/filemanip.git source-repository head - type: git - location: http://github.com/bos/filemanip + type: mercurial + location: https://bitbucket.org/bos/filemanip From 48e1cbb69bca71b4ddf9c4c08d48c7b2d4c9e986 Mon Sep 17 00:00:00 2001 From: Bryan O'Sullivan Date: Sun, 13 Nov 2011 19:36:48 -0800 Subject: [PATCH 13/24] Bump version to 0.3.6.0 --- filemanip.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/filemanip.cabal b/filemanip.cabal index fe6b825..9b600a9 100644 --- a/filemanip.cabal +++ b/filemanip.cabal @@ -1,5 +1,5 @@ Name: filemanip -Version: 0.3.5.2 +Version: 0.3.6.0 License: BSD3 License-File: LICENSE Author: Bryan O'Sullivan From 3d3f70619cfa3b86c46d4654b8a52749260faa97 Mon Sep 17 00:00:00 2001 From: Bryan O'Sullivan Date: Sun, 13 Nov 2011 19:36:56 -0800 Subject: [PATCH 14/24] Added tag 0.3.6.0 for changeset ffce91ed40c6 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 90cbbcd..c33827e 100644 --- a/.hgtags +++ b/.hgtags @@ -2,3 +2,4 @@ f76fcbbbfead7acb4d8323fb230155f06d2aad5b 0.3.3 64cd3627a7075b9d49ec0a0f4c8eca7f72588015 0.3.5.0 072c321a639de2c184f4c14337d8e817ab459873 0.3.5.1 26a8ade60b05e19a8a169aaddd4f06ec029247c6 0.3.5.2 +ffce91ed40c677b6f3bfede29542db7995f25b1b 0.3.6.0 From 59fafe0596ef4cdc26a9baf3d794ec3e507f6ced Mon Sep 17 00:00:00 2001 From: Erik Hesselink Date: Tue, 17 Apr 2012 14:02:05 +0200 Subject: [PATCH 15/24] Remove infinite loop on MatchGroup without common prefix. In that case, the exact same MatchGroup would be fed to simplifyTerms again. Now, it is returned immediately, and only the rest of the terms are simplified. --- System/FilePath/GlobPattern.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/System/FilePath/GlobPattern.hs b/System/FilePath/GlobPattern.hs index 7299de0..91b1f09 100644 --- a/System/FilePath/GlobPattern.hs +++ b/System/FilePath/GlobPattern.hs @@ -117,8 +117,9 @@ simplifyTerms (MatchClass True (SRange a@[_] []):as) = simplifyTerms (MatchGroup []:as) = simplifyTerms as simplifyTerms (MatchGroup gs:as) = case commonPrefix gs of - (p,[]) -> simplifyTerms (MatchLiteral p : as) - (p,ss) -> simplifyTerms (MatchLiteral p : MatchGroup ss : as) + (p ,[]) -> simplifyTerms (MatchLiteral p : as) + ("",ss) -> MatchGroup ss : simplifyTerms as + (p ,ss) -> simplifyTerms (MatchLiteral p : MatchGroup ss : as) simplifyTerms (a:as) = a:simplifyTerms as commonPrefix :: [String] -> (String, [String]) From 9fd07bfa9b6321743199e44d6e7df5e765d21045 Mon Sep 17 00:00:00 2001 From: Erik Hesselink Date: Tue, 17 Apr 2012 15:33:44 +0200 Subject: [PATCH 16/24] Fixed matching of groups. Matching of the tail of all groups would continue if any matched, leading to (aa|bb) matching the string ab. Also, any empty group would mean continuing to match the rest of the terms, ignoring a non-empty matching group. This lead to (aa|a) not matching the string a. --- System/FilePath/GlobPattern.hs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/System/FilePath/GlobPattern.hs b/System/FilePath/GlobPattern.hs index 91b1f09..37af02a 100644 --- a/System/FilePath/GlobPattern.hs +++ b/System/FilePath/GlobPattern.hs @@ -15,6 +15,7 @@ module System.FilePath.GlobPattern ( ) where import Control.Arrow (second) +import Control.Monad (msum) import Data.Ix (Ix, inRange) import Data.List (nub) import Data.Maybe (isJust) @@ -144,11 +145,8 @@ matchTerms (MatchClass k c:ts) cs = matchClass cs >>= matchTerms ts where matchClass (b:bs) | (inClass && k) || not (inClass || k) = return bs where inClass = b `inSRange` c matchClass _ = fail "no match" -matchTerms (MatchGroup g:ts) cs = matchGroup g cs >>= matchTerms ts - where matchGroup g' as | any null g' = return as - matchGroup g' (a:as) | a `elem` map head g' = - matchGroup (map tail g') as - matchGroup _ _ = fail "not in group" +matchTerms (MatchGroup g:ts) cs = msum (map matchGroup g) + where matchGroup g = matchTerms (MatchLiteral g : ts) cs matchTerms [MatchAny] _ = return () matchTerms (MatchAny:ts) cs = matchAny cs >>= matchTerms ts where matchAny [] = fail "no match" From b2c11abf31b532da3074346aa15e56e96a87cd2b Mon Sep 17 00:00:00 2001 From: Erik Hesselink Date: Tue, 17 Apr 2012 14:06:52 +0200 Subject: [PATCH 17/24] Bump version to 0.3.6.1. --- filemanip.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/filemanip.cabal b/filemanip.cabal index 9b600a9..6403417 100644 --- a/filemanip.cabal +++ b/filemanip.cabal @@ -1,5 +1,5 @@ Name: filemanip -Version: 0.3.6.0 +Version: 0.3.6.1 License: BSD3 License-File: LICENSE Author: Bryan O'Sullivan From cc78a3c212ea5a0708aec16fb40b502491f0e686 Mon Sep 17 00:00:00 2001 From: Bryan O'Sullivan Date: Wed, 29 Aug 2012 20:12:51 -0700 Subject: [PATCH 18/24] Fix GHC 7.6 build problems --- System/FilePath/Find.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/System/FilePath/Find.hs b/System/FilePath/Find.hs index 0f7244d..2af3bd6 100644 --- a/System/FilePath/Find.hs +++ b/System/FilePath/Find.hs @@ -111,7 +111,8 @@ module System.FilePath.Find ( , (||?) ) where -import Control.Exception +import qualified Control.Exception as E +import Control.Exception (IOException, handle) import Control.Monad (foldM, forM, liftM, liftM2) import Control.Monad.State (State, evalState, get) import Data.Bits (Bits, (.&.)) @@ -123,7 +124,6 @@ import System.IO (hPutStrLn, stderr) import System.IO.Unsafe (unsafeInterleaveIO, unsafePerformIO) import qualified System.PosixCompat.Files as F import qualified System.PosixCompat.Types as T -import Prelude hiding (catch) -- | Information collected during the traversal of a directory. data FileInfo = FileInfo @@ -222,7 +222,7 @@ findWithHandler errHandler recurse filt path0 = then unsafeInterleaveIO (traverse path (succ depth) st) else filterPath path depth st [] traverse dir depth dirSt = do - names <- catch (getDirContents dir) (errHandler dir) + names <- E.catch (getDirContents dir) (errHandler dir) filteredPaths <- forM names $ \name -> do let path = dir name unsafeInterleaveIO $ handle (errHandler path) From 50bdd9d0b4d09394d0d11120e7c1651ffcf4c5a1 Mon Sep 17 00:00:00 2001 From: Bryan O'Sullivan Date: Wed, 29 Aug 2012 20:13:11 -0700 Subject: [PATCH 19/24] Bump version to 0.3.6.1 --- filemanip.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/filemanip.cabal b/filemanip.cabal index 9b600a9..6403417 100644 --- a/filemanip.cabal +++ b/filemanip.cabal @@ -1,5 +1,5 @@ Name: filemanip -Version: 0.3.6.0 +Version: 0.3.6.1 License: BSD3 License-File: LICENSE Author: Bryan O'Sullivan From 02ed4670d8fb0c22ddc4731dd620747ca8bf8446 Mon Sep 17 00:00:00 2001 From: Bryan O'Sullivan Date: Wed, 29 Aug 2012 20:13:15 -0700 Subject: [PATCH 20/24] Added tag 0.3.6.1 for changeset 4c6a1170cb18 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index c33827e..280e3d0 100644 --- a/.hgtags +++ b/.hgtags @@ -3,3 +3,4 @@ f76fcbbbfead7acb4d8323fb230155f06d2aad5b 0.3.3 072c321a639de2c184f4c14337d8e817ab459873 0.3.5.1 26a8ade60b05e19a8a169aaddd4f06ec029247c6 0.3.5.2 ffce91ed40c677b6f3bfede29542db7995f25b1b 0.3.6.0 +4c6a1170cb189038b63d9f7e1e7e43aa1aa372f2 0.3.6.1 From e4df8a7c5325e0037dea93cca7e52b30544fbf51 Mon Sep 17 00:00:00 2001 From: Bryan O'Sullivan Date: Sun, 9 Sep 2012 00:05:32 -0700 Subject: [PATCH 21/24] Bump version to 0.3.6.2 --- filemanip.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/filemanip.cabal b/filemanip.cabal index 6403417..3d53e8f 100644 --- a/filemanip.cabal +++ b/filemanip.cabal @@ -1,5 +1,5 @@ Name: filemanip -Version: 0.3.6.1 +Version: 0.3.6.2 License: BSD3 License-File: LICENSE Author: Bryan O'Sullivan From 843e426a2efc142bd841fb187bcac79c5969add7 Mon Sep 17 00:00:00 2001 From: Bryan O'Sullivan Date: Sun, 9 Sep 2012 00:05:36 -0700 Subject: [PATCH 22/24] Added tag 0.3.6.2 for changeset 72891e0e9706 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 280e3d0..8aeff47 100644 --- a/.hgtags +++ b/.hgtags @@ -4,3 +4,4 @@ f76fcbbbfead7acb4d8323fb230155f06d2aad5b 0.3.3 26a8ade60b05e19a8a169aaddd4f06ec029247c6 0.3.5.2 ffce91ed40c677b6f3bfede29542db7995f25b1b 0.3.6.0 4c6a1170cb189038b63d9f7e1e7e43aa1aa372f2 0.3.6.1 +72891e0e97065c6ec6753cc44618d36a0ea7f5de 0.3.6.2 From ca9a53c61519489d11a2860019cccdc2719ec710 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Sicard-Ram=C3=ADrez?= Date: Thu, 12 Jun 2014 14:48:38 -0500 Subject: [PATCH 23/24] Fixed documentation in Find.hs --- System/FilePath/Find.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/System/FilePath/Find.hs b/System/FilePath/Find.hs index 2af3bd6..73a93b3 100644 --- a/System/FilePath/Find.hs +++ b/System/FilePath/Find.hs @@ -29,7 +29,7 @@ -- Because 'FindClause' is a monad, you can use the usual monad -- machinery to, for example, lift pure functions into it. -- --- Here's a clause that will return 'False' for any file whose +-- Here's a clause that will return 'True' for any file whose -- directory name contains the word @\"temp\"@. -- -- @ From 43c4b2782ed4ade284a144047fe2a5af281e8f45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Sicard-Ram=C3=ADrez?= Date: Thu, 12 Jun 2014 17:47:35 -0500 Subject: [PATCH 24/24] Fixed buggy example noRCS --- examples/Simple.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/Simple.hs b/examples/Simple.hs index b49fc9c..850571f 100644 --- a/examples/Simple.hs +++ b/examples/Simple.hs @@ -33,7 +33,7 @@ renameCppToC path = find always (extension ==? ".cpp") path >>= noRCS :: RecursionPredicate -noRCS = (`elem` ["_darcs","SCCS","CVS",".svn",".hg",".git"]) `liftM` fileName +noRCS = (`notElem` ["_darcs","SCCS","CVS",".svn",".hg",".git"]) `liftM` fileName cSources :: FilePath -> IO [FilePath]