{-# LANGUAGE CPP, TypeOperators, OverloadedStrings #-}
module Darcs.UI.Commands.Send ( send ) where
import Prelude ()
import Darcs.Prelude
import System.Exit
( exitSuccess
#ifndef HAVE_MAPI
, ExitCode ( ExitFailure )
, exitWith
#endif
)
import System.IO.Error ( ioeGetErrorString )
import System.IO ( hClose )
import Control.Exception ( catch, IOException )
import Control.Monad ( when, unless, forM_ )
import Darcs.Util.Tree ( Tree )
import Data.List ( intercalate, isPrefixOf )
import Data.List ( stripPrefix )
import Data.Maybe ( isNothing, fromMaybe )
import Darcs.UI.Commands
( DarcsCommand(..), withStdOpts
, putInfo
, putVerbose
, setEnvDarcsPatches
, defaultRepo
, amInHashedRepository
)
import Darcs.UI.Commands.Util ( printDryRunMessageAndExit, checkUnrelatedRepos )
import Darcs.UI.Flags
( DarcsFlag
, willRemoveLogFile, changesReverse, dryRun, useCache, remoteRepos, setDefault
, fixUrl
, getCc
, getAuthor
, getSubject
, getInReplyTo
, getSendmailCmd
, getOutput
, charset
, verbosity
, isInteractive
, author
, hasLogfile
, selectDeps
, minimize
, editDescription
)
import Darcs.UI.Options
( (^), odesc, ocheck, onormalise
, defaultFlags, parseFlags, (?)
)
import qualified Darcs.UI.Options.All as O
import Darcs.Patch.PatchInfoAnd ( PatchInfoAnd, hopefully, patchDesc )
import Darcs.Repository
( Repository
, repoLocation
, PatchSet
, identifyRepositoryFor
, withRepository
, RepoJob(..)
, readRepo
, readRecorded
, prefsUrl )
import Darcs.Patch.Set ( Origin )
import Darcs.Patch.Apply( ApplyState )
import Darcs.Patch ( IsRepoType, RepoPatch, description, applyToTree, invert )
import Darcs.Patch.Witnesses.Sealed ( Sealed(..) )
import Darcs.Patch.Witnesses.Unsafe ( unsafeCoerceP )
import Darcs.Patch.Witnesses.Ordered
( FL(..), (:>)(..), (:\/:)(..),
mapFL, mapFL_FL, lengthFL, nullFL )
import Darcs.Patch.Bundle ( minContext, makeBundleN, scanContextFile, patchFilename )
import Darcs.Repository.Prefs ( addRepoSource, getPreflist )
import Darcs.Repository.Flags ( DryRun(..) )
import Darcs.Util.External ( fetchFilePS, Cachable(..) )
import Darcs.UI.External
( signString
, sendEmailDoc
, generateEmail
, editFile
, catchall
, getSystemEncoding
, isUTF8Locale
#ifndef HAVE_MAPI
, haveSendmail
#endif
)
import Darcs.Util.ByteString ( mmapFilePS, isAscii )
import qualified Data.ByteString.Char8 as BC (unpack)
import Darcs.Util.Lock
( withOpenTemp
, writeDocBinFile
, readDocBinFile
, removeFileMayNotExist
)
import Darcs.UI.SelectChanges
( WhichChanges(..)
, selectionContext
, runSelection
)
import qualified Darcs.UI.SelectChanges as S ( PatchSelectionOptions(..) )
import Darcs.Patch.Depends ( findCommonWithThem )
import Darcs.Util.Prompt ( askUser, promptYorn )
import Data.Text.Encoding ( decodeUtf8' )
import Darcs.Util.Progress ( debugMessage )
import Darcs.UI.Email ( makeEmail )
import Darcs.UI.Completion ( prefArgs )
import Darcs.Util.Printer
( Doc, vsep, text, ($$), (<+>), putDoc, putDocLn
, renderPS, vcat
)
import Darcs.Util.English ( englishNum, Noun(..) )
import Darcs.Util.Text ( sentence, quote )
import Darcs.Util.Path ( FilePathLike, toFilePath, AbsolutePath, AbsolutePathOrStd,
getCurrentDirectory, useAbsoluteOrStd, makeAbsoluteOrStd )
import Darcs.Util.Download.HTTP ( postUrl )
import Darcs.Util.Workaround ( renameFile )
import Darcs.Util.Global ( darcsSendMessage, darcsSendMessageFinal )
import Darcs.Util.SignalHandler ( catchInterrupt )
patchSelOpts :: [DarcsFlag] -> S.PatchSelectionOptions
patchSelOpts :: [DarcsFlag] -> PatchSelectionOptions
patchSelOpts flags :: [DarcsFlag]
flags = PatchSelectionOptions :: Verbosity
-> [MatchFlag]
-> Bool
-> SelectDeps
-> Summary
-> WithContext
-> PatchSelectionOptions
S.PatchSelectionOptions
{ verbosity :: Verbosity
S.verbosity = PrimDarcsOption Verbosity
verbosity PrimDarcsOption Verbosity -> [DarcsFlag] -> Verbosity
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
flags
, matchFlags :: [MatchFlag]
S.matchFlags = (forall a. PrimOptSpec DarcsOptDescr DarcsFlag a [MatchFlag])
-> [DarcsFlag] -> [MatchFlag]
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
parseFlags forall a. PrimOptSpec DarcsOptDescr DarcsFlag a [MatchFlag]
O.matchSeveral [DarcsFlag]
flags
, interactive :: Bool
S.interactive = Bool -> [DarcsFlag] -> Bool
isInteractive Bool
True [DarcsFlag]
flags
, selectDeps :: SelectDeps
S.selectDeps = PrimDarcsOption SelectDeps
selectDeps PrimDarcsOption SelectDeps -> [DarcsFlag] -> SelectDeps
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
flags
, summary :: Summary
S.summary = PrimDarcsOption Summary
O.summary PrimDarcsOption Summary -> [DarcsFlag] -> Summary
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
flags
, withContext :: WithContext
S.withContext = WithContext
O.NoContext
}
send :: DarcsCommand [DarcsFlag]
send :: DarcsCommand [DarcsFlag]
send = DarcsCommand :: forall parsedFlags.
String
-> String
-> String
-> String
-> Int
-> [String]
-> ((AbsolutePath, AbsolutePath)
-> parsedFlags -> [String] -> IO ())
-> ([DarcsFlag] -> IO (Either String ()))
-> ((AbsolutePath, AbsolutePath)
-> [DarcsFlag] -> [String] -> IO [String])
-> ([DarcsFlag] -> AbsolutePath -> [String] -> IO [String])
-> [DarcsOptDescr DarcsFlag]
-> [DarcsOptDescr DarcsFlag]
-> [DarcsFlag]
-> ([DarcsFlag] -> [String])
-> ([DarcsFlag] -> parsedFlags)
-> DarcsCommand parsedFlags
DarcsCommand
{ commandProgramName :: String
commandProgramName = "darcs"
, commandName :: String
commandName = "send"
, commandHelp :: String
commandHelp = String
cmdHelp
, commandDescription :: String
commandDescription = String
cmdDescription
, commandExtraArgs :: Int
commandExtraArgs = 1
, commandExtraArgHelp :: [String]
commandExtraArgHelp = ["[REPOSITORY]"]
, commandCommand :: (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
commandCommand = (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
sendCmd
, commandPrereq :: [DarcsFlag] -> IO (Either String ())
commandPrereq = [DarcsFlag] -> IO (Either String ())
amInHashedRepository
, commandCompleteArgs :: (AbsolutePath, AbsolutePath)
-> [DarcsFlag] -> [String] -> IO [String]
commandCompleteArgs = String
-> (AbsolutePath, AbsolutePath)
-> [DarcsFlag]
-> [String]
-> IO [String]
prefArgs "repos"
, commandArgdefaults :: [DarcsFlag] -> AbsolutePath -> [String] -> IO [String]
commandArgdefaults = [DarcsFlag] -> AbsolutePath -> [String] -> IO [String]
defaultRepo
, commandAdvancedOptions :: [DarcsOptDescr DarcsFlag]
commandAdvancedOptions = OptSpec
DarcsOptDescr
DarcsFlag
Any
(Logfile
-> RemoteRepos
-> Maybe AbsolutePath
-> Bool
-> NetworkOptions
-> Any)
-> [DarcsOptDescr DarcsFlag]
forall (d :: * -> *) f a b. OptSpec d f a b -> [d f]
odesc OptSpec
DarcsOptDescr
DarcsFlag
Any
(Logfile
-> RemoteRepos
-> Maybe AbsolutePath
-> Bool
-> NetworkOptions
-> Any)
forall a.
OptSpec
DarcsOptDescr
DarcsFlag
a
(Logfile
-> RemoteRepos
-> Maybe AbsolutePath
-> Bool
-> NetworkOptions
-> a)
sendAdvancedOpts
, commandBasicOptions :: [DarcsOptDescr DarcsFlag]
commandBasicOptions = OptSpec
DarcsOptDescr
DarcsFlag
Any
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> Any)
-> [DarcsOptDescr DarcsFlag]
forall (d :: * -> *) f a b. OptSpec d f a b -> [d f]
odesc OptSpec
DarcsOptDescr
DarcsFlag
Any
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> Any)
forall a.
OptSpec
DarcsOptDescr
DarcsFlag
a
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
sendBasicOpts
, commandDefaults :: [DarcsFlag]
commandDefaults = OptSpec
DarcsOptDescr
DarcsFlag
[DarcsFlag]
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Logfile
-> RemoteRepos
-> Maybe AbsolutePath
-> Bool
-> NetworkOptions
-> UseCache
-> HooksConfig
-> [DarcsFlag])
-> [DarcsFlag]
forall (d :: * -> *) f b. OptSpec d f [f] b -> [f]
defaultFlags OptSpec
DarcsOptDescr
DarcsFlag
[DarcsFlag]
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Logfile
-> RemoteRepos
-> Maybe AbsolutePath
-> Bool
-> NetworkOptions
-> UseCache
-> HooksConfig
-> [DarcsFlag])
forall a.
DarcsOption
a
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Logfile
-> RemoteRepos
-> Maybe AbsolutePath
-> Bool
-> NetworkOptions
-> UseCache
-> HooksConfig
-> a)
sendOpts
, commandCheckOptions :: [DarcsFlag] -> [String]
commandCheckOptions = OptSpec
DarcsOptDescr
DarcsFlag
Any
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Logfile
-> RemoteRepos
-> Maybe AbsolutePath
-> Bool
-> NetworkOptions
-> UseCache
-> HooksConfig
-> Any)
-> [DarcsFlag] -> [String]
forall (d :: * -> *) f a b. OptSpec d f a b -> [f] -> [String]
ocheck OptSpec
DarcsOptDescr
DarcsFlag
Any
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Logfile
-> RemoteRepos
-> Maybe AbsolutePath
-> Bool
-> NetworkOptions
-> UseCache
-> HooksConfig
-> Any)
forall a.
DarcsOption
a
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Logfile
-> RemoteRepos
-> Maybe AbsolutePath
-> Bool
-> NetworkOptions
-> UseCache
-> HooksConfig
-> a)
sendOpts
, commandParseOptions :: [DarcsFlag] -> [DarcsFlag]
commandParseOptions = OptSpec
DarcsOptDescr
DarcsFlag
[DarcsFlag]
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Logfile
-> RemoteRepos
-> Maybe AbsolutePath
-> Bool
-> NetworkOptions
-> UseCache
-> HooksConfig
-> [DarcsFlag])
-> [DarcsFlag] -> [DarcsFlag]
forall (d :: * -> *) f b. OptSpec d f [f] b -> [f] -> [f]
onormalise OptSpec
DarcsOptDescr
DarcsFlag
[DarcsFlag]
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Logfile
-> RemoteRepos
-> Maybe AbsolutePath
-> Bool
-> NetworkOptions
-> UseCache
-> HooksConfig
-> [DarcsFlag])
forall a.
DarcsOption
a
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Logfile
-> RemoteRepos
-> Maybe AbsolutePath
-> Bool
-> NetworkOptions
-> UseCache
-> HooksConfig
-> a)
sendOpts
}
where
sendBasicOpts :: OptSpec
DarcsOptDescr
DarcsFlag
a
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
sendBasicOpts
= PrimOptSpec
DarcsOptDescr
DarcsFlag
(SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
[MatchFlag]
forall a. PrimOptSpec DarcsOptDescr DarcsFlag a [MatchFlag]
O.matchSeveral
PrimOptSpec
DarcsOptDescr
DarcsFlag
(SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
[MatchFlag]
-> OptSpec
DarcsOptDescr
DarcsFlag
(Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
(SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
-> OptSpec
DarcsOptDescr
DarcsFlag
(Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
DarcsFlag
(Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
(SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
PrimDarcsOption SelectDeps
O.selectDeps
OptSpec
DarcsOptDescr
DarcsFlag
(Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
-> OptSpec
DarcsOptDescr
DarcsFlag
(HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
(Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
-> OptSpec
DarcsOptDescr
DarcsFlag
(HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
DarcsFlag
(HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
(Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
PrimDarcsOption (Maybe Bool)
O.interactive
OptSpec
DarcsOptDescr
DarcsFlag
(HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
-> OptSpec
DarcsOptDescr
DarcsFlag
(Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
(HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
-> OptSpec
DarcsOptDescr
DarcsFlag
(Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
DarcsFlag
(Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
(HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
PrimDarcsOption HeaderFields
O.headerFields
OptSpec
DarcsOptDescr
DarcsFlag
(Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
-> OptSpec
DarcsOptDescr
DarcsFlag
(Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
(Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
-> OptSpec
DarcsOptDescr
DarcsFlag
(Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
DarcsFlag
(Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
(Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
PrimDarcsOption (Maybe String)
O.author
OptSpec
DarcsOptDescr
DarcsFlag
(Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
-> OptSpec
DarcsOptDescr
DarcsFlag
((Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
(Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
-> OptSpec
DarcsOptDescr
DarcsFlag
((Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
DarcsFlag
((Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
(Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
PrimDarcsOption (Maybe String)
O.charset
OptSpec
DarcsOptDescr
DarcsFlag
((Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
-> OptSpec
DarcsOptDescr
DarcsFlag
(Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
((Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
-> OptSpec
DarcsOptDescr
DarcsFlag
(Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
DarcsFlag
(Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
((Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
PrimDarcsOption (Bool, Maybe String)
O.sendmail
OptSpec
DarcsOptDescr
DarcsFlag
(Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
-> OptSpec
DarcsOptDescr
DarcsFlag
(Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
(Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
-> OptSpec
DarcsOptDescr
DarcsFlag
(Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
DarcsFlag
(Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
(Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
PrimDarcsOption (Maybe Output)
O.output
OptSpec
DarcsOptDescr
DarcsFlag
(Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
-> OptSpec
DarcsOptDescr
DarcsFlag
(DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
(Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
-> OptSpec
DarcsOptDescr
DarcsFlag
(DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
DarcsFlag
(DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
(Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
PrimDarcsOption Sign
O.sign
OptSpec
DarcsOptDescr
DarcsFlag
(DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
-> OptSpec
DarcsOptDescr
DarcsFlag
(Summary
-> Bool -> Maybe Bool -> Maybe String -> Bool -> Bool -> a)
(DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
-> OptSpec
DarcsOptDescr
DarcsFlag
(Summary
-> Bool -> Maybe Bool -> Maybe String -> Bool -> Bool -> a)
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
DarcsFlag
(Summary
-> Bool -> Maybe Bool -> Maybe String -> Bool -> Bool -> a)
(DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
forall a. DarcsOption a (DryRun -> XmlOutput -> a)
O.dryRunXml
OptSpec
DarcsOptDescr
DarcsFlag
(Summary
-> Bool -> Maybe Bool -> Maybe String -> Bool -> Bool -> a)
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
-> OptSpec
DarcsOptDescr
DarcsFlag
(Bool -> Maybe Bool -> Maybe String -> Bool -> Bool -> a)
(Summary
-> Bool -> Maybe Bool -> Maybe String -> Bool -> Bool -> a)
-> OptSpec
DarcsOptDescr
DarcsFlag
(Bool -> Maybe Bool -> Maybe String -> Bool -> Bool -> a)
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
DarcsFlag
(Bool -> Maybe Bool -> Maybe String -> Bool -> Bool -> a)
(Summary
-> Bool -> Maybe Bool -> Maybe String -> Bool -> Bool -> a)
PrimDarcsOption Summary
O.summary
OptSpec
DarcsOptDescr
DarcsFlag
(Bool -> Maybe Bool -> Maybe String -> Bool -> Bool -> a)
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
-> OptSpec
DarcsOptDescr
DarcsFlag
(Maybe Bool -> Maybe String -> Bool -> Bool -> a)
(Bool -> Maybe Bool -> Maybe String -> Bool -> Bool -> a)
-> OptSpec
DarcsOptDescr
DarcsFlag
(Maybe Bool -> Maybe String -> Bool -> Bool -> a)
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
DarcsFlag
(Maybe Bool -> Maybe String -> Bool -> Bool -> a)
(Bool -> Maybe Bool -> Maybe String -> Bool -> Bool -> a)
PrimDarcsOption Bool
O.editDescription
OptSpec
DarcsOptDescr
DarcsFlag
(Maybe Bool -> Maybe String -> Bool -> Bool -> a)
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
-> OptSpec
DarcsOptDescr
DarcsFlag
(Maybe String -> Bool -> Bool -> a)
(Maybe Bool -> Maybe String -> Bool -> Bool -> a)
-> OptSpec
DarcsOptDescr
DarcsFlag
(Maybe String -> Bool -> Bool -> a)
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
DarcsFlag
(Maybe String -> Bool -> Bool -> a)
(Maybe Bool -> Maybe String -> Bool -> Bool -> a)
PrimDarcsOption (Maybe Bool)
O.setDefault
OptSpec
DarcsOptDescr
DarcsFlag
(Maybe String -> Bool -> Bool -> a)
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
-> OptSpec
DarcsOptDescr
DarcsFlag
(Bool -> Bool -> a)
(Maybe String -> Bool -> Bool -> a)
-> OptSpec
DarcsOptDescr
DarcsFlag
(Bool -> Bool -> a)
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
DarcsFlag
(Bool -> Bool -> a)
(Maybe String -> Bool -> Bool -> a)
PrimDarcsOption (Maybe String)
O.repoDir
OptSpec
DarcsOptDescr
DarcsFlag
(Bool -> Bool -> a)
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
-> OptSpec DarcsOptDescr DarcsFlag (Bool -> a) (Bool -> Bool -> a)
-> OptSpec
DarcsOptDescr
DarcsFlag
(Bool -> a)
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec DarcsOptDescr DarcsFlag (Bool -> a) (Bool -> Bool -> a)
PrimDarcsOption Bool
O.minimize
OptSpec
DarcsOptDescr
DarcsFlag
(Bool -> a)
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
-> OptSpec DarcsOptDescr DarcsFlag a (Bool -> a)
-> OptSpec
DarcsOptDescr
DarcsFlag
a
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec DarcsOptDescr DarcsFlag a (Bool -> a)
PrimDarcsOption Bool
O.allowUnrelatedRepos
sendAdvancedOpts :: OptSpec
DarcsOptDescr
DarcsFlag
a
(Logfile
-> RemoteRepos
-> Maybe AbsolutePath
-> Bool
-> NetworkOptions
-> a)
sendAdvancedOpts
= PrimOptSpec
DarcsOptDescr
DarcsFlag
(RemoteRepos -> Maybe AbsolutePath -> Bool -> NetworkOptions -> a)
Logfile
PrimDarcsOption Logfile
O.logfile
PrimOptSpec
DarcsOptDescr
DarcsFlag
(RemoteRepos -> Maybe AbsolutePath -> Bool -> NetworkOptions -> a)
Logfile
-> OptSpec
DarcsOptDescr
DarcsFlag
(Maybe AbsolutePath -> Bool -> NetworkOptions -> a)
(RemoteRepos -> Maybe AbsolutePath -> Bool -> NetworkOptions -> a)
-> OptSpec
DarcsOptDescr
DarcsFlag
(Maybe AbsolutePath -> Bool -> NetworkOptions -> a)
(Logfile
-> RemoteRepos
-> Maybe AbsolutePath
-> Bool
-> NetworkOptions
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
DarcsFlag
(Maybe AbsolutePath -> Bool -> NetworkOptions -> a)
(RemoteRepos -> Maybe AbsolutePath -> Bool -> NetworkOptions -> a)
PrimDarcsOption RemoteRepos
O.remoteRepos
OptSpec
DarcsOptDescr
DarcsFlag
(Maybe AbsolutePath -> Bool -> NetworkOptions -> a)
(Logfile
-> RemoteRepos
-> Maybe AbsolutePath
-> Bool
-> NetworkOptions
-> a)
-> OptSpec
DarcsOptDescr
DarcsFlag
(Bool -> NetworkOptions -> a)
(Maybe AbsolutePath -> Bool -> NetworkOptions -> a)
-> OptSpec
DarcsOptDescr
DarcsFlag
(Bool -> NetworkOptions -> a)
(Logfile
-> RemoteRepos
-> Maybe AbsolutePath
-> Bool
-> NetworkOptions
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
DarcsFlag
(Bool -> NetworkOptions -> a)
(Maybe AbsolutePath -> Bool -> NetworkOptions -> a)
PrimDarcsOption (Maybe AbsolutePath)
O.sendToContext
OptSpec
DarcsOptDescr
DarcsFlag
(Bool -> NetworkOptions -> a)
(Logfile
-> RemoteRepos
-> Maybe AbsolutePath
-> Bool
-> NetworkOptions
-> a)
-> OptSpec
DarcsOptDescr
DarcsFlag
(NetworkOptions -> a)
(Bool -> NetworkOptions -> a)
-> OptSpec
DarcsOptDescr
DarcsFlag
(NetworkOptions -> a)
(Logfile
-> RemoteRepos
-> Maybe AbsolutePath
-> Bool
-> NetworkOptions
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
DarcsFlag
(NetworkOptions -> a)
(Bool -> NetworkOptions -> a)
PrimDarcsOption Bool
O.changesReverse
OptSpec
DarcsOptDescr
DarcsFlag
(NetworkOptions -> a)
(Logfile
-> RemoteRepos
-> Maybe AbsolutePath
-> Bool
-> NetworkOptions
-> a)
-> OptSpec DarcsOptDescr DarcsFlag a (NetworkOptions -> a)
-> OptSpec
DarcsOptDescr
DarcsFlag
a
(Logfile
-> RemoteRepos
-> Maybe AbsolutePath
-> Bool
-> NetworkOptions
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec DarcsOptDescr DarcsFlag a (NetworkOptions -> a)
PrimDarcsOption NetworkOptions
O.network
sendOpts :: DarcsOption
a
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Logfile
-> RemoteRepos
-> Maybe AbsolutePath
-> Bool
-> NetworkOptions
-> UseCache
-> HooksConfig
-> a)
sendOpts = OptSpec
DarcsOptDescr
DarcsFlag
(Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Logfile
-> RemoteRepos
-> Maybe AbsolutePath
-> Bool
-> NetworkOptions
-> UseCache
-> HooksConfig
-> a)
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Logfile
-> RemoteRepos
-> Maybe AbsolutePath
-> Bool
-> NetworkOptions
-> UseCache
-> HooksConfig
-> a)
forall a.
OptSpec
DarcsOptDescr
DarcsFlag
a
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> a)
sendBasicOpts OptSpec
DarcsOptDescr
DarcsFlag
(Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Logfile
-> RemoteRepos
-> Maybe AbsolutePath
-> Bool
-> NetworkOptions
-> UseCache
-> HooksConfig
-> a)
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Logfile
-> RemoteRepos
-> Maybe AbsolutePath
-> Bool
-> NetworkOptions
-> UseCache
-> HooksConfig
-> a)
-> DarcsOption
(UseCache -> HooksConfig -> a)
(Logfile
-> RemoteRepos
-> Maybe AbsolutePath
-> Bool
-> NetworkOptions
-> UseCache
-> HooksConfig
-> a)
-> DarcsOption
a
([MatchFlag]
-> SelectDeps
-> Maybe Bool
-> HeaderFields
-> Maybe String
-> Maybe String
-> (Bool, Maybe String)
-> Maybe Output
-> Sign
-> DryRun
-> XmlOutput
-> Summary
-> Bool
-> Maybe Bool
-> Maybe String
-> Bool
-> Bool
-> Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Logfile
-> RemoteRepos
-> Maybe AbsolutePath
-> Bool
-> NetworkOptions
-> UseCache
-> HooksConfig
-> a)
forall b c a.
DarcsOption
(Maybe StdCmdAction -> Bool -> Bool -> Verbosity -> Bool -> b) c
-> DarcsOption (UseCache -> HooksConfig -> a) b -> DarcsOption a c
`withStdOpts` DarcsOption
(UseCache -> HooksConfig -> a)
(Logfile
-> RemoteRepos
-> Maybe AbsolutePath
-> Bool
-> NetworkOptions
-> UseCache
-> HooksConfig
-> a)
forall a.
OptSpec
DarcsOptDescr
DarcsFlag
a
(Logfile
-> RemoteRepos
-> Maybe AbsolutePath
-> Bool
-> NetworkOptions
-> a)
sendAdvancedOpts
sendCmd :: (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
sendCmd :: (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
sendCmd fps :: (AbsolutePath, AbsolutePath)
fps opts :: [DarcsFlag]
opts [""] = (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
sendCmd (AbsolutePath, AbsolutePath)
fps [DarcsFlag]
opts []
sendCmd (_,o :: AbsolutePath
o) opts :: [DarcsFlag]
opts [unfixedrepodir :: String
unfixedrepodir] =
UseCache -> RepoJob () -> IO ()
forall a. UseCache -> RepoJob a -> IO a
withRepository (PrimDarcsOption UseCache
useCache PrimDarcsOption UseCache -> [DarcsFlag] -> UseCache
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) (RepoJob () -> IO ()) -> RepoJob () -> IO ()
forall a b. (a -> b) -> a -> b
$ (forall (rt :: RepoType) (p :: * -> * -> *) wR wU.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wR -> IO ())
-> RepoJob ()
forall a.
(forall (rt :: RepoType) (p :: * -> * -> *) wR wU.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wR -> IO a)
-> RepoJob a
RepoJob ((forall (rt :: RepoType) (p :: * -> * -> *) wR wU.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wR -> IO ())
-> RepoJob ())
-> (forall (rt :: RepoType) (p :: * -> * -> *) wR wU.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wR -> IO ())
-> RepoJob ()
forall a b. (a -> b) -> a -> b
$
\(Repository rt p wR wU wR
repository :: Repository rt p wR wU wR) -> do
Maybe (PatchSet rt p Origin Any)
context_ps <- Maybe AbsolutePath -> IO (Maybe (PatchSet rt p Origin Any))
forall a (rt :: RepoType) (p :: * -> * -> *) wX.
FilePathLike a =>
Maybe a -> IO (Maybe (PatchSet rt p Origin wX))
the_context (PrimDarcsOption (Maybe AbsolutePath)
O.sendToContext PrimDarcsOption (Maybe AbsolutePath)
-> [DarcsFlag] -> Maybe AbsolutePath
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts)
case Maybe (PatchSet rt p Origin Any)
context_ps of
Just them :: PatchSet rt p Origin Any
them -> do
[WhatToDo]
wtds <- [DarcsFlag] -> Maybe (Repository rt p wR wU wR) -> IO [WhatToDo]
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
[DarcsFlag] -> Maybe (Repository rt p wR wU wT) -> IO [WhatToDo]
decideOnBehavior [DarcsFlag]
opts (Maybe (Repository rt p wR wU wR)
forall a. Maybe a
Nothing :: Maybe (Repository rt p wR wU wR))
Repository rt p wR wU wR
-> [DarcsFlag]
-> [WhatToDo]
-> String
-> PatchSet rt p Origin Any
-> IO ()
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT wX.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wT
-> [DarcsFlag]
-> [WhatToDo]
-> String
-> PatchSet rt p Origin wX
-> IO ()
sendToThem Repository rt p wR wU wR
repository [DarcsFlag]
opts [WhatToDo]
wtds "CONTEXT" PatchSet rt p Origin Any
them
Nothing -> do
String
repodir <- AbsolutePath -> String -> IO String
fixUrl AbsolutePath
o String
unfixedrepodir
AbsolutePath
here <- IO AbsolutePath
getCurrentDirectory
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (String
repodir String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== AbsolutePath -> String
forall a. FilePathLike a => a -> String
toFilePath AbsolutePath
here) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
String -> IO ()
forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
cannotSendToSelf
[String]
old_default <- String -> IO [String]
getPreflist "defaultrepo"
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when ([String]
old_default [String] -> [String] -> Bool
forall a. Eq a => a -> a -> Bool
== [String
repodir]) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
[DarcsFlag] -> Doc -> IO ()
putInfo [DarcsFlag]
opts (String -> Doc
creatingPatch String
repodir)
Repository rt p Any Any Any
repo <- Repository rt p wR wU wR
-> UseCache -> String -> IO (Repository rt p Any Any Any)
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT vR vU vT.
Repository rt p wR wU wT
-> UseCache -> String -> IO (Repository rt p vR vU vT)
identifyRepositoryFor Repository rt p wR wU wR
repository (PrimDarcsOption UseCache
useCache PrimDarcsOption UseCache -> [DarcsFlag] -> UseCache
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) String
repodir
PatchSet rt p Origin Any
them <- Repository rt p Any Any Any -> IO (PatchSet rt p Origin Any)
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
(IsRepoType rt, RepoPatch p) =>
Repository rt p wR wU wT -> IO (PatchSet rt p Origin wR)
readRepo Repository rt p Any Any Any
repo
String -> DryRun -> RemoteRepos -> SetDefault -> IO ()
addRepoSource String
repodir (PrimDarcsOption DryRun
dryRun PrimDarcsOption DryRun -> [DarcsFlag] -> DryRun
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) (PrimDarcsOption RemoteRepos
remoteRepos PrimDarcsOption RemoteRepos -> [DarcsFlag] -> RemoteRepos
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) (Bool -> [DarcsFlag] -> SetDefault
setDefault Bool
False [DarcsFlag]
opts)
[WhatToDo]
wtds <- [DarcsFlag] -> Maybe (Repository rt p Any Any Any) -> IO [WhatToDo]
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
[DarcsFlag] -> Maybe (Repository rt p wR wU wT) -> IO [WhatToDo]
decideOnBehavior [DarcsFlag]
opts (Repository rt p Any Any Any -> Maybe (Repository rt p Any Any Any)
forall a. a -> Maybe a
Just Repository rt p Any Any Any
repo)
Repository rt p wR wU wR
-> [DarcsFlag]
-> [WhatToDo]
-> String
-> PatchSet rt p Origin Any
-> IO ()
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT wX.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wT
-> [DarcsFlag]
-> [WhatToDo]
-> String
-> PatchSet rt p Origin wX
-> IO ()
sendToThem Repository rt p wR wU wR
repository [DarcsFlag]
opts [WhatToDo]
wtds String
repodir PatchSet rt p Origin Any
them
where
the_context :: Maybe a -> IO (Maybe (PatchSet rt p Origin wX))
the_context Nothing = Maybe (PatchSet rt p Origin wX)
-> IO (Maybe (PatchSet rt p Origin wX))
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe (PatchSet rt p Origin wX)
forall a. Maybe a
Nothing
the_context (Just foo :: a
foo) = PatchSet rt p Origin wX -> Maybe (PatchSet rt p Origin wX)
forall a. a -> Maybe a
Just (PatchSet rt p Origin wX -> Maybe (PatchSet rt p Origin wX))
-> IO (PatchSet rt p Origin wX)
-> IO (Maybe (PatchSet rt p Origin wX))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` String -> IO (PatchSet rt p Origin wX)
forall (rt :: RepoType) (p :: * -> * -> *) wX.
String -> IO (PatchSet rt p Origin wX)
scanContextFile (a -> String
forall a. FilePathLike a => a -> String
toFilePath a
foo)
sendCmd _ _ _ = IO ()
forall a. a
impossible
sendToThem :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree)
=> Repository rt p wR wU wT -> [DarcsFlag] -> [WhatToDo] -> String
-> PatchSet rt p Origin wX -> IO ()
sendToThem :: Repository rt p wR wU wT
-> [DarcsFlag]
-> [WhatToDo]
-> String
-> PatchSet rt p Origin wX
-> IO ()
sendToThem repo :: Repository rt p wR wU wT
repo opts :: [DarcsFlag]
opts wtds :: [WhatToDo]
wtds their_name :: String
their_name them :: PatchSet rt p Origin wX
them = do
#ifndef HAVE_MAPI
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when ((Bool, Maybe String) -> Bool
forall a b. (a, b) -> a
fst (PrimDarcsOption (Bool, Maybe String)
O.sendmail PrimDarcsOption (Bool, Maybe String)
-> [DarcsFlag] -> (Bool, Maybe String)
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) Bool -> Bool -> Bool
&& PrimDarcsOption DryRun
dryRun PrimDarcsOption DryRun -> [DarcsFlag] -> DryRun
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts DryRun -> DryRun -> Bool
forall a. Eq a => a -> a -> Bool
== DryRun
O.NoDryRun) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ do
Bool
sendmail <- IO Bool
haveSendmail
String
sm_cmd <- [DarcsFlag] -> IO String
getSendmailCmd [DarcsFlag]
opts
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Bool -> Bool
not Bool
sendmail Bool -> Bool -> Bool
&& String
sm_cmd String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== "") (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ do
[DarcsFlag] -> Doc -> IO ()
putInfo [DarcsFlag]
opts Doc
noWorkingSendmail
ExitCode -> IO ()
forall a. ExitCode -> IO a
exitWith (ExitCode -> IO ()) -> ExitCode -> IO ()
forall a b. (a -> b) -> a -> b
$ Int -> ExitCode
ExitFailure 1
#endif
PatchSet rt p Origin wR
us <- Repository rt p wR wU wT -> IO (PatchSet rt p Origin wR)
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
(IsRepoType rt, RepoPatch p) =>
Repository rt p wR wU wT -> IO (PatchSet rt p Origin wR)
readRepo Repository rt p wR wU wT
repo
common :: PatchSet rt p Origin wZ
common :> us' :: FL (PatchInfoAnd rt p) wZ wR
us' <- (:>) (PatchSet rt p) (FL (PatchInfoAnd rt p)) Origin wR
-> IO ((:>) (PatchSet rt p) (FL (PatchInfoAnd rt p)) Origin wR)
forall (m :: * -> *) a. Monad m => a -> m a
return ((:>) (PatchSet rt p) (FL (PatchInfoAnd rt p)) Origin wR
-> IO ((:>) (PatchSet rt p) (FL (PatchInfoAnd rt p)) Origin wR))
-> (:>) (PatchSet rt p) (FL (PatchInfoAnd rt p)) Origin wR
-> IO ((:>) (PatchSet rt p) (FL (PatchInfoAnd rt p)) Origin wR)
forall a b. (a -> b) -> a -> b
$ PatchSet rt p Origin wR
-> PatchSet rt p Origin wX
-> (:>) (PatchSet rt p) (FL (PatchInfoAnd rt p)) Origin wR
forall (p :: * -> * -> *) (rt :: RepoType) wStart wX wY.
Commute p =>
PatchSet rt p wStart wX
-> PatchSet rt p wStart wY
-> (:>) (PatchSet rt p) (FL (PatchInfoAnd rt p)) wStart wX
findCommonWithThem PatchSet rt p Origin wR
us PatchSet rt p Origin wX
them
Bool -> PatchSet rt p Origin wR -> PatchSet rt p Origin wX -> IO ()
forall (p :: * -> * -> *) (rt :: RepoType) wStart wX wY.
RepoPatch p =>
Bool -> PatchSet rt p wStart wX -> PatchSet rt p wStart wY -> IO ()
checkUnrelatedRepos (PrimDarcsOption Bool
O.allowUnrelatedRepos PrimDarcsOption Bool -> [DarcsFlag] -> Bool
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) PatchSet rt p Origin wR
us PatchSet rt p Origin wX
them
case FL (PatchInfoAnd rt p) wZ wR
us' of
NilFL -> do [DarcsFlag] -> Doc -> IO ()
putInfo [DarcsFlag]
opts Doc
nothingSendable
IO ()
forall a. IO a
exitSuccess
_ -> [DarcsFlag] -> Doc -> IO ()
putVerbose [DarcsFlag]
opts (Doc -> IO ()) -> Doc -> IO ()
forall a b. (a -> b) -> a -> b
$ [Doc] -> Doc
selectionIs ((forall wW wZ. PatchInfoAnd rt p wW wZ -> Doc)
-> FL (PatchInfoAnd rt p) wZ wR -> [Doc]
forall (a :: * -> * -> *) b wX wY.
(forall wW wZ. a wW wZ -> b) -> FL a wX wY -> [b]
mapFL forall wW wZ. PatchInfoAnd rt p wW wZ -> Doc
forall (p :: * -> * -> *) wX wY. ShowPatch p => p wX wY -> Doc
description FL (PatchInfoAnd rt p) wZ wR
us')
Tree IO
pristine <- Repository rt p wR wU wT -> IO (Tree IO)
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
Repository rt p wR wU wT -> IO (Tree IO)
readRecorded Repository rt p wR wU wT
repo
let direction :: WhichChanges
direction = if PrimDarcsOption Bool
changesReverse PrimDarcsOption Bool -> [DarcsFlag] -> Bool
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts then WhichChanges
FirstReversed else WhichChanges
First
context :: PatchSelectionContext (PatchInfoAnd rt p)
context = WhichChanges
-> String
-> PatchSelectionOptions
-> Maybe (Splitter (PatchInfoAnd rt p))
-> Maybe [String]
-> PatchSelectionContext (PatchInfoAnd rt p)
forall (rt :: RepoType) (p :: * -> * -> *).
(IsRepoType rt, RepoPatch p) =>
WhichChanges
-> String
-> PatchSelectionOptions
-> Maybe (Splitter (PatchInfoAnd rt p))
-> Maybe [String]
-> PatchSelectionContext (PatchInfoAnd rt p)
selectionContext WhichChanges
direction "send" ([DarcsFlag] -> PatchSelectionOptions
patchSelOpts [DarcsFlag]
opts) Maybe (Splitter (PatchInfoAnd rt p))
forall a. Maybe a
Nothing Maybe [String]
forall a. Maybe a
Nothing
(to_be_sent :: FL (PatchInfoAnd rt p) wZ wZ
to_be_sent :> _) <- FL (PatchInfoAnd rt p) wZ wR
-> PatchSelectionContext (PatchInfoAnd rt p)
-> IO
((:>) (FL (PatchInfoAnd rt p)) (FL (PatchInfoAnd rt p)) wZ wR)
forall (p :: * -> * -> *) wX wY.
(Invert p, Commute p, Apply p, PatchInspect p, ShowPatch p,
ShowContextPatch p, ApplyState p ~ Tree) =>
FL p wX wY
-> PatchSelectionContext p -> IO ((:>) (FL p) (FL p) wX wY)
runSelection FL (PatchInfoAnd rt p) wZ wR
us' PatchSelectionContext (PatchInfoAnd rt p)
context
String
-> Verbosity
-> Summary
-> DryRun
-> XmlOutput
-> Bool
-> FL (PatchInfoAnd rt p) wZ wZ
-> IO ()
forall (p :: * -> * -> *) (rt :: RepoType) wX wY.
(RepoPatch p, ApplyState p ~ Tree) =>
String
-> Verbosity
-> Summary
-> DryRun
-> XmlOutput
-> Bool
-> FL (PatchInfoAnd rt p) wX wY
-> IO ()
printDryRunMessageAndExit "send"
(PrimDarcsOption Verbosity
verbosity PrimDarcsOption Verbosity -> [DarcsFlag] -> Verbosity
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts)
(PrimDarcsOption Summary
O.summary PrimDarcsOption Summary -> [DarcsFlag] -> Summary
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts)
(PrimDarcsOption DryRun
dryRun PrimDarcsOption DryRun -> [DarcsFlag] -> DryRun
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts)
XmlOutput
O.NoXml
(Bool -> [DarcsFlag] -> Bool
isInteractive Bool
True [DarcsFlag]
opts)
FL (PatchInfoAnd rt p) wZ wZ
to_be_sent
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (FL (PatchInfoAnd rt p) wZ wZ -> Bool
forall (a :: * -> * -> *) wX wZ. FL a wX wZ -> Bool
nullFL FL (PatchInfoAnd rt p) wZ wZ
to_be_sent) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ do
[DarcsFlag] -> Doc -> IO ()
putInfo [DarcsFlag]
opts Doc
selectionIsNull
IO ()
forall a. IO a
exitSuccess
FL (PatchInfoAnd rt p) wZ wZ -> IO ()
forall (p :: * -> * -> *) (rt :: RepoType) wX wY.
(RepoPatch p, ApplyState p ~ Tree) =>
FL (PatchInfoAnd rt p) wX wY -> IO ()
setEnvDarcsPatches FL (PatchInfoAnd rt p) wZ wZ
to_be_sent
let genFullBundle :: IO Doc
genFullBundle = [DarcsFlag]
-> PatchSet rt p Origin wZ
-> Either
(FL (PatchInfoAnd rt p) wR wZ)
(Tree IO,
(:\/:) (FL (PatchInfoAnd rt p)) (FL (PatchInfoAnd rt p)) wR wZ)
-> IO Doc
forall (rt :: RepoType) (p :: * -> * -> *) wX wY wZ.
(RepoPatch p, ApplyState p ~ Tree) =>
[DarcsFlag]
-> PatchSet rt p Origin wZ
-> Either
(FL (PatchInfoAnd rt p) wX wY)
(Tree IO,
(:\/:) (FL (PatchInfoAnd rt p)) (FL (PatchInfoAnd rt p)) wX wY)
-> IO Doc
prepareBundle [DarcsFlag]
opts PatchSet rt p Origin wZ
common ((Tree IO,
(:\/:) (FL (PatchInfoAnd rt p)) (FL (PatchInfoAnd rt p)) wR wZ)
-> Either
(FL (PatchInfoAnd rt p) wR wZ)
(Tree IO,
(:\/:) (FL (PatchInfoAnd rt p)) (FL (PatchInfoAnd rt p)) wR wZ)
forall a b. b -> Either a b
Right (Tree IO
pristine, FL (PatchInfoAnd rt p) wZ wR
us'FL (PatchInfoAnd rt p) wZ wR
-> FL (PatchInfoAnd rt p) wZ wZ
-> (:\/:) (FL (PatchInfoAnd rt p)) (FL (PatchInfoAnd rt p)) wR wZ
forall (a1 :: * -> * -> *) (a2 :: * -> * -> *) wX wY wZ.
a1 wZ wX -> a2 wZ wY -> (:\/:) a1 a2 wX wY
:\/:FL (PatchInfoAnd rt p) wZ wZ
to_be_sent))
Doc
bundle <- if Bool -> Bool
not (PrimDarcsOption Bool
minimize PrimDarcsOption Bool -> [DarcsFlag] -> Bool
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts)
then IO Doc
genFullBundle
else do [DarcsFlag] -> Doc -> IO ()
putInfo [DarcsFlag]
opts "Minimizing context, to send with full context hit ctrl-C..."
( case PatchSet rt p Origin wZ
-> FL (PatchInfoAnd rt p) wZ wZ
-> Sealed ((:>) (PatchSet rt p) (FL (PatchInfoAnd rt p)) Origin)
forall (p :: * -> * -> *) (rt :: RepoType) wStart wB wC.
RepoPatch p =>
PatchSet rt p wStart wB
-> FL (PatchInfoAnd rt p) wB wC
-> Sealed ((:>) (PatchSet rt p) (FL (PatchInfoAnd rt p)) wStart)
minContext PatchSet rt p Origin wZ
common FL (PatchInfoAnd rt p) wZ wZ
to_be_sent of
Sealed (common' :: PatchSet rt p Origin wZ
common' :> to_be_sent' :: FL (PatchInfoAnd rt p) wZ wX
to_be_sent') -> [DarcsFlag]
-> PatchSet rt p Origin wZ
-> Either
(FL (PatchInfoAnd rt p) wZ wX)
(Tree IO,
(:\/:) (FL (PatchInfoAnd rt p)) (FL (PatchInfoAnd rt p)) wZ wX)
-> IO Doc
forall (rt :: RepoType) (p :: * -> * -> *) wX wY wZ.
(RepoPatch p, ApplyState p ~ Tree) =>
[DarcsFlag]
-> PatchSet rt p Origin wZ
-> Either
(FL (PatchInfoAnd rt p) wX wY)
(Tree IO,
(:\/:) (FL (PatchInfoAnd rt p)) (FL (PatchInfoAnd rt p)) wX wY)
-> IO Doc
prepareBundle [DarcsFlag]
opts PatchSet rt p Origin wZ
common' (FL (PatchInfoAnd rt p) wZ wX
-> Either
(FL (PatchInfoAnd rt p) wZ wX)
(Tree IO,
(:\/:) (FL (PatchInfoAnd rt p)) (FL (PatchInfoAnd rt p)) wZ wX)
forall a b. a -> Either a b
Left FL (PatchInfoAnd rt p) wZ wX
to_be_sent') )
IO Doc -> IO Doc -> IO Doc
forall a. IO a -> IO a -> IO a
`catchInterrupt` IO Doc
genFullBundle
AbsolutePath
here <- IO AbsolutePath
getCurrentDirectory
let make_fname :: FL (PatchInfoAnd rt p) wX wZ -> String
make_fname (tb :: PatchInfoAnd rt p wX wY
tb:>:_) = String -> String
patchFilename (String -> String) -> String -> String
forall a b. (a -> b) -> a -> b
$ PatchInfoAnd rt p wX wY -> String
forall (rt :: RepoType) (p :: * -> * -> *) wX wY.
PatchInfoAnd rt p wX wY -> String
patchDesc PatchInfoAnd rt p wX wY
tb
make_fname _ = String
forall a. a
impossible
fname :: String
fname = FL (PatchInfoAnd rt p) wZ wZ -> String
forall (rt :: RepoType) (p :: * -> * -> *) wX wZ.
FL (PatchInfoAnd rt p) wX wZ -> String
make_fname FL (PatchInfoAnd rt p) wZ wZ
to_be_sent
outname :: Maybe AbsolutePathOrStd
outname = case [DarcsFlag] -> String -> Maybe AbsolutePathOrStd
getOutput [DarcsFlag]
opts String
fname of
Just f :: AbsolutePathOrStd
f -> AbsolutePathOrStd -> Maybe AbsolutePathOrStd
forall a. a -> Maybe a
Just AbsolutePathOrStd
f
Nothing | (Bool, Maybe String) -> Bool
forall a b. (a, b) -> a
fst (PrimDarcsOption (Bool, Maybe String)
O.sendmail PrimDarcsOption (Bool, Maybe String)
-> [DarcsFlag] -> (Bool, Maybe String)
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) -> Maybe AbsolutePathOrStd
forall a. Maybe a
Nothing
| Bool -> Bool
not (Bool -> Bool) -> Bool -> Bool
forall a b. (a -> b) -> a -> b
$ [String] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [ String
p | Post p :: String
p <- [WhatToDo]
wtds] -> Maybe AbsolutePathOrStd
forall a. Maybe a
Nothing
| Bool
otherwise -> AbsolutePathOrStd -> Maybe AbsolutePathOrStd
forall a. a -> Maybe a
Just (AbsolutePath -> String -> AbsolutePathOrStd
makeAbsoluteOrStd AbsolutePath
here String
fname)
case Maybe AbsolutePathOrStd
outname of
Just fname' :: AbsolutePathOrStd
fname' -> [DarcsFlag]
-> FL (PatchInfoAnd rt p) wZ wZ
-> Doc
-> AbsolutePathOrStd
-> [WhatToDo]
-> String
-> IO ()
forall (rt :: RepoType) (p :: * -> * -> *) wX wY.
(RepoPatch p, ApplyState p ~ Tree) =>
[DarcsFlag]
-> FL (PatchInfoAnd rt p) wX wY
-> Doc
-> AbsolutePathOrStd
-> [WhatToDo]
-> String
-> IO ()
writeBundleToFile [DarcsFlag]
opts FL (PatchInfoAnd rt p) wZ wZ
to_be_sent Doc
bundle AbsolutePathOrStd
fname' [WhatToDo]
wtds String
their_name
Nothing -> [DarcsFlag]
-> FL (PatchInfoAnd rt p) wZ wZ
-> Doc
-> String
-> [WhatToDo]
-> String
-> IO ()
forall (rt :: RepoType) (p :: * -> * -> *) wX wY.
(RepoPatch p, ApplyState p ~ Tree) =>
[DarcsFlag]
-> FL (PatchInfoAnd rt p) wX wY
-> Doc
-> String
-> [WhatToDo]
-> String
-> IO ()
sendBundle [DarcsFlag]
opts FL (PatchInfoAnd rt p) wZ wZ
to_be_sent Doc
bundle String
fname [WhatToDo]
wtds String
their_name
prepareBundle :: forall rt p wX wY wZ. (RepoPatch p, ApplyState p ~ Tree)
=> [DarcsFlag] -> PatchSet rt p Origin wZ
-> Either (FL (PatchInfoAnd rt p) wX wY)
(Tree IO, (FL (PatchInfoAnd rt p) :\/: FL (PatchInfoAnd rt p)) wX wY)
-> IO Doc
prepareBundle :: [DarcsFlag]
-> PatchSet rt p Origin wZ
-> Either
(FL (PatchInfoAnd rt p) wX wY)
(Tree IO,
(:\/:) (FL (PatchInfoAnd rt p)) (FL (PatchInfoAnd rt p)) wX wY)
-> IO Doc
prepareBundle opts :: [DarcsFlag]
opts common :: PatchSet rt p Origin wZ
common e :: Either
(FL (PatchInfoAnd rt p) wX wY)
(Tree IO,
(:\/:) (FL (PatchInfoAnd rt p)) (FL (PatchInfoAnd rt p)) wX wY)
e = do
Doc
unsig_bundle <-
case Either
(FL (PatchInfoAnd rt p) wX wY)
(Tree IO,
(:\/:) (FL (PatchInfoAnd rt p)) (FL (PatchInfoAnd rt p)) wX wY)
e of
(Right (pristine :: Tree IO
pristine, us' :: FL (PatchInfoAnd rt p) wZ wX
us' :\/: to_be_sent :: FL (PatchInfoAnd rt p) wZ wY
to_be_sent)) -> do
Tree IO
pristine' <- FL (WrappedNamed rt p) wX wZ -> Tree IO -> IO (Tree IO)
forall (p :: * -> * -> *) (m :: * -> *) wX wY.
(Apply p, Monad m, ApplyState p ~ Tree) =>
p wX wY -> Tree m -> m (Tree m)
applyToTree (FL (WrappedNamed rt p) wZ wX -> FL (WrappedNamed rt p) wX wZ
forall (p :: * -> * -> *) wX wY. Invert p => p wX wY -> p wY wX
invert (FL (WrappedNamed rt p) wZ wX -> FL (WrappedNamed rt p) wX wZ)
-> FL (WrappedNamed rt p) wZ wX -> FL (WrappedNamed rt p) wX wZ
forall a b. (a -> b) -> a -> b
$ (forall wW wY. PatchInfoAnd rt p wW wY -> WrappedNamed rt p wW wY)
-> FL (PatchInfoAnd rt p) wZ wX -> FL (WrappedNamed rt p) wZ wX
forall (a :: * -> * -> *) (b :: * -> * -> *) wX wZ.
(forall wW wY. a wW wY -> b wW wY) -> FL a wX wZ -> FL b wX wZ
mapFL_FL forall wW wY. PatchInfoAnd rt p wW wY -> WrappedNamed rt p wW wY
forall (rt :: RepoType) (p :: * -> * -> *) wA wB.
PatchInfoAnd rt p wA wB -> WrappedNamed rt p wA wB
hopefully FL (PatchInfoAnd rt p) wZ wX
us') Tree IO
pristine
Maybe (Tree IO)
-> PatchSet rt p Any wZ -> FL (WrappedNamed rt p) wZ wY -> IO Doc
forall (p :: * -> * -> *) (rt :: RepoType) wStart wX wY.
(ApplyState p ~ Tree, RepoPatch p) =>
Maybe (Tree IO)
-> PatchSet rt p wStart wX
-> FL (WrappedNamed rt p) wX wY
-> IO Doc
makeBundleN (Tree IO -> Maybe (Tree IO)
forall a. a -> Maybe a
Just Tree IO
pristine')
(PatchSet rt p Origin wZ -> PatchSet rt p Any wZ
forall (a :: * -> * -> *) wX wY wB wC. a wX wY -> a wB wC
unsafeCoerceP PatchSet rt p Origin wZ
common)
((forall wW wY. PatchInfoAnd rt p wW wY -> WrappedNamed rt p wW wY)
-> FL (PatchInfoAnd rt p) wZ wY -> FL (WrappedNamed rt p) wZ wY
forall (a :: * -> * -> *) (b :: * -> * -> *) wX wZ.
(forall wW wY. a wW wY -> b wW wY) -> FL a wX wZ -> FL b wX wZ
mapFL_FL forall wW wY. PatchInfoAnd rt p wW wY -> WrappedNamed rt p wW wY
forall (rt :: RepoType) (p :: * -> * -> *) wA wB.
PatchInfoAnd rt p wA wB -> WrappedNamed rt p wA wB
hopefully FL (PatchInfoAnd rt p) wZ wY
to_be_sent)
Left to_be_sent :: FL (PatchInfoAnd rt p) wX wY
to_be_sent -> Maybe (Tree IO)
-> PatchSet rt p Any wX -> FL (WrappedNamed rt p) wX wY -> IO Doc
forall (p :: * -> * -> *) (rt :: RepoType) wStart wX wY.
(ApplyState p ~ Tree, RepoPatch p) =>
Maybe (Tree IO)
-> PatchSet rt p wStart wX
-> FL (WrappedNamed rt p) wX wY
-> IO Doc
makeBundleN Maybe (Tree IO)
forall a. Maybe a
Nothing
(PatchSet rt p Origin wZ -> PatchSet rt p Any wX
forall (a :: * -> * -> *) wX wY wB wC. a wX wY -> a wB wC
unsafeCoerceP PatchSet rt p Origin wZ
common)
((forall wW wY. PatchInfoAnd rt p wW wY -> WrappedNamed rt p wW wY)
-> FL (PatchInfoAnd rt p) wX wY -> FL (WrappedNamed rt p) wX wY
forall (a :: * -> * -> *) (b :: * -> * -> *) wX wZ.
(forall wW wY. a wW wY -> b wW wY) -> FL a wX wZ -> FL b wX wZ
mapFL_FL forall wW wY. PatchInfoAnd rt p wW wY -> WrappedNamed rt p wW wY
forall (rt :: RepoType) (p :: * -> * -> *) wA wB.
PatchInfoAnd rt p wA wB -> WrappedNamed rt p wA wB
hopefully FL (PatchInfoAnd rt p) wX wY
to_be_sent)
Sign -> Doc -> IO Doc
signString (PrimDarcsOption Sign -> [DarcsFlag] -> Sign
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
parseFlags PrimDarcsOption Sign
O.sign [DarcsFlag]
opts) Doc
unsig_bundle
sendBundle :: forall rt p wX wY . (RepoPatch p, ApplyState p ~ Tree)
=> [DarcsFlag] -> FL (PatchInfoAnd rt p) wX wY
-> Doc -> String -> [WhatToDo] -> String -> IO ()
sendBundle :: [DarcsFlag]
-> FL (PatchInfoAnd rt p) wX wY
-> Doc
-> String
-> [WhatToDo]
-> String
-> IO ()
sendBundle opts :: [DarcsFlag]
opts to_be_sent :: FL (PatchInfoAnd rt p) wX wY
to_be_sent bundle :: Doc
bundle fname :: String
fname wtds :: [WhatToDo]
wtds their_name :: String
their_name=
let
auto_subject :: forall pp wA wB . FL (PatchInfoAnd rt pp) wA wB -> String
auto_subject :: FL (PatchInfoAnd rt pp) wA wB -> String
auto_subject (p :: PatchInfoAnd rt pp wA wY
p:>:NilFL) = "darcs patch: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String -> Int -> String
trim (PatchInfoAnd rt pp wA wY -> String
forall (rt :: RepoType) (p :: * -> * -> *) wX wY.
PatchInfoAnd rt p wX wY -> String
patchDesc PatchInfoAnd rt pp wA wY
p) 57
auto_subject (p :: PatchInfoAnd rt pp wA wY
p:>:ps :: FL (PatchInfoAnd rt pp) wY wB
ps) = "darcs patch: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String -> Int -> String
trim (PatchInfoAnd rt pp wA wY -> String
forall (rt :: RepoType) (p :: * -> * -> *) wX wY.
PatchInfoAnd rt p wX wY -> String
patchDesc PatchInfoAnd rt pp wA wY
p) 43 String -> String -> String
forall a. [a] -> [a] -> [a]
++
" (and " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show (FL (PatchInfoAnd rt pp) wY wB -> Int
forall (a :: * -> * -> *) wX wZ. FL a wX wZ -> Int
lengthFL FL (PatchInfoAnd rt pp) wY wB
ps) String -> String -> String
forall a. [a] -> [a] -> [a]
++ " more)"
auto_subject _ = String -> String
forall a. HasCallStack => String -> a
error "Tried to get a name from empty patch list."
trim :: String -> Int -> String
trim st :: String
st n :: Int
n = if String -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length String
st Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
<= Int
n then String
st
else Int -> String -> String
forall a. Int -> [a] -> [a]
take (Int
nInt -> Int -> Int
forall a. Num a => a -> a -> a
-3) String
st String -> String -> String
forall a. [a] -> [a] -> [a]
++ "..."
in do
[WhatToDo]
thetargets <- [WhatToDo] -> IO [WhatToDo]
getTargets [WhatToDo]
wtds
String
from <- Maybe String -> Bool -> IO String
getAuthor (PrimDarcsOption (Maybe String)
author PrimDarcsOption (Maybe String) -> [DarcsFlag] -> Maybe String
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) Bool
False
let thesubject :: String
thesubject = String -> Maybe String -> String
forall a. a -> Maybe a -> a
fromMaybe (FL (PatchInfoAnd rt p) wX wY -> String
forall (pp :: * -> * -> *) wA wB.
FL (PatchInfoAnd rt pp) wA wB -> String
auto_subject FL (PatchInfoAnd rt p) wX wY
to_be_sent) (Maybe String -> String) -> Maybe String -> String
forall a b. (a -> b) -> a -> b
$ [DarcsFlag] -> Maybe String
getSubject [DarcsFlag]
opts
(mailcontents :: Doc
mailcontents, mailfile :: Maybe String
mailfile, mailcharset :: Maybe String
mailcharset) <- [DarcsFlag]
-> String
-> FL (PatchInfoAnd rt p) wX wY
-> IO (Doc, Maybe String, Maybe String)
forall (p :: * -> * -> *) (rt :: RepoType) wX wY.
(RepoPatch p, ApplyState p ~ Tree) =>
[DarcsFlag]
-> String
-> FL (PatchInfoAnd rt p) wX wY
-> IO (Doc, Maybe String, Maybe String)
getDescription [DarcsFlag]
opts String
their_name FL (PatchInfoAnd rt p) wX wY
to_be_sent
let warnMailBody :: IO ()
warnMailBody = case Maybe String
mailfile of
Just mf :: String
mf -> Doc -> IO ()
putDocLn (Doc -> IO ()) -> Doc -> IO ()
forall a b. (a -> b) -> a -> b
$ String -> Doc
emailBackedUp String
mf
Nothing -> () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
warnCharset :: String -> IO ()
warnCharset msg :: String
msg = do
Bool
confirmed <- String -> IO Bool
promptYorn (String -> IO Bool) -> String -> IO Bool
forall a b. (a -> b) -> a -> b
$ String -> String
promptCharSetWarning String
msg
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless Bool
confirmed (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ do
Doc -> IO ()
putDocLn Doc
charsetAborted
IO ()
warnMailBody
IO ()
forall a. IO a
exitSuccess
Maybe String
thecharset <- case PrimDarcsOption (Maybe String)
charset PrimDarcsOption (Maybe String) -> [DarcsFlag] -> Maybe String
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts of
providedCset :: Maybe String
providedCset@(Just _) -> Maybe String -> IO (Maybe String)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe String
providedCset
Nothing ->
case Maybe String
mailcharset of
Nothing -> do
String -> IO ()
warnCharset String
charsetCouldNotGuess
Maybe String -> IO (Maybe String)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe String
mailcharset
Just "utf-8" -> do
String
encoding <- IO String
getSystemEncoding
String -> IO ()
debugMessage (String -> IO ()) -> String -> IO ()
forall a b. (a -> b) -> a -> b
$ String -> String
currentEncodingIs String
encoding
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (String -> Bool
isUTF8Locale String
encoding) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
String -> IO ()
warnCharset String
charsetUtf8MailDiffLocale
Maybe String -> IO (Maybe String)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe String
mailcharset
Just _ -> Maybe String -> IO (Maybe String)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe String
mailcharset
let body :: Doc
body = String
-> [(String, String)]
-> Maybe Doc
-> Maybe String
-> Doc
-> Maybe String
-> Doc
makeEmail String
their_name
([(String, String)]
-> (String -> [(String, String)])
-> Maybe String
-> [(String, String)]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\x :: String
x -> [("In-Reply-To", String
x), ("References", String
x)]) (Maybe String -> [(String, String)])
-> ([DarcsFlag] -> Maybe String)
-> [DarcsFlag]
-> [(String, String)]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [DarcsFlag] -> Maybe String
getInReplyTo ([DarcsFlag] -> [(String, String)])
-> [DarcsFlag] -> [(String, String)]
forall a b. (a -> b) -> a -> b
$ [DarcsFlag]
opts)
(Doc -> Maybe Doc
forall a. a -> Maybe a
Just Doc
mailcontents)
Maybe String
thecharset
Doc
bundle
(String -> Maybe String
forall a. a -> Maybe a
Just String
fname)
contentAndBundle :: Maybe (Doc, Doc)
contentAndBundle = (Doc, Doc) -> Maybe (Doc, Doc)
forall a. a -> Maybe a
Just (Doc
mailcontents, Doc
bundle)
sendmail :: IO ()
sendmail = do
String
sm_cmd <- [DarcsFlag] -> IO String
getSendmailCmd [DarcsFlag]
opts
let to :: String
to = [WhatToDo] -> String
generateEmailToString [WhatToDo]
thetargets
String
-> String
-> String
-> String
-> String
-> Maybe (Doc, Doc)
-> Doc
-> IO ()
sendEmailDoc String
from String
to String
thesubject ([DarcsFlag] -> String
getCc [DarcsFlag]
opts)
String
sm_cmd Maybe (Doc, Doc)
contentAndBundle Doc
body IO () -> IO () -> IO ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
[DarcsFlag] -> Doc -> IO ()
putInfo [DarcsFlag]
opts (String -> String -> Doc
success String
to ([DarcsFlag] -> String
getCc [DarcsFlag]
opts))
IO () -> (IOError -> IO ()) -> IO ()
forall e a. Exception e => IO a -> (e -> IO a) -> IO a
`catch` \e :: IOError
e -> do IO ()
warnMailBody
String -> IO ()
forall (m :: * -> *) a. MonadFail m => String -> m a
fail (String -> IO ()) -> String -> IO ()
forall a b. (a -> b) -> a -> b
$ IOError -> String
ioeGetErrorString IOError
e
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when ([String] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [ String
p | Post p :: String
p <- [WhatToDo]
thetargets]) IO ()
sendmail
ByteString
nbody <- ((Handle, String) -> IO ByteString) -> IO ByteString
forall a. ((Handle, String) -> IO a) -> IO a
withOpenTemp (((Handle, String) -> IO ByteString) -> IO ByteString)
-> ((Handle, String) -> IO ByteString) -> IO ByteString
forall a b. (a -> b) -> a -> b
$ \ (fh :: Handle
fh,fn :: String
fn) -> do
let to :: String
to = [WhatToDo] -> String
generateEmailToString [WhatToDo]
thetargets
Handle -> String -> String -> String -> String -> Doc -> IO ()
generateEmail Handle
fh String
from String
to String
thesubject ([DarcsFlag] -> String
getCc [DarcsFlag]
opts) Doc
body
Handle -> IO ()
hClose Handle
fh
String -> IO ByteString
mmapFilePS String
fn
[String] -> (String -> IO ()) -> IO ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
t a -> (a -> m b) -> m ()
forM_ [ String
p | Post p :: String
p <- [WhatToDo]
thetargets]
(\url :: String
url -> do
[DarcsFlag] -> Doc -> IO ()
putInfo [DarcsFlag]
opts (Doc -> IO ()) -> Doc -> IO ()
forall a b. (a -> b) -> a -> b
$ String -> Doc
postingPatch String
url
String -> String -> String -> IO ()
postUrl String
url (ByteString -> String
BC.unpack ByteString
nbody) "message/rfc822")
IO () -> (IOError -> IO ()) -> IO ()
forall e a. Exception e => IO a -> (e -> IO a) -> IO a
`catch` (\(IOError
_ :: IOException) -> IO ()
sendmail)
[DarcsFlag] -> Maybe String -> IO ()
forall t. FilePathLike t => [DarcsFlag] -> Maybe t -> IO ()
cleanup [DarcsFlag]
opts Maybe String
mailfile
generateEmailToString :: [WhatToDo] -> String
generateEmailToString :: [WhatToDo] -> String
generateEmailToString = String -> [String] -> String
forall a. [a] -> [[a]] -> [a]
intercalate " , " ([String] -> String)
-> ([WhatToDo] -> [String]) -> [WhatToDo] -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (String -> Bool) -> [String] -> [String]
forall a. (a -> Bool) -> [a] -> [a]
filter (String -> String -> Bool
forall a. Eq a => a -> a -> Bool
/= "") ([String] -> [String])
-> ([WhatToDo] -> [String]) -> [WhatToDo] -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (WhatToDo -> String) -> [WhatToDo] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map WhatToDo -> String
extractEmail
where
extractEmail :: WhatToDo -> String
extractEmail (SendMail t :: String
t) = String
t
extractEmail _ = ""
cleanup :: (FilePathLike t) => [DarcsFlag] -> Maybe t -> IO ()
cleanup :: [DarcsFlag] -> Maybe t -> IO ()
cleanup opts :: [DarcsFlag]
opts (Just mailfile :: t
mailfile) = Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Maybe AbsolutePath -> Bool
forall a. Maybe a -> Bool
isNothing ([DarcsFlag] -> Maybe AbsolutePath
hasLogfile [DarcsFlag]
opts) Bool -> Bool -> Bool
|| [DarcsFlag] -> Bool
willRemoveLogFile [DarcsFlag]
opts) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
t -> IO ()
forall p. FilePathLike p => p -> IO ()
removeFileMayNotExist t
mailfile
cleanup _ Nothing = () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
writeBundleToFile :: forall rt p wX wY . (RepoPatch p, ApplyState p ~ Tree)
=> [DarcsFlag] -> FL (PatchInfoAnd rt p) wX wY -> Doc ->
AbsolutePathOrStd -> [WhatToDo] -> String -> IO ()
writeBundleToFile :: [DarcsFlag]
-> FL (PatchInfoAnd rt p) wX wY
-> Doc
-> AbsolutePathOrStd
-> [WhatToDo]
-> String
-> IO ()
writeBundleToFile opts :: [DarcsFlag]
opts to_be_sent :: FL (PatchInfoAnd rt p) wX wY
to_be_sent bundle :: Doc
bundle fname :: AbsolutePathOrStd
fname wtds :: [WhatToDo]
wtds their_name :: String
their_name =
do (d :: Doc
d,f :: Maybe String
f,_) <- [DarcsFlag]
-> String
-> FL (PatchInfoAnd rt p) wX wY
-> IO (Doc, Maybe String, Maybe String)
forall (p :: * -> * -> *) (rt :: RepoType) wX wY.
(RepoPatch p, ApplyState p ~ Tree) =>
[DarcsFlag]
-> String
-> FL (PatchInfoAnd rt p) wX wY
-> IO (Doc, Maybe String, Maybe String)
getDescription [DarcsFlag]
opts String
their_name FL (PatchInfoAnd rt p) wX wY
to_be_sent
let putabs :: a -> IO ()
putabs a :: a
a = do a -> Doc -> IO ()
forall p. FilePathLike p => p -> Doc -> IO ()
writeDocBinFile a
a (Doc
d Doc -> Doc -> Doc
$$ Doc
bundle)
Doc -> IO ()
putDocLn (a -> Doc
forall a. FilePathLike a => a -> Doc
wroteBundle a
a)
putstd :: IO ()
putstd = Doc -> IO ()
putDoc (Doc
d Doc -> Doc -> Doc
$$ Doc
bundle)
(AbsolutePath -> IO ()) -> IO () -> AbsolutePathOrStd -> IO ()
forall a. (AbsolutePath -> a) -> a -> AbsolutePathOrStd -> a
useAbsoluteOrStd AbsolutePath -> IO ()
forall p. FilePathLike p => p -> IO ()
putabs IO ()
putstd AbsolutePathOrStd
fname
let to :: String
to = [WhatToDo] -> String
generateEmailToString [WhatToDo]
wtds
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (String -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null String
to) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ [DarcsFlag] -> Doc -> IO ()
putInfo [DarcsFlag]
opts (Doc -> IO ()) -> Doc -> IO ()
forall a b. (a -> b) -> a -> b
$ String -> Doc
savedButNotSent String
to
[DarcsFlag] -> Maybe String -> IO ()
forall t. FilePathLike t => [DarcsFlag] -> Maybe t -> IO ()
cleanup [DarcsFlag]
opts Maybe String
f
data WhatToDo
= Post String
| SendMail String
decideOnBehavior :: [DarcsFlag] -> Maybe (Repository rt p wR wU wT) -> IO [WhatToDo]
decideOnBehavior :: [DarcsFlag] -> Maybe (Repository rt p wR wU wT) -> IO [WhatToDo]
decideOnBehavior opts :: [DarcsFlag]
opts remote_repo :: Maybe (Repository rt p wR wU wT)
remote_repo =
case [WhatToDo]
the_targets of
[] -> do [WhatToDo]
wtds <- case Maybe (Repository rt p wR wU wT)
remote_repo of
Nothing -> [WhatToDo] -> IO [WhatToDo]
forall (m :: * -> *) a. Monad m => a -> m a
return []
Just r :: Repository rt p wR wU wT
r -> Repository rt p wR wU wT -> IO [WhatToDo]
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
Repository rt p wR wU wT -> IO [WhatToDo]
check_post Repository rt p wR wU wT
r
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless ([WhatToDo] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [WhatToDo]
wtds) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ [WhatToDo] -> IO ()
announce_recipients [WhatToDo]
wtds
[WhatToDo] -> IO [WhatToDo]
forall (m :: * -> *) a. Monad m => a -> m a
return [WhatToDo]
wtds
ts :: [WhatToDo]
ts -> do [WhatToDo] -> IO ()
announce_recipients [WhatToDo]
ts
[WhatToDo] -> IO [WhatToDo]
forall (m :: * -> *) a. Monad m => a -> m a
return [WhatToDo]
ts
where the_targets :: [WhatToDo]
the_targets = [DarcsFlag] -> [WhatToDo]
collectTargets [DarcsFlag]
opts
check_post :: Repository rt p wR wU wT -> IO [WhatToDo]
check_post the_remote_repo :: Repository rt p wR wU wT
the_remote_repo =
do [WhatToDo]
p <- ((String -> [WhatToDo]
readPost (String -> [WhatToDo])
-> (ByteString -> String) -> ByteString -> [WhatToDo]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> String
BC.unpack) (ByteString -> [WhatToDo]) -> IO ByteString -> IO [WhatToDo]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap`
String -> Cachable -> IO ByteString
fetchFilePS (String -> String
prefsUrl (Repository rt p wR wU wT -> String
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
Repository rt p wR wU wT -> String
repoLocation Repository rt p wR wU wT
the_remote_repo) String -> String -> String
forall a. [a] -> [a] -> [a]
++ "/post")
(CInt -> Cachable
MaxAge 600)) IO [WhatToDo] -> IO [WhatToDo] -> IO [WhatToDo]
forall a. IO a -> IO a -> IO a
`catchall` [WhatToDo] -> IO [WhatToDo]
forall (m :: * -> *) a. Monad m => a -> m a
return []
[WhatToDo]
emails <- Repository rt p wR wU wT -> IO [WhatToDo]
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
Repository rt p wR wU wT -> IO [WhatToDo]
who_to_email Repository rt p wR wU wT
the_remote_repo
[WhatToDo] -> IO [WhatToDo]
forall (m :: * -> *) a. Monad m => a -> m a
return ([WhatToDo]
p[WhatToDo] -> [WhatToDo] -> [WhatToDo]
forall a. [a] -> [a] -> [a]
++[WhatToDo]
emails)
readPost :: String -> [WhatToDo]
readPost = (String -> WhatToDo) -> [String] -> [WhatToDo]
forall a b. (a -> b) -> [a] -> [b]
map String -> WhatToDo
parseLine ([String] -> [WhatToDo])
-> (String -> [String]) -> String -> [WhatToDo]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> [String]
lines where
parseLine :: String -> WhatToDo
parseLine t :: String
t = WhatToDo -> (String -> WhatToDo) -> Maybe String -> WhatToDo
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (String -> WhatToDo
Post String
t) String -> WhatToDo
SendMail (Maybe String -> WhatToDo) -> Maybe String -> WhatToDo
forall a b. (a -> b) -> a -> b
$ String -> String -> Maybe String
forall a. Eq a => [a] -> [a] -> Maybe [a]
stripPrefix "mailto:" String
t
who_to_email :: Repository rt p wR wU wT -> IO [WhatToDo]
who_to_email repo :: Repository rt p wR wU wT
repo =
do String
email <- (ByteString -> String
BC.unpack (ByteString -> String) -> IO ByteString -> IO String
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap`
String -> Cachable -> IO ByteString
fetchFilePS (String -> String
prefsUrl (Repository rt p wR wU wT -> String
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
Repository rt p wR wU wT -> String
repoLocation Repository rt p wR wU wT
repo) String -> String -> String
forall a. [a] -> [a] -> [a]
++ "/email")
(CInt -> Cachable
MaxAge 600))
IO String -> IO String -> IO String
forall a. IO a -> IO a -> IO a
`catchall` String -> IO String
forall (m :: * -> *) a. Monad m => a -> m a
return ""
if '@' Char -> String -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` String
email then [WhatToDo] -> IO [WhatToDo]
forall (m :: * -> *) a. Monad m => a -> m a
return ([WhatToDo] -> IO [WhatToDo])
-> ([String] -> [WhatToDo]) -> [String] -> IO [WhatToDo]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (String -> WhatToDo) -> [String] -> [WhatToDo]
forall a b. (a -> b) -> [a] -> [b]
map String -> WhatToDo
SendMail ([String] -> IO [WhatToDo]) -> [String] -> IO [WhatToDo]
forall a b. (a -> b) -> a -> b
$ String -> [String]
lines String
email
else [WhatToDo] -> IO [WhatToDo]
forall (m :: * -> *) a. Monad m => a -> m a
return []
announce_recipients :: [WhatToDo] -> IO ()
announce_recipients emails :: [WhatToDo]
emails =
let pn :: WhatToDo -> String
pn (SendMail s :: String
s) = String
s
pn (Post p :: String
p) = String
p
msg :: Doc
msg = DryRun -> [String] -> Doc
willSendTo (PrimDarcsOption DryRun
dryRun PrimDarcsOption DryRun -> [DarcsFlag] -> DryRun
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) ((WhatToDo -> String) -> [WhatToDo] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map WhatToDo -> String
pn [WhatToDo]
emails)
in case PrimDarcsOption DryRun
dryRun PrimDarcsOption DryRun -> [DarcsFlag] -> DryRun
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts of
O.YesDryRun -> [DarcsFlag] -> Doc -> IO ()
putInfo [DarcsFlag]
opts Doc
msg
O.NoDryRun -> Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when ([WhatToDo] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [WhatToDo]
the_targets Bool -> Bool -> Bool
&& Maybe AbsolutePathOrStd -> Bool
forall a. Maybe a -> Bool
isNothing ([DarcsFlag] -> String -> Maybe AbsolutePathOrStd
getOutput [DarcsFlag]
opts "")) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
[DarcsFlag] -> Doc -> IO ()
putInfo [DarcsFlag]
opts Doc
msg
getTargets :: [WhatToDo] -> IO [WhatToDo]
getTargets :: [WhatToDo] -> IO [WhatToDo]
getTargets [] = (String -> [WhatToDo]) -> IO String -> IO [WhatToDo]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((WhatToDo -> [WhatToDo] -> [WhatToDo]
forall a. a -> [a] -> [a]
:[]) (WhatToDo -> [WhatToDo])
-> (String -> WhatToDo) -> String -> [WhatToDo]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> WhatToDo
SendMail) (IO String -> IO [WhatToDo]) -> IO String -> IO [WhatToDo]
forall a b. (a -> b) -> a -> b
$ String -> IO String
askUser String
promptTarget
getTargets wtds :: [WhatToDo]
wtds = [WhatToDo] -> IO [WhatToDo]
forall (m :: * -> *) a. Monad m => a -> m a
return [WhatToDo]
wtds
collectTargets :: [DarcsFlag] -> [WhatToDo]
collectTargets :: [DarcsFlag] -> [WhatToDo]
collectTargets flags :: [DarcsFlag]
flags = [ String -> WhatToDo
f String
t | String
t <- HeaderFields -> [String]
O._to (PrimDarcsOption HeaderFields
O.headerFields PrimDarcsOption HeaderFields -> [DarcsFlag] -> HeaderFields
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
flags) ] where
f :: String -> WhatToDo
f url :: String
url | "http:" String -> String -> Bool
forall a. Eq a => [a] -> [a] -> Bool
`isPrefixOf` String
url = String -> WhatToDo
Post String
url
f em :: String
em = String -> WhatToDo
SendMail String
em
getDescription :: (RepoPatch p, ApplyState p ~ Tree)
=> [DarcsFlag] -> String -> FL (PatchInfoAnd rt p) wX wY -> IO (Doc, Maybe String, Maybe String)
getDescription :: [DarcsFlag]
-> String
-> FL (PatchInfoAnd rt p) wX wY
-> IO (Doc, Maybe String, Maybe String)
getDescription opts :: [DarcsFlag]
opts their_name :: String
their_name patches :: FL (PatchInfoAnd rt p) wX wY
patches =
case Maybe String
get_filename of
Just file :: String
file -> do
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (PrimDarcsOption Bool
editDescription PrimDarcsOption Bool -> [DarcsFlag] -> Bool
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ do
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Maybe AbsolutePath -> Bool
forall a. Maybe a -> Bool
isNothing (Maybe AbsolutePath -> Bool) -> Maybe AbsolutePath -> Bool
forall a b. (a -> b) -> a -> b
$ [DarcsFlag] -> Maybe AbsolutePath
hasLogfile [DarcsFlag]
opts) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
String -> Doc -> IO ()
forall p. FilePathLike p => p -> Doc -> IO ()
writeDocBinFile String
file Doc
patchdesc
String -> IO ()
debugMessage (String -> IO ()) -> String -> IO ()
forall a b. (a -> b) -> a -> b
$ String -> String
aboutToEdit String
file
(_, changed :: Bool
changed) <- String -> IO (ExitCode, Bool)
forall p. FilePathLike p => p -> IO (ExitCode, Bool)
editFile String
file
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless Bool
changed (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ do
Bool
confirmed <- String -> IO Bool
promptYorn String
promptNoDescriptionChange
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless Bool
confirmed (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ do Doc -> IO ()
putDocLn Doc
aborted
IO ()
forall a. IO a
exitSuccess
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
String
updatedFile <- String -> IO String
updateFilename String
file
Doc
doc <- String -> IO Doc
forall p. FilePathLike p => p -> IO Doc
readDocBinFile String
updatedFile
(Doc, Maybe String, Maybe String)
-> IO (Doc, Maybe String, Maybe String)
forall (m :: * -> *) a. Monad m => a -> m a
return (Doc
doc, String -> Maybe String
forall a. a -> Maybe a
Just String
updatedFile, Doc -> Maybe String
forall a. IsString a => Doc -> Maybe a
tryGetCharset Doc
doc)
Nothing -> (Doc, Maybe String, Maybe String)
-> IO (Doc, Maybe String, Maybe String)
forall (m :: * -> *) a. Monad m => a -> m a
return (Doc
patchdesc, Maybe String
forall a. Maybe a
Nothing, Doc -> Maybe String
forall a. IsString a => Doc -> Maybe a
tryGetCharset Doc
patchdesc)
where patchdesc :: Doc
patchdesc = String -> Doc
text (Int -> String
forall a. Show a => a -> String
show Int
len)
Doc -> Doc -> Doc
<+> String -> Doc
text (Int -> Noun -> String -> String
forall n. Countable n => Int -> n -> String -> String
englishNum Int
len (String -> Noun
Noun "patch") "")
Doc -> Doc -> Doc
<+> String -> Doc
text "for repository" Doc -> Doc -> Doc
<+> String -> Doc
text String
their_name Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> String -> Doc
text ":"
Doc -> Doc -> Doc
$$ String -> Doc
text ""
Doc -> Doc -> Doc
$$ [Doc] -> Doc
vsep ((forall wW wZ. PatchInfoAnd rt p wW wZ -> Doc)
-> FL (PatchInfoAnd rt p) wX wY -> [Doc]
forall (a :: * -> * -> *) b wX wY.
(forall wW wZ. a wW wZ -> b) -> FL a wX wY -> [b]
mapFL forall wW wZ. PatchInfoAnd rt p wW wZ -> Doc
forall (p :: * -> * -> *) wX wY. ShowPatch p => p wX wY -> Doc
description FL (PatchInfoAnd rt p) wX wY
patches)
where
len :: Int
len = FL (PatchInfoAnd rt p) wX wY -> Int
forall (a :: * -> * -> *) wX wZ. FL a wX wZ -> Int
lengthFL FL (PatchInfoAnd rt p) wX wY
patches
updateFilename :: String -> IO String
updateFilename file :: String
file =
IO String
-> (AbsolutePath -> IO String) -> Maybe AbsolutePath -> IO String
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (String -> String -> IO ()
renameFile String
file String
darcsSendMessageFinal IO () -> IO String -> IO String
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
String -> IO String
forall (m :: * -> *) a. Monad m => a -> m a
return String
darcsSendMessageFinal) (String -> IO String
forall (m :: * -> *) a. Monad m => a -> m a
return (String -> IO String)
-> (AbsolutePath -> String) -> AbsolutePath -> IO String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. AbsolutePath -> String
forall a. FilePathLike a => a -> String
toFilePath) (Maybe AbsolutePath -> IO String)
-> Maybe AbsolutePath -> IO String
forall a b. (a -> b) -> a -> b
$ [DarcsFlag] -> Maybe AbsolutePath
hasLogfile [DarcsFlag]
opts
get_filename :: Maybe String
get_filename = case [DarcsFlag] -> Maybe AbsolutePath
hasLogfile [DarcsFlag]
opts of
Just f :: AbsolutePath
f -> String -> Maybe String
forall a. a -> Maybe a
Just (String -> Maybe String) -> String -> Maybe String
forall a b. (a -> b) -> a -> b
$ AbsolutePath -> String
forall a. FilePathLike a => a -> String
toFilePath AbsolutePath
f
Nothing -> if PrimDarcsOption Bool
editDescription PrimDarcsOption Bool -> [DarcsFlag] -> Bool
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts
then String -> Maybe String
forall a. a -> Maybe a
Just String
darcsSendMessage
else Maybe String
forall a. Maybe a
Nothing
tryGetCharset :: Doc -> Maybe a
tryGetCharset content :: Doc
content = let body :: ByteString
body = Doc -> ByteString
renderPS Doc
content in
if ByteString -> Bool
isAscii ByteString
body
then a -> Maybe a
forall a. a -> Maybe a
Just "us-ascii"
else (UnicodeException -> Maybe a)
-> (Text -> Maybe a) -> Either UnicodeException Text -> Maybe a
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either (Maybe a -> UnicodeException -> Maybe a
forall a b. a -> b -> a
const Maybe a
forall a. Maybe a
Nothing)
(Maybe a -> Text -> Maybe a
forall a b. a -> b -> a
const (Maybe a -> Text -> Maybe a) -> Maybe a -> Text -> Maybe a
forall a b. (a -> b) -> a -> b
$ a -> Maybe a
forall a. a -> Maybe a
Just "utf-8")
(ByteString -> Either UnicodeException Text
decodeUtf8' ByteString
body)
cmdDescription :: String
cmdDescription :: String
cmdDescription =
"Prepare a bundle of patches to be applied to some target repository."
cmdHelp :: String
cmdHelp :: String
cmdHelp = [String] -> String
unlines
[ "Send is used to prepare a bundle of patches that can be applied to a target"
, "repository. Send accepts the URL of the repository as an argument. When"
, "called without an argument, send will use the most recent repository that"
, "was either pushed to, pulled from or sent to. By default, the patch bundle"
, "is saved to a file, although you may directly send it by mail."
, ""
, "The `--output`, `--output-auto-name`, and `--to` flags determine"
, "what darcs does with the patch bundle after creating it. If you provide an"
, "`--output` argument, the patch bundle is saved to that file. If you"
, "specify `--output-auto-name`, the patch bundle is saved to a file with an"
, "automatically generated name. If you give one or more `--to` arguments,"
, "the bundle of patches is sent to those locations. The locations may either"
, "be email addresses or urls that the patch should be submitted to via HTTP."
, ""
, "If you provide the `--mail` flag, darcs will look at the contents"
, "of the `_darcs/prefs/email` file in the target repository (if it exists),"
, "and send the patch by email to that address. In this case, you may use"
, "the `--cc` option to specify additional recipients without overriding the"
, "default repository email address."
, ""
, "If `_darcs/prefs/post` exists in the target repository, darcs will"
, "upload to the URL contained in that file, which may either be a"
, "`mailto:` URL, or an `http://` URL. In the latter case, the"
, "patch is posted to that URL."
, ""
, "If there is no email address associated with the repository, darcs will"
, "prompt you for an email address."
, ""
, "Use the `--subject` flag to set the subject of the e-mail to be sent."
, "If you don't provide a subject on the command line, darcs will make one up"
, "based on names of the patches in the patch bundle."
, ""
, "Use the `--in-reply-to` flag to set the In-Reply-To and References headers"
, "of the e-mail to be sent. By default no additional headers are included so"
, "e-mail will not be treated as reply by mail readers."
, ""
, "If you want to include a description or explanation along with the bundle"
, "of patches, you need to specify the `--edit-description` flag, which"
, "will cause darcs to open up an editor with which you can compose a message"
, "to go along with your patches."
, ""
, "If you want to use a command different from the default one for sending"
, "email, you need to specify a command line with the `--sendmail-command`"
, "option. The command line can contain some format specifiers which are"
, "replaced by the actual values. Accepted format specifiers are `%s` for"
, "subject, `%t` for to, `%c` for cc, `%b` for the body of the mail, `%f` for"
, "from, `%a` for the patch bundle and the same specifiers in uppercase for the"
, "URL-encoded values."
, "Additionally you can add `%<` to the end of the command line if the command"
, "expects the complete email message on standard input. E.g. the command lines"
, "for evolution and msmtp look like this:"
, ""
, " evolution \"mailto:%T?subject=%S&attach=%A&cc=%C&body=%B\""
, " msmtp -t %<"
, ""
, "Do not confuse the `--author` options with the return address"
, "that `darcs send` will set for your patch bundle."
, ""
, "For example, if you have two email addresses A and B:"
, ""
, "* If you use `--author A` but your machine is configured to send mail from"
, " address B by default, then the return address on your message will be B."
, "* If you use `--from A` and your mail client supports setting the"
, " From: address arbitrarily (some non-Unix-like mail clients, especially,"
, " may not support this), then the return address will be A; if it does"
, " not support this, then the return address will be B."
, "* If you supply neither `--from` nor `--author` then the return"
, " address will be B."
, ""
, "In addition, unless you specify the sendmail command with"
, "`--sendmail-command`, darcs sends email using the default email"
, "command on your computer. This default command is determined by the"
, "`configure` script. Thus, on some non-Unix-like OSes,"
, "`--from` is likely to not work at all."
]
cannotSendToSelf :: String
cannotSendToSelf :: String
cannotSendToSelf = "Can't send to current repository! Did you mean send --context?"
creatingPatch :: String -> Doc
creatingPatch :: String -> Doc
creatingPatch repodir :: String
repodir = "Creating patch to" Doc -> Doc -> Doc
<+> String -> Doc
text (String -> String
quote String
repodir) Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> "..."
noWorkingSendmail :: Doc
noWorkingSendmail :: Doc
noWorkingSendmail = "No working sendmail instance on your machine!"
nothingSendable :: Doc
nothingSendable :: Doc
nothingSendable = "No recorded local changes to send!"
selectionIs :: [Doc] -> Doc
selectionIs :: [Doc] -> Doc
selectionIs descs :: [Doc]
descs = String -> Doc
text "We have the following patches to send:" Doc -> Doc -> Doc
$$ [Doc] -> Doc
vcat [Doc]
descs
selectionIsNull :: Doc
selectionIsNull :: Doc
selectionIsNull = String -> Doc
text "You don't want to send any patches, and that's fine with me!"
emailBackedUp :: String -> Doc
emailBackedUp :: String -> Doc
emailBackedUp mf :: String
mf = Doc -> Doc
sentence (Doc -> Doc) -> Doc -> Doc
forall a b. (a -> b) -> a -> b
$ "Email body left in" Doc -> Doc -> Doc
<+> String -> Doc
text String
mf
promptCharSetWarning :: String -> String
promptCharSetWarning :: String -> String
promptCharSetWarning msg :: String
msg = "Warning: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
msg String -> String -> String
forall a. [a] -> [a] -> [a]
++ " Send anyway?"
charsetAborted :: Doc
charsetAborted :: Doc
charsetAborted = "Aborted. You can specify charset with the --charset option."
charsetCouldNotGuess :: String
charsetCouldNotGuess :: String
charsetCouldNotGuess = "darcs could not guess the charset of your mail."
currentEncodingIs :: String -> String
currentEncodingIs :: String -> String
currentEncodingIs e :: String
e = "Current locale encoding: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
e
charsetUtf8MailDiffLocale :: String
charsetUtf8MailDiffLocale :: String
charsetUtf8MailDiffLocale = "your mail is valid UTF-8 but your locale differs."
aborted :: Doc
aborted :: Doc
aborted = "Aborted."
success :: String -> String -> Doc
success :: String -> String -> Doc
success to :: String
to cc :: String
cc = Doc -> Doc
sentence (Doc -> Doc) -> Doc -> Doc
forall a b. (a -> b) -> a -> b
$
"Successfully sent patch bundle to:" Doc -> Doc -> Doc
<+> String -> Doc
text String
to Doc -> Doc -> Doc
<+> String -> Doc
copies String
cc
where
copies :: String -> Doc
copies "" = ""
copies x :: String
x = "and cc'ed" Doc -> Doc -> Doc
<+> String -> Doc
text String
x
postingPatch :: String -> Doc
postingPatch :: String -> Doc
postingPatch url :: String
url = "Posting patch to" Doc -> Doc -> Doc
<+> String -> Doc
text String
url
wroteBundle :: FilePathLike a => a -> Doc
wroteBundle :: a -> Doc
wroteBundle a :: a
a = Doc -> Doc
sentence (Doc -> Doc) -> Doc -> Doc
forall a b. (a -> b) -> a -> b
$ "Wrote patch to" Doc -> Doc -> Doc
<+> String -> Doc
text (a -> String
forall a. FilePathLike a => a -> String
toFilePath a
a)
savedButNotSent :: String -> Doc
savedButNotSent :: String -> Doc
savedButNotSent to :: String
to =
String -> Doc
text ("The usual recipent for this bundle is: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
to)
Doc -> Doc -> Doc
$$ String -> Doc
text "To send it automatically, make sure sendmail is working,"
Doc -> Doc -> Doc
<+> String -> Doc
text "and add 'send mail' to _darcs/prefs/defaults or"
Doc -> Doc -> Doc
<+> String -> Doc
text " ~/.darcs/defaults"
willSendTo :: DryRun -> [String] -> Doc
willSendTo :: DryRun -> [String] -> Doc
willSendTo dr :: DryRun
dr addresses :: [String]
addresses =
"Patch bundle" Doc -> Doc -> Doc
<+> Doc
will Doc -> Doc -> Doc
<+> " be sent to:" Doc -> Doc -> Doc
<+> String -> Doc
text ([String] -> String
unwords [String]
addresses)
where
will :: Doc
will = case DryRun
dr of { YesDryRun -> "would"; NoDryRun -> "will" }
promptTarget :: String
promptTarget :: String
promptTarget = "What is the target email address? "
aboutToEdit :: FilePath -> String
aboutToEdit :: String -> String
aboutToEdit file :: String
file = "About to edit file " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
file
promptNoDescriptionChange :: String
promptNoDescriptionChange :: String
promptNoDescriptionChange = "File content did not change. Continue anyway?"