HsSVN 0.4.3 → 0.4.3.1
raw patch · 14 files changed
+172/−92 lines, 14 filesdep ~basedep ~bytestringdep ~mtl
Dependency ranges changed: base, bytestring, mtl, stm
Files
- HsSVN.cabal +9/−5
- INSTALL +54/−0
- NEWS +12/−0
- Subversion.hsc +3/−3
- Subversion/Config.hsc +2/−2
- Subversion/Error.hsc +1/−1
- Subversion/FileSystem.hsc +24/−26
- Subversion/FileSystem/PathChange.hsc +6/−6
- Subversion/FileSystem/Revision.hsc +12/−11
- Subversion/FileSystem/Root.hsc +5/−5
- Subversion/FileSystem/Transaction.hsc +9/−9
- Subversion/Repository.hsc +11/−12
- Subversion/Types.hsc +1/−1
- configure.ac +23/−11
HsSVN.cabal view
@@ -1,10 +1,10 @@ Name: HsSVN-Synopsis: (Part of) Subversion binding for Haskell+Synopsis: Partial Subversion (SVN) binding for Haskell Description:- HsSVN is a (part of) Subversion binding for Haskell. Currently it+ HsSVN is a partial Subversion (SVN) binding for Haskell. Currently it can do most things related to the Subversion FS but others are left uncovered.-Version: 0.4.3+Version: 0.4.3.1 License: PublicDomain License-File: COPYING Author: PHO <pho at cielonegro dot org>@@ -12,11 +12,12 @@ Stability: experimental Homepage: http://cielonegro.org/HsSVN.html Category: System-Tested-With: GHC == 6.8.1+Tested-With: GHC == 6.12.1 Cabal-Version: >= 1.6 Build-Type: Configure Extra-Source-Files: HsSVN.buildinfo.in+ INSTALL NEWS cbits/HsSVN.h configure@@ -30,7 +31,10 @@ Library Build-Depends:- base >= 4 && < 5, bytestring, mtl, stm+ base == 4.2.*,+ bytestring == 0.9.*,+ mtl == 1.1.*,+ stm == 2.1.* Exposed-Modules: Subversion Subversion.Config
+ INSTALL view
@@ -0,0 +1,54 @@+.. -*- rst -*-++====================+How to install HsSVN+====================++HsSVN's installation steps are quite irregular, due to libsvn's nature+of library user unfriendliness.+++Required external libraries+---------------------------++* `apr <http://apr.apache.org/>`_ >= 1.3+* `apr-util <http://apr.apache.org/>`_ >= 1.3+* `subversion <http://subversion.apache.org/>`_ >= 1.6+++Building HsSVN+--------------++You have to first figure out where SVN's header files are installed.+In this document we assume they are in ``/usr/local`` like this::++ /usr/local/bin/apr-1-config+ /usr/local/bin/apu-1-config+ /usr/local/bin/svn+ /usr/local/bin/svnadmin+ ...+ /usr/local/include/apr-1/apr.h+ ...+ /usr/local/include/subversion-1/svn_auth.h+ /usr/local/include/subversion-1/svn_base64.h+ /usr/local/include/subversion-1/svn_checksum.h+ ...+ /usr/local/lib/libsvn_client-1.la+ /usr/local/lib/libsvn_client-1.a+ /usr/local/lib/libsvn_client-1.so+ /usr/local/lib/libsvn_client-1.so.0+ /usr/local/lib/libsvn_client-1.so.0.0.0+ /usr/local/lib/libsvn_delta-1.la+ /usr/local/lib/libsvn_delta-1.a+ /usr/local/lib/libsvn_delta-1.so+ /usr/local/lib/libsvn_delta-1.so.0+ /usr/local/lib/libsvn_delta-1.so.0.0.0+ ...++Then pass those paths to the ./Setup.hs script like this::++ % env EXTRA_CPPFLAGS="-I/usr/local/include/subversion-1" \+ EXTRA_LDFLAGS="-L/usr/local/lib" \+ runhaskell Setup.hs configure+ % runhaskell Setup.hs build+ % runhaskell Setup.hs install
NEWS view
@@ -1,3 +1,15 @@+Changes from 0.4.3 to 0.4.3.1+-----------------------------+* INSTALL:+ - New file that describes how to build this abnormal package which+ everyone fails to build. Believe me. It's Subversion's fault. It+ offers no svn-config, no subversion.pc, and no subversion.m4.++* configure: a small bugfix++* Brushed up my poor English documentation.+ + Changes from 0.4.2 to 0.4.3 --------------------------- * Fixed a serious bug which leads to segmentation fault at
Subversion.hsc view
@@ -1,8 +1,8 @@ {- -*- haskell -*- -} --- |HsSVN is a (part of) Subversion binding for Haskell. Currently it--- can do most things related to the Subversion FS but others are left--- uncoverd.+-- |HsSVN is a partial Subversion (SVN) binding for Haskell. Currently+-- it can do most things related to the Subversion FS but others are+-- left uncoverd. -- -- If you find out any features you want aren't supported, you must -- write your own patch (or take over the HsSVN project). Happy
Subversion/Config.hsc view
@@ -2,8 +2,8 @@ -- |An interface to client configuration files (svn_config.h). ----- As you see, this module is totally incomplete. If you need this,--- you must write a patch.+-- As you see, this module is totally a stub. If you need this, you+-- must write a patch. module Subversion.Config ( Config
Subversion/Error.hsc view
@@ -114,7 +114,7 @@ -- appropriate 'SvnErrCode' constructors -- because they may be added in the future -- version of HsSVN. If that happens to you,- -- your code stops working.+ -- your code will stop working. deriving (Show, Eq, Typeable) statusToErrCode :: APR_STATUS_T -> SvnErrCode
Subversion/FileSystem.hsc view
@@ -91,12 +91,12 @@ touchFS :: FileSystem -> IO () touchFS (FileSystem fs) = touchForeignPtr fs --- |@fsVersion@ returns a version information of the libsvn_fs.+-- |@fsVersion@ returns the version number of the libsvn_fs. fsVersion :: IO Version fsVersion = _version >>= peekVersion --- |@'fsConfigFSType'@ is a config key to specify the filesystem+-- |@'fsConfigFSType'@ is a config key to choose a filesystem -- back-end. fsConfigFSType :: String fsConfigFSType = #const_str SVN_FS_CONFIG_FS_TYPE@@ -112,8 +112,8 @@ fsTypeFSFS = #const_str SVN_FS_TYPE_FSFS -- |@'createFileSystem'@ creates a new, empty Subversion--- filesystem. Note that creating a raw filesystem is different from--- creating a repository. If you want a new repository, use+-- filesystem. Note that creating a raw filesystem and creating a+-- repository is not the same thing. If you want a new repository, use -- 'Subversion.Repository.createRepository' instead. createFileSystem :: FilePath -- ^ Where to create the filesystem. The@@ -122,28 +122,27 @@ -> [(String, String)] -- ^ A list of @(key, value)@ tuples which -- modifies the behavior of the -- filesystem. The interpretation of it is- -- specific to the filesystem back-end.+ -- up to the filesystem back-end. -- -- If the list contains a value for -- 'fsConfigFSType', that value determines -- the filesystem type for the new- -- filesystem. Currently defined values- -- are:+ -- filesystem. These values are currently+ -- defined: -- -- ['fsTypeBDB'] Berkeley-DB implementation -- -- ['fsTypeFSFS'] Native-filesystem -- implementation --- -- If the list does not contain a value- -- for 'fsConfigFSType' then the default+ -- If the list does not contain+ -- 'fsConfigFSType' then the default -- filesystem type will be used. This will -- typically be BDB for version 1.1 and- -- FSFS for later versions, though the- -- caller should not rely upon any- -- particular default if they wish to- -- ensure that a filesystem of specific- -- type is created.+ -- FSFS for later versions, though you+ -- should not rely upon any particular+ -- default value if you want a filesystem+ -- of specific type. -> IO FileSystem -- ^ The new filesystem. createFileSystem path configPairs = do pool <- newPool@@ -169,7 +168,7 @@ -> [(String, String)] -- ^ A list of @(key, value)@ tuples which -- modifies the behavior of the -- filesystem. The interpretation of it is- -- specific to the filesystem back-end.+ -- up to the filesystem back-end. -> IO FileSystem openFileSystem path configPairs = do pool <- newPool@@ -201,13 +200,13 @@ -- from one location to another. hotCopyFileSystem :: FilePath -- ^ Source -> FilePath -- ^ Destination- -> Bool -- ^ If this is true,- -- @'hotCopyFileSystem'@ performs- -- cleanup on the source filesystem as- -- part of the copy opeation;- -- currently, this means deleting- -- copied, unused logfiles for a- -- Berkeley DB source filesystem.+ -> Bool -- ^ If 'True', @'hotCopyFileSystem'@+ -- performs cleanup on the source+ -- filesystem as part of the copy+ -- opeation; currently, this means+ -- deleting copied, unused logfiles+ -- for a Berkeley DB source+ -- filesystem. -> IO () hotCopyFileSystem src dest clean = do pool <- newPool@@ -236,7 +235,7 @@ -- |@'getFileSystemPath' fs@ returns the path to @fs@'s -- repository. Note that this is what was passed to 'createFileSystem'--- or 'openFileSystem'; might be absolute, might not.+-- or 'openFileSystem'; might be absolute, might be not. getFileSystemPath :: FileSystem -> IO FilePath getFileSystemPath fs = do pool <- newPool@@ -246,9 +245,8 @@ touchPool pool return path --- |@'getYoungestRev' fs@ returns the number of the youngest revision--- in filesystem @fs@. The oldest revision in any filesystem is--- numbered zero.+-- |@'getYoungestRev' fs@ returns the youngest revision number in+-- filesystem @fs@. The revision number starts from zero. getYoungestRev :: FileSystem -> IO RevNum getYoungestRev fs = do pool <- newPool
Subversion/FileSystem/PathChange.hsc view
@@ -21,18 +21,18 @@ -- unavailable in this binding. Add one if you really need it. data PathChange = PathChange { pcChangeKind :: ChangeKind -- ^ Kind of change.- , pcTextMod :: Bool -- ^ Were there text modifications?- , pcPropMod :: Bool -- ^ Were there property modifications?+ , pcTextMod :: Bool -- ^ Was the content modified in any way?+ , pcPropMod :: Bool -- ^ Were there any properties modified? } deriving (Show, Eq) type SVN_FS_PATH_CHANGE_KIND_T = #type svn_fs_path_change_kind_t -- |The kind of change that occured on the path.-data ChangeKind = ModifiedPath -- ^ defalut value- | AddedPath -- ^ path added in txn- | DeletedPath -- ^ path removed in txn- | ReplacedPath -- ^ path removed and re-added in txn+data ChangeKind = ModifiedPath -- ^ Only modified.+ | AddedPath -- ^ The path was added in the txn.+ | DeletedPath -- ^ The path was removed in the txn.+ | ReplacedPath -- ^ The path was removed and re-added in the txn. deriving (Show, Eq)
Subversion/FileSystem/Revision.hsc view
@@ -43,12 +43,13 @@ {- Monad Rev ----------------------------------------------------------------- -} --- |@'Rev' a@ is a FS monad which reads data from an existing revision--- and finally returns @a@. See 'Subversion.FileSystem.Root.MonadFS'.+-- |@'Rev' a@ is a FS monad which reads some data from an existing+-- revision and finally returns @a@. See+-- 'Subversion.FileSystem.Root.MonadFS'. -- -- Since 'Rev' monad does no transactions, -- 'Subversion.FileSystem.Root.unsafeIOToFS' isn't really unsafe. You--- can do any I\/O actions in the monad if you wish.+-- can do any I\/O actions in a monadic computation if you wish. newtype Rev a = Rev { unRev :: ReaderT FileSystemRoot IO a } instance Functor Rev where@@ -152,7 +153,7 @@ revNum <- getRevisionNumber unsafeIOToFS $ getRevisionPropList' fs revNum --- |Return the entire property list of a revision.+-- |Return the entire property list of the given revision. getRevisionPropList' :: FileSystem -> RevNum -> IO [(String, String)] getRevisionPropList' fs revNum = do pool <- newPool@@ -169,7 +170,7 @@ -- properties are non-historied: you can change them after the -- revision has been comitted. They are not protected via -- transactions.-setRevisionProp :: FileSystem -- ^ The transaction+setRevisionProp :: FileSystem -- ^ The filesystem -> RevNum -- ^ The revision -> String -- ^ The property name -> Maybe String -- ^ The property value@@ -190,13 +191,13 @@ -- Revisions in the resulting list will be older than or the same age -- as the revision of that node in the target revision of 'Rev' -- monad. That is, if the 'Rev' monad is running on revision @X@, and--- the node was modified in some revisions younger than @X@, those--- revisions younger than @X@ will not be included in the list.+-- the node has been modified in some revisions younger than @X@,+-- those revisions younger than @X@ will not be included in the list. getNodeHistory- :: Bool -- ^ If this is true, stepping- -- backwards in history would cross- -- a copy operation. This is usually- -- the desired behavior.+ :: Bool -- ^ If 'True', stepping backwards in+ -- history would cross a copy+ -- operation. This is usually the+ -- desired behavior. -> FilePath -- ^ The path to node you want to read -- history. -> Rev [(RevNum, FilePath)] -- ^ A list of @(revNum, nodePath)@:
Subversion/FileSystem/Root.hsc view
@@ -188,14 +188,14 @@ -- does the operation /strictly/: I mean it loads the entire file onto -- the memory! This is because @svn_fs_file_contents()@ in the -- libsvn_fs doesn't guarantee, when we are in a transaction, that we--- can progressively read a file which is suddenly modified in the+-- can progressively read a file which was suddenly modified in the -- same transaction during the progressive reading. -- -- I think 'getFileContents' might have to return -- @['Data.Word.Word8']@ instead of 'Prelude.String' because every--- files in filesystem should be considered binary. Yes,+-- files in a filesystem should be considered binary. Yes, -- 'Prelude.readFile' also returns 'Prelude.String' but this is an--- immature part of Haskell. I wish someday the GHC gets more clear+-- immature part of Haskell. I wish someday Haskell gets more clear -- distinction between binary data and an Unicode string, then I -- change the form of 'getFileContents' alike. getFileContents :: MonadFS m => FilePath -> m String@@ -302,7 +302,7 @@ -- |@'isDirectory' path@ returns 'Prelude.True' iff the @path@ points -- to a directory in a revision or transaction. It returns--- 'Prelude.False' for inexistent path.+-- 'Prelude.False' for nonexistent paths. isDirectory :: MonadFS m => FilePath -> m Bool isDirectory path = do root <- getRoot@@ -316,7 +316,7 @@ -- |@'isFile' path@ returns 'Prelude.True' iff the @path@ points to a -- file in a revision or transaction. It returns 'Prelude.False' for--- inexistent path.+-- nonexistent paths. isFile :: MonadFS m => FilePath -> m Bool isFile path = do root <- getRoot
Subversion/FileSystem/Transaction.hsc view
@@ -241,13 +241,13 @@ :: FilePath -- ^ The file to be replaced. If it does not exist -- in the transaction, 'applyText' throws an -- error. That is, you can't use this action to- -- create new files; use 'makeFile' to create an- -- empty file first.+ -- create a new file; use 'makeFile' to create+ -- an empty file first. -> Maybe String -- ^ The hex MD5 digest for the new content. It is- -- ignored if 'Prelude.Nothing', but if not+ -- ignored if 'Prelude.Nothing'. But if it's not -- 'Prelude.Nothing', it must match the checksum- -- of the content; if it doesn't, 'applyText'- -- throws an error.+ -- of the content or 'applyText' throws an+ -- error. -> String -- ^ The new content. -- -- This argument is currently a 'Prelude.String'@@ -278,8 +278,8 @@ withCString' Nothing f = f nullPtr withCString' (Just str) f = withCString str f --- |@'makeFile' fpath@ creates a new file named @fpath@. The initial--- content of file is the empty string, and it has no properties.+-- |@'makeFile' fpath@ creates a new empty file named @fpath@. The+-- file is initially empty and has no properties. makeFile :: FilePath -> Txn () makeFile path = do root <- getRoot@@ -318,8 +318,8 @@ withPoolPtr pool $ \ poolPtr -> svnErr $ _delete rootPtr pathPtr poolPtr --- |@'copyEntry' fromRevNum fromPath toPath@ creates a copy of file--- @fromPath@ in a revision @fromRevNum@ named @toPath@ in the+-- |@'copyEntry' fromRevNum fromPath toPath@ creates a copy of the+-- file @fromPath@ in a revision @fromRevNum@ to @toPath@ in the -- transaction. copyEntry :: RevNum -> FilePath -> FilePath -> Txn () copyEntry fromRevNum fromPath toPath
Subversion/Repository.hsc view
@@ -111,8 +111,8 @@ do svnErr $ _open reposPtrPtr pathPtr poolPtr wrapRepos (touchPool pool) =<< peek reposPtrPtr --- |@'createRepository'@ creates a new Subversion repository, building--- the necessary directory structure, creating filesystem, and so on.+-- |@'createRepository'@ creates a new Subversion repository, builds a+-- necessary directory structure, creates a filesystem, and so on. createRepository :: FilePath -- ^ Where to create the repository. -> [(String, Config)] -- ^ A list of @(categoryName, config)@@@ -215,11 +215,10 @@ throwIO e -- |@'doReposTxn'@ tries to do the transaction. If it succeeds--- 'doReposTxn' automatically commits it, but if it throws an--- exception 'doReposTxn' automatically cancels it and rethrow the--- exception.+-- 'doReposTxn' automatically commits it. When it throws an exception,+-- 'doReposTxn' automatically cancels it and rethrows the exception. ----- Because conflicts tend to occur more frequently than other errors,+-- Since conflicts tend to occur more frequently than other errors, -- they aren't reported as an exception. doReposTxn :: Repository -- ^ The repository.@@ -231,11 +230,11 @@ -- transaction property. This value may be -- 'Prelude.Nothing' if the message is not yet -- available. The caller will need to attach one- -- to the transaction at a later time.+ -- to the transaction later. -> Txn () -- ^ The transaction to be done. -> IO (Either FilePath RevNum) -- ^ The result is whether -- @'Prelude.Left' conflictPath@- -- (if it conflicted) or+ -- (if it caused a conflict) or -- @'Prelude.Right' newRevNum@ (if -- it didn't). doReposTxn repos revNum author logMsg c@@ -257,8 +256,8 @@ commitTxn repos txn --- |Lazily dump the contents of the filesystem within already-open--- repository. Note that this action requires -threaded RTS.+-- |Lazily dump the contents of the filesystem associated with the+-- given repository. Note that this action requires -threaded RTS. dumpRepository :: Repository -- ^ The repository. -> Maybe RevNum -- ^ @'Prelude.Nothing'@ to start -- dumping at revision 0, or@@ -266,8 +265,8 @@ -- revision @x@. -> Maybe RevNum -- ^ @'Prelude.Nothing'@ to dump -- through the HEAD revision, or- -- @'Prelude.Just' x@ to dump up- -- through revision @x@.+ -- @'Prelude.Just' x@ to dump up to the+ -- revision @x@. -> Bool -- ^ If this is @'Prelude.True'@, the -- first revision dumped will be a diff -- against the previous revision
Subversion/Types.hsc view
@@ -72,7 +72,7 @@ unmarshalNodeKind (#const svn_node_dir ) = DirNode unmarshalNodeKind _ = undefined --- |@'Version'@ is version.+-- |@'Version'@ represents a version number. data Version = Version { verMajor :: Int -- ^ Major version number. , verMinor :: Int -- ^ Minor version number.
configure.ac view
@@ -8,6 +8,9 @@ # FIXME: we can get rid of these ugly checks when we got svn-config or # something alike. #+ac_old_CPPFLAGS="$CPPFLAGS"+ac_old_LDFLAGS="$LDFLAGS"+ AC_ARG_VAR([EXTRA_CPPFLAGS], [extra CPPFLAGS to find subversion]) AC_ARG_VAR([EXTRA_LDFLAGS], [extra LDFLAGS to find subversion]) CPPFLAGS="$EXTRA_CPPFLAGS $CPPFLAGS"@@ -18,17 +21,7 @@ AC_SUBST([SVN_CFLAGS]) AC_SUBST([SVN_LIBS]) -AC_CHECK_HEADERS(- [svn_error.h],- [],- [AC_MSG_ERROR([SVN headers are required. Hint: EXTRA_CPPFLAGS])])--AC_CHECK_LIB(- [svn_subr-1],- [svn_error_clear],- [],- [AC_MSG_ERROR([SVN libraries are required. Hint: EXTRA_LDFLAGS])])-+# apr AC_ARG_VAR([APR_CONFIG], [apr-config to use]) AC_CHECK_PROGS( [APR_CONFIG],@@ -37,6 +30,10 @@ SVN_CFLAGS=`$APR_CONFIG --includes --cppflags`" $SVN_CFLAGS" SVN_LIBS=`$APR_CONFIG --link-ld --libs`" $SVN_LIBS" +CPPFLAGS=`$APR_CONFIG --includes --cppflags`" $CPPFLAGS"+LDFLAGS=`$APR_CONFIG --link-ld --libs`" $LDFLAGS"++# apu AC_ARG_VAR([APU_CONFIG], [apu-config to use]) AC_CHECK_PROGS( [APU_CONFIG],@@ -44,6 +41,21 @@ [AC_MSG_ERROR([apu-config is required. Hint: APU_CONFIG])]) SVN_CFLAGS=`$APU_CONFIG --includes`" $SVN_CFLAGS" SVN_LIBS=`$APU_CONFIG --link-ld --libs`" $SVN_LIBS"++CPPFLAGS=`$APU_CONFIG --includes`" $CPPFLAGS"+LDFLAGS=`$APU_CONFIG --link-ld --libs`" $LDFLAGS"++# svn+AC_CHECK_HEADERS(+ [svn_error.h],+ [],+ [AC_MSG_ERROR([SVN headers are required. Hint: EXTRA_CPPFLAGS])])++AC_CHECK_LIB(+ [svn_subr-1],+ [svn_error_clear],+ [],+ [AC_MSG_ERROR([SVN libraries are required. Hint: EXTRA_LDFLAGS])]) # # Done the ugly checks #