darcs-monitor 0.3.8 → 0.4.0
raw patch · 6 files changed
+46/−16 lines, 6 files
Files
- ChangeLog +6/−0
- EmailPatch.hs +8/−5
- README +5/−4
- darcs-monitor.1 +12/−1
- darcs-monitor.cabal +4/−3
- darcs-monitor.hs +11/−3
ChangeLog view
@@ -1,3 +1,9 @@+0.4.0 (2010-09-08)++ * make it possible to use more than one email address as recipient.+ * update maintainer address+ * update darcs repository address+ 0.3.8 (2010-03-07) * Correct crash with GHC 6.12.1 because of malformed UTF-8 character
EmailPatch.hs view
@@ -1,6 +1,7 @@ {- darcs-monitor - Darcs repository monitor Copyright © 2007 Antti-Juhani Kaijanaho Copyright © 2007 Benjamin Franksen+ Copyright © 2010 Marco Túlio Gontijo e Silva <marcot@marcot.eti.br> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -19,6 +20,7 @@ module EmailPatch (emailPatch,defaultSendmail) where import Control.Monad.Trans+import Data.List import System.Directory import System.Exit import System.IO@@ -34,11 +36,11 @@ defaultSendmail = "/usr/sbin/sendmail" sendMail :: (MonadConfig m, MonadIO m) =>- String -> String -> m Bool+ [String] -> String -> m Bool sendMail recipient text = do sendmail <- asks confSendmailPath liftIO $ do (inh, outh, errh, ph) <-- runInteractiveProcess sendmail [recipient] Nothing Nothing+ runInteractiveProcess sendmail recipient Nothing Nothing hClose outh hPutStr inh text hClose inh@@ -48,7 +50,7 @@ return (ec == ExitSuccess) emailPatch :: (MonadConfig m, MonadIO m) =>- String -> PatchData -> m Bool+ [String] -> PatchData -> m Bool emailPatch rec pd = do diff <- invokeDarcs ["diff" ,"--match=hash " ++ patchHash pd@@ -79,7 +81,7 @@ else nhe s nhe = showString repl = case k of- "RECIPIENT" -> nhe rec+ "RECIPIENT" -> nhe recs "DIFF" -> he $ case maxDiff of Just md@@ -104,6 +106,7 @@ f hdr (c:r) = showChar c . f hdr r f _ [] = id text' = f True tmpl+ recs = concat $ intersperse ", " rec let text = case menc of Just enc -> showString "MIME-Version: 1.0\n\ \Content-Transfer-Encoding: 8bit\n\@@ -112,7 +115,7 @@ showChar '\n' . text' Nothing -> text'- liftIO $ putStrLn $ "Sending mail to " ++ rec ++ " about " ++ patchTitle pd+ liftIO $ putStrLn $ "Sending mail to " ++ recs ++ " about " ++ patchTitle pd sendMail rec (text "")
README view
@@ -39,13 +39,14 @@ create the file $REPO/_darcs/prefs/defaults with the following content: 8<-- cut here ---apply posthook darcs-monitor --charset=CHARSET email RECIPIENT+apply posthook darcs-monitor --charset=CHARSET email RECIPIENT [email RECIPIENT ...] apply run-posthook 8<-- cut here In the above, CHARSET should be the MIME charset that patches (including their metadata) are in, and RECIPIENT should be the email-address where emails should be sent. Also, if darcs-monitor is not+address where emails should be sent. You can specify more than one recipient+by repeating the email parameter. Also, if darcs-monitor is not installed in the default $PATH, you should specify th full path to the darcs-monitor binary. @@ -92,10 +93,10 @@ Feedback -Please send comments and bug reports to marcot@debian.org.+Please send comments and bug reports to marcot@marcot.eti.br. Any patches should be prepared with Darcs against the repository- http://people.debian.org/~marcot/darcs/darcs-monitor/+ http://marcot.eti.br/darcs/darcs-monitor/ and sent using "darcs send". Have fun,
darcs-monitor.1 view
@@ -25,6 +25,11 @@ .B email .I recipient [+.B email+.I recipient+\&...+]+[ .I repository \&... ]@@ -54,6 +59,11 @@ .BI \-\-charset= charset .B email .I recipient+[+.B email+.I recipient+\&...+] .br .B apply .B run\-posthook@@ -65,7 +75,8 @@ (including their metadata) are in, and .I recipient should be the email-address where emails should be sent. +address where emails should be sent. You can specify more than one recipient+by repeating the email parameter. .PP You can also run .B darcs\-monitor
darcs-monitor.cabal view
@@ -1,17 +1,18 @@ Cabal-Version: >= 1.2 Name: darcs-monitor-Version: 0.3.8+Version: 0.4.0 License: GPL License-File: GPL.txt Copyright: 2007 Antti-Juhani Kaijanaho 2007 Benja Fallenstein 2007 Benjamin Franksen+ 2010 Marco Túlio Gontijo e Silva <marcot@marcot.eti.br> Author: Antti-Juhani Kaijanaho-Maintainer: Marco Túlio Gontijo e Silva <marcot@debian.org>+Maintainer: Marco Túlio Gontijo e Silva <marcot@marcot.eti.br> Stability: experimental Homepage: http://wiki.darcs.net/RelatedSoftware/DarcsMonitor-Package-Url: http://hackage.haskell.org/packages/darcs-monitor/0.3.8/darcs-monitor-0.3.8.tar.gz+Package-Url: http://hackage.haskell.org/packages/darcs-monitor/0.4.0/darcs-monitor-0.4.0.tar.gz Synopsis: Darcs repository monitor (sends email) Description: Darcs-monitor will send email to a specified recipient about new changes added to a specific darcs repository. It can be run
darcs-monitor.hs view
@@ -2,6 +2,7 @@ Copyright © 2007 Antti-Juhani Kaijanaho Copyright © 2007 Benja Fallenstein Copyright © 2007 Benjamin Franksen+ Copyright © 2010 Marco Túlio Gontijo e Silva <marcot@marcot.eti.br> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -19,6 +20,7 @@ -} module Main where +import Control.Arrow import Control.Monad import Control.Monad.Trans import Data.Char@@ -100,7 +102,8 @@ HelpOpt -> do putStr (usageInfo (usage pn) options) exitWith ExitSuccess where usage pn_ = "Usage: " ++ pn_ ++- " [OPTIONS] email RECIPIENT [REPO ...]"+ " [OPTIONS] email RECIPIENT \+ \[email RECIPIENT ...] [REPO ...]" VersionOpt -> do putStrLn $ "darcs-monitor " ++ showVersion version exitWith ExitSuccess@@ -141,9 +144,10 @@ (cmd,args'') <- case args' of ["email"] -> err "email requires an argument" ("email":addr:rest) ->+ let (addrs, rest_) = getMoreEmails rest in return (("emailPatch " ++ addr,- emailPatch addr),- rest)+ emailPatch (addr : addrs)),+ rest_) ("print":rest) -> return (("print", \p -> liftIO $ print p >> @@ -155,6 +159,10 @@ return [wd] _ -> return args'' mapM_ (processRepo dryRun cmd) repos++getMoreEmails :: [String] -> ([String], [String])+getMoreEmails ("email" : addr : rest) = first (addr :) $ getMoreEmails rest+getMoreEmails rest = ([], rest) err :: (MonadConfig m, MonadIO m) => String -> m a err msg = do pn <- asks confProgName