{-# LANGUAGE OverloadedStrings #-}
module Darcs.UI.Commands.Record
( record
, commit
, recordConfig, RecordConfig(..)
) where
import Prelude ()
import Darcs.Prelude
import Data.Foldable ( traverse_ )
import Control.Exception ( handleJust )
import Control.Monad ( when, unless, void )
import Data.List ( sort )
import Data.Char ( ord )
import System.Exit ( exitFailure, exitSuccess, ExitCode(..) )
import System.Directory ( removeFile )
import Darcs.Patch.PatchInfoAnd ( n2pia )
import Darcs.Repository
( Repository
, withRepoLock
, RepoJob(..)
, tentativelyAddPatch
, finalizeRepositoryChanges
, invalidateIndex
, unrecordedChanges
, readRecorded
)
import Darcs.Patch ( IsRepoType, RepoPatch, PrimOf, fromPrims )
import Darcs.Patch.Named.Wrapped ( namepatch, adddeps )
import Darcs.Patch.Witnesses.Ordered
( FL(..), (:>)(..), nullFL )
import Darcs.Patch.Info ( PatchInfo )
import Darcs.Patch.Apply( ApplyState )
import Darcs.Patch.Split ( primSplitter )
import Darcs.UI.SelectChanges
( WhichChanges(..)
, selectionContextPrim
, runSelection
, askAboutDepends
)
import qualified Darcs.UI.SelectChanges as S ( PatchSelectionOptions(..) )
import Darcs.Util.Path ( SubPath, toFilePath, AbsolutePath )
import Darcs.UI.Commands
( DarcsCommand(..), withStdOpts
, nodefaults
, commandAlias
, setEnvDarcsFiles
, setEnvDarcsPatches
, amInHashedRepository
)
import Darcs.UI.Commands.Util ( announceFiles, filterExistingPaths,
testTentativeAndMaybeExit )
import Darcs.UI.Completion ( modifiedFileArgs )
import Darcs.UI.Flags
( DarcsFlag
, fileHelpAuthor
, getAuthor
, getDate
, diffOpts
, scanKnown
, fixSubPaths
)
import Darcs.UI.Options ( DarcsOption, (^), odesc, ocheck, oparse, defaultFlags )
import Darcs.UI.PatchHeader ( getLog )
import qualified Darcs.UI.Options.All as O
import Darcs.Repository.Flags ( UpdateWorking (..), DryRun(NoDryRun), ScanKnown(..) )
import Darcs.Util.Exception ( clarifyErrors )
import Darcs.Util.Prompt ( promptYorn )
import Darcs.Util.Progress ( debugMessage )
import Darcs.Util.Global ( darcsLastMessage )
import Darcs.Patch.Progress ( progressFL )
import Darcs.Util.Printer ( putDocLn, text, (<+>) )
import Darcs.Util.Text ( pathlist )
import Darcs.Util.Tree( Tree )
recordDescription :: String
recordDescription :: String
recordDescription = "Create a patch from unrecorded changes."
recordHelp :: String
recordHelp :: String
recordHelp =
"The `darcs record` command is used to create a patch from changes in\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"the working tree. If you specify a set of files and directories,\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"changes to other files will be skipped.\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
recordHelp' String -> String -> String
forall a. [a] -> [a] -> [a]
++
"\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
recordHelp''
recordBasicOpts :: DarcsOption a
(Maybe String
-> Maybe String
-> O.TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe O.AskLongComment
-> O.LookFor
-> Maybe String
-> O.WithContext
-> O.DiffAlgorithm
-> a)
recordBasicOpts :: DarcsOption
a
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
recordBasicOpts
= PrimOptSpec
DarcsOptDescr
Flag
(Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Maybe String)
PrimDarcsOption (Maybe String)
O.patchname
PrimOptSpec
DarcsOptDescr
Flag
(Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Maybe String)
-> OptSpec
DarcsOptDescr
Flag
(TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
-> OptSpec
DarcsOptDescr
Flag
(TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
Flag
(TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
PrimDarcsOption (Maybe String)
O.author
OptSpec
DarcsOptDescr
Flag
(TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
-> OptSpec
DarcsOptDescr
Flag
(Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
-> OptSpec
DarcsOptDescr
Flag
(Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
Flag
(Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
PrimDarcsOption TestChanges
O.testChanges
OptSpec
DarcsOptDescr
Flag
(Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
-> OptSpec
DarcsOptDescr
Flag
(Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
-> OptSpec
DarcsOptDescr
Flag
(Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
Flag
(Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
PrimDarcsOption (Maybe Bool)
O.interactive
OptSpec
DarcsOptDescr
Flag
(Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
-> OptSpec
DarcsOptDescr
Flag
(Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
-> OptSpec
DarcsOptDescr
Flag
(Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
Flag
(Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
PrimDarcsOption Bool
O.pipe
OptSpec
DarcsOptDescr
Flag
(Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
-> OptSpec
DarcsOptDescr
Flag
(Maybe AskLongComment
-> LookFor -> Maybe String -> WithContext -> DiffAlgorithm -> a)
(Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
-> OptSpec
DarcsOptDescr
Flag
(Maybe AskLongComment
-> LookFor -> Maybe String -> WithContext -> DiffAlgorithm -> a)
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
Flag
(Maybe AskLongComment
-> LookFor -> Maybe String -> WithContext -> DiffAlgorithm -> a)
(Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
PrimDarcsOption Bool
O.askDeps
OptSpec
DarcsOptDescr
Flag
(Maybe AskLongComment
-> LookFor -> Maybe String -> WithContext -> DiffAlgorithm -> a)
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
-> OptSpec
DarcsOptDescr
Flag
(LookFor -> Maybe String -> WithContext -> DiffAlgorithm -> a)
(Maybe AskLongComment
-> LookFor -> Maybe String -> WithContext -> DiffAlgorithm -> a)
-> OptSpec
DarcsOptDescr
Flag
(LookFor -> Maybe String -> WithContext -> DiffAlgorithm -> a)
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
Flag
(LookFor -> Maybe String -> WithContext -> DiffAlgorithm -> a)
(Maybe AskLongComment
-> LookFor -> Maybe String -> WithContext -> DiffAlgorithm -> a)
PrimDarcsOption (Maybe AskLongComment)
O.askLongComment
OptSpec
DarcsOptDescr
Flag
(LookFor -> Maybe String -> WithContext -> DiffAlgorithm -> a)
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
-> OptSpec
DarcsOptDescr
Flag
(Maybe String -> WithContext -> DiffAlgorithm -> a)
(LookFor -> Maybe String -> WithContext -> DiffAlgorithm -> a)
-> OptSpec
DarcsOptDescr
Flag
(Maybe String -> WithContext -> DiffAlgorithm -> a)
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
Flag
(Maybe String -> WithContext -> DiffAlgorithm -> a)
(LookFor -> Maybe String -> WithContext -> DiffAlgorithm -> a)
PrimDarcsOption LookFor
O.lookfor
OptSpec
DarcsOptDescr
Flag
(Maybe String -> WithContext -> DiffAlgorithm -> a)
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
-> OptSpec
DarcsOptDescr
Flag
(WithContext -> DiffAlgorithm -> a)
(Maybe String -> WithContext -> DiffAlgorithm -> a)
-> OptSpec
DarcsOptDescr
Flag
(WithContext -> DiffAlgorithm -> a)
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
Flag
(WithContext -> DiffAlgorithm -> a)
(Maybe String -> WithContext -> DiffAlgorithm -> a)
PrimDarcsOption (Maybe String)
O.repoDir
OptSpec
DarcsOptDescr
Flag
(WithContext -> DiffAlgorithm -> a)
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
-> OptSpec
DarcsOptDescr
Flag
(DiffAlgorithm -> a)
(WithContext -> DiffAlgorithm -> a)
-> OptSpec
DarcsOptDescr
Flag
(DiffAlgorithm -> a)
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
Flag
(DiffAlgorithm -> a)
(WithContext -> DiffAlgorithm -> a)
PrimDarcsOption WithContext
O.withContext
OptSpec
DarcsOptDescr
Flag
(DiffAlgorithm -> a)
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
-> OptSpec DarcsOptDescr Flag a (DiffAlgorithm -> a)
-> DarcsOption
a
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec DarcsOptDescr Flag a (DiffAlgorithm -> a)
PrimDarcsOption DiffAlgorithm
O.diffAlgorithm
recordAdvancedOpts :: DarcsOption a
(O.Logfile -> O.Compression -> O.UseIndex -> O.UMask -> O.SetScriptsExecutable -> O.IncludeBoring -> a)
recordAdvancedOpts :: DarcsOption
a
(Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> a)
recordAdvancedOpts = PrimOptSpec
DarcsOptDescr
Flag
(Compression
-> UseIndex -> UMask -> SetScriptsExecutable -> IncludeBoring -> a)
Logfile
PrimDarcsOption Logfile
O.logfile PrimOptSpec
DarcsOptDescr
Flag
(Compression
-> UseIndex -> UMask -> SetScriptsExecutable -> IncludeBoring -> a)
Logfile
-> OptSpec
DarcsOptDescr
Flag
(UseIndex -> UMask -> SetScriptsExecutable -> IncludeBoring -> a)
(Compression
-> UseIndex -> UMask -> SetScriptsExecutable -> IncludeBoring -> a)
-> OptSpec
DarcsOptDescr
Flag
(UseIndex -> UMask -> SetScriptsExecutable -> IncludeBoring -> a)
(Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
Flag
(UseIndex -> UMask -> SetScriptsExecutable -> IncludeBoring -> a)
(Compression
-> UseIndex -> UMask -> SetScriptsExecutable -> IncludeBoring -> a)
PrimDarcsOption Compression
O.compress OptSpec
DarcsOptDescr
Flag
(UseIndex -> UMask -> SetScriptsExecutable -> IncludeBoring -> a)
(Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> a)
-> OptSpec
DarcsOptDescr
Flag
(UMask -> SetScriptsExecutable -> IncludeBoring -> a)
(UseIndex -> UMask -> SetScriptsExecutable -> IncludeBoring -> a)
-> OptSpec
DarcsOptDescr
Flag
(UMask -> SetScriptsExecutable -> IncludeBoring -> a)
(Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
Flag
(UMask -> SetScriptsExecutable -> IncludeBoring -> a)
(UseIndex -> UMask -> SetScriptsExecutable -> IncludeBoring -> a)
PrimDarcsOption UseIndex
O.useIndex OptSpec
DarcsOptDescr
Flag
(UMask -> SetScriptsExecutable -> IncludeBoring -> a)
(Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> a)
-> OptSpec
DarcsOptDescr
Flag
(SetScriptsExecutable -> IncludeBoring -> a)
(UMask -> SetScriptsExecutable -> IncludeBoring -> a)
-> OptSpec
DarcsOptDescr
Flag
(SetScriptsExecutable -> IncludeBoring -> a)
(Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
Flag
(SetScriptsExecutable -> IncludeBoring -> a)
(UMask -> SetScriptsExecutable -> IncludeBoring -> a)
PrimDarcsOption UMask
O.umask OptSpec
DarcsOptDescr
Flag
(SetScriptsExecutable -> IncludeBoring -> a)
(Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> a)
-> OptSpec
DarcsOptDescr
Flag
(IncludeBoring -> a)
(SetScriptsExecutable -> IncludeBoring -> a)
-> OptSpec
DarcsOptDescr
Flag
(IncludeBoring -> a)
(Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
Flag
(IncludeBoring -> a)
(SetScriptsExecutable -> IncludeBoring -> a)
PrimDarcsOption SetScriptsExecutable
O.setScriptsExecutable OptSpec
DarcsOptDescr
Flag
(IncludeBoring -> a)
(Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> a)
-> OptSpec DarcsOptDescr Flag a (IncludeBoring -> a)
-> DarcsOption
a
(Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec DarcsOptDescr Flag a (IncludeBoring -> a)
PrimDarcsOption IncludeBoring
O.includeBoring
data RecordConfig = RecordConfig
{ RecordConfig -> Maybe String
patchname :: Maybe String
, RecordConfig -> Maybe String
author :: Maybe String
, RecordConfig -> TestChanges
testChanges :: O.TestChanges
, RecordConfig -> Maybe Bool
interactive :: Maybe Bool
, RecordConfig -> Bool
pipe :: Bool
, RecordConfig -> Bool
askDeps :: Bool
, :: Maybe O.AskLongComment
, RecordConfig -> LookFor
lookfor :: O.LookFor
, RecordConfig -> Maybe String
_workingRepoDir :: Maybe String
, RecordConfig -> WithContext
withContext :: O.WithContext
, RecordConfig -> DiffAlgorithm
diffAlgorithm :: O.DiffAlgorithm
, RecordConfig -> Verbosity
verbosity :: O.Verbosity
, RecordConfig -> Logfile
logfile :: O.Logfile
, RecordConfig -> Compression
compress :: O.Compression
, RecordConfig -> UseIndex
useIndex :: O.UseIndex
, RecordConfig -> UMask
umask :: O.UMask
, RecordConfig -> SetScriptsExecutable
sse :: O.SetScriptsExecutable
, RecordConfig -> IncludeBoring
includeBoring :: O.IncludeBoring
, RecordConfig -> UseCache
useCache :: O.UseCache
}
recordConfig :: [DarcsFlag] -> RecordConfig
recordConfig :: [Flag] -> RecordConfig
recordConfig = OptSpec
DarcsOptDescr
Flag
RecordConfig
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Verbosity
-> Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> UseCache
-> RecordConfig)
-> (Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Verbosity
-> Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> UseCache
-> RecordConfig)
-> [Flag]
-> RecordConfig
forall (d :: * -> *) f a b. OptSpec d f a b -> b -> [f] -> a
oparse (DarcsOption
(Verbosity
-> Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> UseCache
-> RecordConfig)
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Verbosity
-> Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> UseCache
-> RecordConfig)
forall a.
DarcsOption
a
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
recordBasicOpts DarcsOption
(Verbosity
-> Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> UseCache
-> RecordConfig)
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Verbosity
-> Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> UseCache
-> RecordConfig)
-> OptSpec
DarcsOptDescr
Flag
(Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> UseCache
-> RecordConfig)
(Verbosity
-> Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> UseCache
-> RecordConfig)
-> OptSpec
DarcsOptDescr
Flag
(Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> UseCache
-> RecordConfig)
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Verbosity
-> Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> UseCache
-> RecordConfig)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
Flag
(Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> UseCache
-> RecordConfig)
(Verbosity
-> Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> UseCache
-> RecordConfig)
PrimDarcsOption Verbosity
O.verbosity OptSpec
DarcsOptDescr
Flag
(Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> UseCache
-> RecordConfig)
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Verbosity
-> Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> UseCache
-> RecordConfig)
-> OptSpec
DarcsOptDescr
Flag
(UseCache -> RecordConfig)
(Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> UseCache
-> RecordConfig)
-> OptSpec
DarcsOptDescr
Flag
(UseCache -> RecordConfig)
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Verbosity
-> Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> UseCache
-> RecordConfig)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
Flag
(UseCache -> RecordConfig)
(Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> UseCache
-> RecordConfig)
forall a.
DarcsOption
a
(Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> a)
recordAdvancedOpts OptSpec
DarcsOptDescr
Flag
(UseCache -> RecordConfig)
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Verbosity
-> Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> UseCache
-> RecordConfig)
-> OptSpec
DarcsOptDescr Flag RecordConfig (UseCache -> RecordConfig)
-> OptSpec
DarcsOptDescr
Flag
RecordConfig
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Verbosity
-> Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> UseCache
-> RecordConfig)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec DarcsOptDescr Flag RecordConfig (UseCache -> RecordConfig)
PrimDarcsOption UseCache
O.useCache) Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Verbosity
-> Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> UseCache
-> RecordConfig
RecordConfig
record :: DarcsCommand RecordConfig
record :: DarcsCommand RecordConfig
record = DarcsCommand :: forall parsedFlags.
String
-> String
-> String
-> String
-> Int
-> [String]
-> ((AbsolutePath, AbsolutePath)
-> parsedFlags -> [String] -> IO ())
-> ([Flag] -> IO (Either String ()))
-> ((AbsolutePath, AbsolutePath)
-> [Flag] -> [String] -> IO [String])
-> ([Flag] -> AbsolutePath -> [String] -> IO [String])
-> [DarcsOptDescr Flag]
-> [DarcsOptDescr Flag]
-> [Flag]
-> ([Flag] -> [String])
-> ([Flag] -> parsedFlags)
-> DarcsCommand parsedFlags
DarcsCommand
{ commandProgramName :: String
commandProgramName = "darcs"
, commandName :: String
commandName = "record"
, commandHelp :: String
commandHelp = String
recordHelp
, commandDescription :: String
commandDescription = String
recordDescription
, commandExtraArgs :: Int
commandExtraArgs = -1
, commandExtraArgHelp :: [String]
commandExtraArgHelp = ["[FILE or DIRECTORY]..."]
, commandCommand :: (AbsolutePath, AbsolutePath) -> RecordConfig -> [String] -> IO ()
commandCommand = (AbsolutePath, AbsolutePath) -> RecordConfig -> [String] -> IO ()
recordCmd
, commandPrereq :: [Flag] -> IO (Either String ())
commandPrereq = [Flag] -> IO (Either String ())
amInHashedRepository
, commandCompleteArgs :: (AbsolutePath, AbsolutePath) -> [Flag] -> [String] -> IO [String]
commandCompleteArgs = (AbsolutePath, AbsolutePath) -> [Flag] -> [String] -> IO [String]
modifiedFileArgs
, commandArgdefaults :: [Flag] -> AbsolutePath -> [String] -> IO [String]
commandArgdefaults = [Flag] -> AbsolutePath -> [String] -> IO [String]
nodefaults
, commandAdvancedOptions :: [DarcsOptDescr Flag]
commandAdvancedOptions = OptSpec
DarcsOptDescr
Flag
Any
(Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> Any)
-> [DarcsOptDescr Flag]
forall (d :: * -> *) f a b. OptSpec d f a b -> [d f]
odesc OptSpec
DarcsOptDescr
Flag
Any
(Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> Any)
forall a.
DarcsOption
a
(Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> a)
recordAdvancedOpts
, commandBasicOptions :: [DarcsOptDescr Flag]
commandBasicOptions = OptSpec
DarcsOptDescr
Flag
Any
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Any)
-> [DarcsOptDescr Flag]
forall (d :: * -> *) f a b. OptSpec d f a b -> [d f]
odesc OptSpec
DarcsOptDescr
Flag
Any
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Any)
forall a.
DarcsOption
a
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
recordBasicOpts
, commandDefaults :: [Flag]
commandDefaults = OptSpec
DarcsOptDescr
Flag
[Flag]
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> UseCache
-> HooksConfig
-> [Flag])
-> [Flag]
forall (d :: * -> *) f b. OptSpec d f [f] b -> [f]
defaultFlags OptSpec
DarcsOptDescr
Flag
[Flag]
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> UseCache
-> HooksConfig
-> [Flag])
forall a.
DarcsOption
a
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> UseCache
-> HooksConfig
-> a)
recordOpts
, commandCheckOptions :: [Flag] -> [String]
commandCheckOptions = OptSpec
DarcsOptDescr
Flag
Any
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> UseCache
-> HooksConfig
-> Any)
-> [Flag] -> [String]
forall (d :: * -> *) f a b. OptSpec d f a b -> [f] -> [String]
ocheck OptSpec
DarcsOptDescr
Flag
Any
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> UseCache
-> HooksConfig
-> Any)
forall a.
DarcsOption
a
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> UseCache
-> HooksConfig
-> a)
recordOpts
, commandParseOptions :: [Flag] -> RecordConfig
commandParseOptions = [Flag] -> RecordConfig
recordConfig
}
where
recordOpts :: DarcsOption
a
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> UseCache
-> HooksConfig
-> a)
recordOpts = DarcsOption
(Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> UseCache
-> HooksConfig
-> a)
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> UseCache
-> HooksConfig
-> a)
forall a.
DarcsOption
a
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
recordBasicOpts DarcsOption
(Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> UseCache
-> HooksConfig
-> a)
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> UseCache
-> HooksConfig
-> a)
-> DarcsOption
(UseCache -> HooksConfig -> a)
(Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> UseCache
-> HooksConfig
-> a)
-> DarcsOption
a
(Maybe String
-> Maybe String
-> TestChanges
-> Maybe Bool
-> Bool
-> Bool
-> Maybe AskLongComment
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> 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
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> UseCache
-> HooksConfig
-> a)
forall a.
DarcsOption
a
(Logfile
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> IncludeBoring
-> a)
recordAdvancedOpts
commit :: DarcsCommand RecordConfig
commit :: DarcsCommand RecordConfig
commit = String
-> Maybe (DarcsCommand RecordConfig)
-> DarcsCommand RecordConfig
-> DarcsCommand RecordConfig
forall pf.
String
-> Maybe (DarcsCommand pf) -> DarcsCommand pf -> DarcsCommand pf
commandAlias "commit" Maybe (DarcsCommand RecordConfig)
forall a. Maybe a
Nothing DarcsCommand RecordConfig
record
reportNonExisting :: ScanKnown -> ([SubPath], [SubPath]) -> IO ()
reportNonExisting :: ScanKnown -> ([SubPath], [SubPath]) -> IO ()
reportNonExisting scan :: ScanKnown
scan (paths_only_in_working :: [SubPath]
paths_only_in_working, _) = do
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (ScanKnown
scan ScanKnown -> ScanKnown -> Bool
forall a. Eq a => a -> a -> Bool
/= ScanKnown
ScanKnown Bool -> Bool -> Bool
|| [SubPath] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [SubPath]
paths_only_in_working) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ Doc -> IO ()
putDocLn (Doc -> IO ()) -> Doc -> IO ()
forall a b. (a -> b) -> a -> b
$
"These paths are not yet in the repository and will be added:" Doc -> Doc -> Doc
<+>
[String] -> Doc
pathlist ((SubPath -> String) -> [SubPath] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map SubPath -> String
forall a. FilePathLike a => a -> String
toFilePath [SubPath]
paths_only_in_working)
recordCmd :: (AbsolutePath, AbsolutePath) -> RecordConfig -> [String] -> IO ()
recordCmd :: (AbsolutePath, AbsolutePath) -> RecordConfig -> [String] -> IO ()
recordCmd fps :: (AbsolutePath, AbsolutePath)
fps cfg :: RecordConfig
cfg args :: [String]
args = do
Maybe String -> Bool -> IO ()
checkNameIsNotOption (RecordConfig -> Maybe String
patchname RecordConfig
cfg) (RecordConfig -> Bool
isInteractive RecordConfig
cfg)
DryRun -> UseCache -> UpdateWorking -> UMask -> RepoJob () -> IO ()
forall a.
DryRun -> UseCache -> UpdateWorking -> UMask -> RepoJob a -> IO a
withRepoLock DryRun
NoDryRun (RecordConfig -> UseCache
useCache RecordConfig
cfg) UpdateWorking
YesUpdateWorking (RecordConfig -> UMask
umask RecordConfig
cfg) (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
let scan :: ScanKnown
scan = LookForAdds -> IncludeBoring -> ScanKnown
scanKnown (LookFor -> LookForAdds
O.adds (RecordConfig -> LookFor
lookfor RecordConfig
cfg)) (RecordConfig -> IncludeBoring
includeBoring RecordConfig
cfg)
Maybe [SubPath]
existing_files <- do
Maybe [SubPath]
files <- if [String] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [String]
args then Maybe [SubPath] -> IO (Maybe [SubPath])
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe [SubPath]
forall a. Maybe a
Nothing
else [SubPath] -> Maybe [SubPath]
forall a. a -> Maybe a
Just ([SubPath] -> Maybe [SubPath])
-> ([SubPath] -> [SubPath]) -> [SubPath] -> Maybe [SubPath]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [SubPath] -> [SubPath]
forall a. Ord a => [a] -> [a]
sort ([SubPath] -> Maybe [SubPath])
-> IO [SubPath] -> IO (Maybe [SubPath])
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (AbsolutePath, AbsolutePath) -> [String] -> IO [SubPath]
fixSubPaths (AbsolutePath, AbsolutePath)
fps [String]
args
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Maybe [SubPath]
files Maybe [SubPath] -> Maybe [SubPath] -> Bool
forall a. Eq a => a -> a -> Bool
== [SubPath] -> Maybe [SubPath]
forall a. a -> Maybe a
Just []) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ String -> IO ()
forall (m :: * -> *) a. MonadFail m => String -> m a
fail "No valid arguments were given."
Maybe ([SubPath], [SubPath])
files' <-
([SubPath] -> IO ([SubPath], [SubPath]))
-> Maybe [SubPath] -> IO (Maybe ([SubPath], [SubPath]))
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse
(Repository rt p wR wU wR
-> Verbosity
-> UseIndex
-> ScanKnown
-> LookForMoves
-> [SubPath]
-> IO ([SubPath], [SubPath])
forall (p :: * -> * -> *) (rt :: RepoType) wR wU wT.
(RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wT
-> Verbosity
-> UseIndex
-> ScanKnown
-> LookForMoves
-> [SubPath]
-> IO ([SubPath], [SubPath])
filterExistingPaths
Repository rt p wR wU wR
repository (RecordConfig -> Verbosity
verbosity RecordConfig
cfg) (RecordConfig -> UseIndex
useIndex RecordConfig
cfg) ScanKnown
scan (LookFor -> LookForMoves
O.moves (RecordConfig -> LookFor
lookfor RecordConfig
cfg)))
Maybe [SubPath]
files
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (RecordConfig -> Verbosity
verbosity RecordConfig
cfg Verbosity -> Verbosity -> Bool
forall a. Eq a => a -> a -> Bool
/= Verbosity
O.Quiet) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
(([SubPath], [SubPath]) -> IO ())
-> Maybe ([SubPath], [SubPath]) -> IO ()
forall (t :: * -> *) (f :: * -> *) a b.
(Foldable t, Applicative f) =>
(a -> f b) -> t a -> f ()
traverse_ (ScanKnown -> ([SubPath], [SubPath]) -> IO ()
reportNonExisting ScanKnown
scan) Maybe ([SubPath], [SubPath])
files'
let files'' :: Maybe [SubPath]
files'' = (([SubPath], [SubPath]) -> [SubPath])
-> Maybe ([SubPath], [SubPath]) -> Maybe [SubPath]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ([SubPath], [SubPath]) -> [SubPath]
forall a b. (a, b) -> b
snd Maybe ([SubPath], [SubPath])
files'
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Maybe [SubPath]
files'' Maybe [SubPath] -> Maybe [SubPath] -> Bool
forall a. Eq a => a -> a -> Bool
== [SubPath] -> Maybe [SubPath]
forall a. a -> Maybe a
Just []) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
String -> IO ()
forall (m :: * -> *) a. MonadFail m => String -> m a
fail "None of the files you specified exist."
Maybe [SubPath] -> IO (Maybe [SubPath])
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe [SubPath]
files''
Verbosity -> Maybe [SubPath] -> String -> IO ()
announceFiles (RecordConfig -> Verbosity
verbosity RecordConfig
cfg) Maybe [SubPath]
existing_files "Recording changes in"
String -> IO ()
debugMessage "About to get the unrecorded changes."
FL (PrimOf p) wR wU
changes <- (UseIndex, ScanKnown, DiffAlgorithm)
-> LookForMoves
-> LookForReplaces
-> Repository rt p wR wU wR
-> Maybe [SubPath]
-> IO (FL (PrimOf p) wR wU)
forall (p :: * -> * -> *) (rt :: RepoType) wR wU wT.
(RepoPatch p, ApplyState p ~ Tree) =>
(UseIndex, ScanKnown, DiffAlgorithm)
-> LookForMoves
-> LookForReplaces
-> Repository rt p wR wU wT
-> Maybe [SubPath]
-> IO (FL (PrimOf p) wT wU)
unrecordedChanges (RecordConfig -> (UseIndex, ScanKnown, DiffAlgorithm)
diffingOpts RecordConfig
cfg)
(LookFor -> LookForMoves
O.moves (RecordConfig -> LookFor
lookfor RecordConfig
cfg)) (LookFor -> LookForReplaces
O.replaces (RecordConfig -> LookFor
lookfor RecordConfig
cfg))
Repository rt p wR wU wR
repository Maybe [SubPath]
existing_files
String -> IO ()
debugMessage "I've got unrecorded changes."
case FL (PrimOf p) wR wU
changes of
NilFL | Bool -> Bool
not (RecordConfig -> Bool
askDeps RecordConfig
cfg) -> do
IO String -> IO ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (Bool -> IO String
getDate (RecordConfig -> Bool
pipe RecordConfig
cfg))
String -> IO ()
putStrLn "No changes!"
IO ()
forall a. IO a
exitFailure
_ -> Repository rt p wR wU wR
-> RecordConfig -> Maybe [SubPath] -> FL (PrimOf p) wR wU -> IO ()
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wX.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wR
-> RecordConfig -> Maybe [SubPath] -> FL (PrimOf p) wR wX -> IO ()
doRecord Repository rt p wR wU wR
repository RecordConfig
cfg Maybe [SubPath]
existing_files FL (PrimOf p) wR wU
changes
checkNameIsNotOption :: Maybe String -> Bool -> IO ()
checkNameIsNotOption :: Maybe String -> Bool -> IO ()
checkNameIsNotOption Nothing _ = () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
checkNameIsNotOption _ False = () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
checkNameIsNotOption (Just name :: String
name) True =
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (String -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length String
name Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== 1 Bool -> Bool -> Bool
|| (String -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length String
name Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== 2 Bool -> Bool -> Bool
&& String -> Char
forall a. [a] -> a
head String
name Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
== '-')) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ do
Bool
confirmed <- String -> IO Bool
promptYorn (String -> IO Bool) -> String -> IO Bool
forall a b. (a -> b) -> a -> b
$ "You specified " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String -> String
forall a. Show a => a -> String
show String
name String -> String -> String
forall a. [a] -> [a] -> [a]
++ " as the patch name. Is that really what you want?"
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless Bool
confirmed (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ String -> IO ()
putStrLn "Okay, aborting the record." IO () -> IO () -> IO ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> IO ()
forall a. IO a
exitFailure
doRecord :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree)
=> Repository rt p wR wU wR -> RecordConfig -> Maybe [SubPath] -> FL (PrimOf p) wR wX -> IO ()
doRecord :: Repository rt p wR wU wR
-> RecordConfig -> Maybe [SubPath] -> FL (PrimOf p) wR wX -> IO ()
doRecord repository :: Repository rt p wR wU wR
repository cfg :: RecordConfig
cfg files :: Maybe [SubPath]
files ps :: FL (PrimOf p) wR wX
ps = do
String
date <- Bool -> IO String
getDate (RecordConfig -> Bool
pipe RecordConfig
cfg)
String
my_author <- Maybe String -> Bool -> IO String
getAuthor (RecordConfig -> Maybe String
author RecordConfig
cfg) (RecordConfig -> Bool
pipe RecordConfig
cfg)
String -> IO ()
debugMessage "I'm slurping the repository."
Tree IO
pristine <- Repository rt p wR wU wR -> 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 wR
repository
String -> IO ()
debugMessage "About to select changes..."
(chs :: FL (PrimOf p) wR wZ
chs :> _ ) <- FL (PrimOf p) wR wX
-> PatchSelectionContext (PrimOf p)
-> IO ((:>) (FL (PrimOf p)) (FL (PrimOf p)) wR wX)
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 (PrimOf p) wR wX
ps (PatchSelectionContext (PrimOf p)
-> IO ((:>) (FL (PrimOf p)) (FL (PrimOf p)) wR wX))
-> PatchSelectionContext (PrimOf p)
-> IO ((:>) (FL (PrimOf p)) (FL (PrimOf p)) wR wX)
forall a b. (a -> b) -> a -> b
$
WhichChanges
-> String
-> PatchSelectionOptions
-> Maybe (Splitter (PrimOf p))
-> Maybe [String]
-> Maybe (Tree IO)
-> PatchSelectionContext (PrimOf p)
forall (prim :: * -> * -> *).
WhichChanges
-> String
-> PatchSelectionOptions
-> Maybe (Splitter prim)
-> Maybe [String]
-> Maybe (Tree IO)
-> PatchSelectionContext prim
selectionContextPrim WhichChanges
First "record" (RecordConfig -> PatchSelectionOptions
patchSelOpts RecordConfig
cfg)
(Splitter (PrimOf p) -> Maybe (Splitter (PrimOf p))
forall a. a -> Maybe a
Just (DiffAlgorithm -> Splitter (PrimOf p)
forall (p :: * -> * -> *).
PrimPatch p =>
DiffAlgorithm -> Splitter p
primSplitter (RecordConfig -> DiffAlgorithm
diffAlgorithm RecordConfig
cfg)))
((SubPath -> String) -> [SubPath] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map SubPath -> String
forall a. FilePathLike a => a -> String
toFilePath ([SubPath] -> [String]) -> Maybe [SubPath] -> Maybe [String]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe [SubPath]
files)
(Tree IO -> Maybe (Tree IO)
forall a. a -> Maybe a
Just Tree IO
pristine)
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Bool -> Bool
not (RecordConfig -> Bool
askDeps RecordConfig
cfg) Bool -> Bool -> Bool
&& FL (PrimOf p) wR wZ -> Bool
forall (a :: * -> * -> *) wX wZ. FL a wX wZ -> Bool
nullFL FL (PrimOf p) wR wZ
chs) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
do String -> IO ()
putStrLn "Ok, if you don't want to record anything, that's fine!"
IO ()
forall a. IO a
exitSuccess
(ExitCode -> Maybe ()) -> (() -> IO ()) -> IO () -> IO ()
forall e b a.
Exception e =>
(e -> Maybe b) -> (b -> IO a) -> IO a -> IO a
handleJust ExitCode -> Maybe ()
onlySuccessfulExits (\_ -> () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
do [PatchInfo]
deps <- if RecordConfig -> Bool
askDeps RecordConfig
cfg
then Repository rt p wR wU wR
-> FL (PrimOf p) wR wZ
-> PatchSelectionOptions
-> [PatchInfo]
-> IO [PatchInfo]
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT wY.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wT
-> FL (PrimOf p) wT wY
-> PatchSelectionOptions
-> [PatchInfo]
-> IO [PatchInfo]
askAboutDepends Repository rt p wR wU wR
repository FL (PrimOf p) wR wZ
chs (RecordConfig -> PatchSelectionOptions
patchSelOpts RecordConfig
cfg) []
else [PatchInfo] -> IO [PatchInfo]
forall (m :: * -> *) a. Monad m => a -> m a
return []
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (RecordConfig -> Bool
askDeps RecordConfig
cfg) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ String -> IO ()
debugMessage "I've asked about dependencies."
if FL (PrimOf p) wR wZ -> Bool
forall (a :: * -> * -> *) wX wZ. FL a wX wZ -> Bool
nullFL FL (PrimOf p) wR wZ
chs Bool -> Bool -> Bool
&& [PatchInfo] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [PatchInfo]
deps
then String -> IO ()
putStrLn "Ok, if you don't want to record anything, that's fine!"
else do FL (PrimOf p) wR wZ -> IO ()
forall (p :: * -> * -> *) wX wY. PatchInspect p => p wX wY -> IO ()
setEnvDarcsFiles FL (PrimOf p) wR wZ
chs
(name :: String
name, my_log :: [String]
my_log, logf :: Maybe String
logf) <- Maybe String
-> Bool
-> Logfile
-> Maybe AskLongComment
-> Maybe (String, [String])
-> FL (PrimOf p) wR wZ
-> IO (String, [String], Maybe String)
forall (prim :: * -> * -> *) wX wY.
PrimPatch prim =>
Maybe String
-> Bool
-> Logfile
-> Maybe AskLongComment
-> Maybe (String, [String])
-> FL prim wX wY
-> IO (String, [String], Maybe String)
getLog (RecordConfig -> Maybe String
patchname RecordConfig
cfg) (RecordConfig -> Bool
pipe RecordConfig
cfg) (RecordConfig -> Logfile
logfile RecordConfig
cfg) (RecordConfig -> Maybe AskLongComment
askLongComment RecordConfig
cfg) Maybe (String, [String])
forall a. Maybe a
Nothing FL (PrimOf p) wR wZ
chs
String -> IO ()
debugMessage ("Patch name as received from getLog: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ [Int] -> String
forall a. Show a => a -> String
show ((Char -> Int) -> String -> [Int]
forall a b. (a -> b) -> [a] -> [b]
map Char -> Int
ord String
name))
Repository rt p wR wU wR
-> RecordConfig
-> String
-> String
-> String
-> [String]
-> Maybe String
-> [PatchInfo]
-> FL (PrimOf p) wR wZ
-> IO ()
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wX.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wR
-> RecordConfig
-> String
-> String
-> String
-> [String]
-> Maybe String
-> [PatchInfo]
-> FL (PrimOf p) wR wX
-> IO ()
doActualRecord Repository rt p wR wU wR
repository RecordConfig
cfg String
name String
date String
my_author [String]
my_log Maybe String
logf [PatchInfo]
deps FL (PrimOf p) wR wZ
chs
doActualRecord :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree)
=> Repository rt p wR wU wR
-> RecordConfig
-> String -> String -> String
-> [String] -> Maybe String
-> [PatchInfo] -> FL (PrimOf p) wR wX -> IO ()
doActualRecord :: Repository rt p wR wU wR
-> RecordConfig
-> String
-> String
-> String
-> [String]
-> Maybe String
-> [PatchInfo]
-> FL (PrimOf p) wR wX
-> IO ()
doActualRecord repository :: Repository rt p wR wU wR
repository cfg :: RecordConfig
cfg name :: String
name date :: String
date my_author :: String
my_author my_log :: [String]
my_log logf :: Maybe String
logf deps :: [PatchInfo]
deps chs :: FL (PrimOf p) wR wX
chs =
do String -> IO ()
debugMessage "Writing the patch file..."
WrappedNamed rt p wR wX
mypatch <- String
-> String
-> String
-> [String]
-> FL p wR wX
-> IO (WrappedNamed rt p wR wX)
forall (p :: * -> * -> *) wX wY (rt :: RepoType).
String
-> String
-> String
-> [String]
-> FL p wX wY
-> IO (WrappedNamed rt p wX wY)
namepatch String
date String
name String
my_author [String]
my_log (FL p wR wX -> IO (WrappedNamed rt p wR wX))
-> FL p wR wX -> IO (WrappedNamed rt p wR wX)
forall a b. (a -> b) -> a -> b
$
FL (PrimOf (FL p)) wR wX -> FL p wR wX
forall (p :: * -> * -> *) wX wY.
FromPrims p =>
FL (PrimOf p) wX wY -> p wX wY
fromPrims (FL (PrimOf (FL p)) wR wX -> FL p wR wX)
-> FL (PrimOf (FL p)) wR wX -> FL p wR wX
forall a b. (a -> b) -> a -> b
$ String -> FL (PrimOf p) wR wX -> FL (PrimOf p) wR wX
forall (a :: * -> * -> *) wX wY. String -> FL a wX wY -> FL a wX wY
progressFL "Writing changes:" FL (PrimOf p) wR wX
chs
let pia :: PatchInfoAnd rt p wR wX
pia = WrappedNamed rt p wR wX -> PatchInfoAnd rt p wR wX
forall (rt :: RepoType) (p :: * -> * -> *) wX wY.
WrappedNamed rt p wX wY -> PatchInfoAnd rt p wX wY
n2pia (WrappedNamed rt p wR wX -> PatchInfoAnd rt p wR wX)
-> WrappedNamed rt p wR wX -> PatchInfoAnd rt p wR wX
forall a b. (a -> b) -> a -> b
$ WrappedNamed rt p wR wX -> [PatchInfo] -> WrappedNamed rt p wR wX
forall (rt :: RepoType) (p :: * -> * -> *) wX wY.
WrappedNamed rt p wX wY -> [PatchInfo] -> WrappedNamed rt p wX wY
adddeps WrappedNamed rt p wR wX
mypatch [PatchInfo]
deps
Repository rt p wR wU wX
_ <- Repository rt p wR wU wR
-> Compression
-> Verbosity
-> UpdateWorking
-> PatchInfoAnd rt p wR wX
-> IO (Repository rt p wR wU wX)
forall (p :: * -> * -> *) (rt :: RepoType) wR wU wT wY.
(RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wT
-> Compression
-> Verbosity
-> UpdateWorking
-> PatchInfoAnd rt p wT wY
-> IO (Repository rt p wR wU wY)
tentativelyAddPatch Repository rt p wR wU wR
repository (RecordConfig -> Compression
compress RecordConfig
cfg) (RecordConfig -> Verbosity
verbosity RecordConfig
cfg) UpdateWorking
YesUpdateWorking
(PatchInfoAnd rt p wR wX -> IO (Repository rt p wR wU wX))
-> PatchInfoAnd rt p wR wX -> IO (Repository rt p wR wU wX)
forall a b. (a -> b) -> a -> b
$ PatchInfoAnd rt p wR wX
pia
Repository rt p wR wU wR -> IO ()
forall t. t -> IO ()
invalidateIndex Repository rt p wR wU wR
repository
String -> IO ()
debugMessage "Applying to pristine..."
Repository rt p wR wU wR
-> Verbosity
-> TestChanges
-> SetScriptsExecutable
-> Bool
-> String
-> String
-> Maybe String
-> IO ()
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
Repository rt p wR wU wT
-> Verbosity
-> TestChanges
-> SetScriptsExecutable
-> Bool
-> String
-> String
-> Maybe String
-> IO ()
testTentativeAndMaybeExit Repository rt p wR wU wR
repository
(RecordConfig -> Verbosity
verbosity RecordConfig
cfg)
(RecordConfig -> TestChanges
testChanges RecordConfig
cfg)
(RecordConfig -> SetScriptsExecutable
sse RecordConfig
cfg)
(RecordConfig -> Bool
isInteractive RecordConfig
cfg)
("you have a bad patch: '" String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
name String -> String -> String
forall a. [a] -> [a] -> [a]
++ "'")
"record it" (String -> Maybe String
forall a. a -> Maybe a
Just String
failuremessage)
Repository rt p wR wU wR -> UpdateWorking -> Compression -> IO ()
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wT -> UpdateWorking -> Compression -> IO ()
finalizeRepositoryChanges Repository rt p wR wU wR
repository UpdateWorking
YesUpdateWorking (RecordConfig -> Compression
compress RecordConfig
cfg)
IO () -> String -> IO ()
forall a. IO a -> String -> IO a
`clarifyErrors` String
failuremessage
String -> IO ()
debugMessage "Syncing timestamps..."
Maybe String -> IO ()
removeLogFile Maybe String
logf
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (RecordConfig -> Verbosity
verbosity RecordConfig
cfg Verbosity -> Verbosity -> Bool
forall a. Eq a => a -> a -> Bool
== Verbosity
O.Quiet) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
Doc -> IO ()
putDocLn (Doc -> IO ()) -> Doc -> IO ()
forall a b. (a -> b) -> a -> b
$ String -> Doc
text (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ "Finished recording patch '" String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
name String -> String -> String
forall a. [a] -> [a] -> [a]
++ "'"
FL (PatchInfoAnd rt p) wR wX -> IO ()
forall (p :: * -> * -> *) (rt :: RepoType) wX wY.
(RepoPatch p, ApplyState p ~ Tree) =>
FL (PatchInfoAnd rt p) wX wY -> IO ()
setEnvDarcsPatches (PatchInfoAnd rt p wR wX
pia PatchInfoAnd rt p wR wX
-> FL (PatchInfoAnd rt p) wX wX -> FL (PatchInfoAnd rt p) wR wX
forall (a :: * -> * -> *) wX wY wZ.
a wX wY -> FL a wY wZ -> FL a wX wZ
:>: FL (PatchInfoAnd rt p) wX wX
forall (a :: * -> * -> *) wX. FL a wX wX
NilFL)
where
removeLogFile :: Maybe String -> IO ()
removeLogFile :: Maybe String -> IO ()
removeLogFile Nothing = () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
removeLogFile (Just lf :: String
lf) | String
lf String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== String
darcsLastMessage = () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
| Bool
otherwise = String -> IO ()
removeFile String
lf
failuremessage :: String
failuremessage = "Failed to record patch '"String -> String -> String
forall a. [a] -> [a] -> [a]
++String
nameString -> String -> String
forall a. [a] -> [a] -> [a]
++"'" String -> String -> String
forall a. [a] -> [a] -> [a]
++
case Maybe String
logf of Just lf :: String
lf -> "\nLogfile left in "String -> String -> String
forall a. [a] -> [a] -> [a]
++String
lfString -> String -> String
forall a. [a] -> [a] -> [a]
++"."
Nothing -> ""
recordHelp' :: String
recordHelp' :: String
recordHelp' = [String] -> String
unlines
[ "Every patch has a name, an optional description, an author and a date."
, ""
, "Darcs will launch a text editor (see `darcs help environment`) after the"
, "interactive selection, to let you enter the patch name (first line) and"
, "the patch description (subsequent lines)."
, ""
, "You can supply the patch name in advance with the `-m` option, in which"
, "case no text editor is launched, unless you use `--edit-long-comment`."
, ""
, "The patch description is an optional block of free-form text. It is"
, "used to supply additional information that doesn't fit in the patch"
, "name. For example, it might include a rationale of WHY the change was"
, "necessary."
, ""
, "A technical difference between patch name and patch description, is"
, "that matching with the flag `-p` is only done on patch names."
, ""
, "Finally, the `--logfile` option allows you to supply a file that already"
, "contains the patch name and description. This is useful if a previous"
, "record failed and left a `_darcs/patch_description.txt` file."
, ""
, [String] -> String
unlines [String]
fileHelpAuthor
, "If you want to manually define any explicit dependencies for your patch,"
, "you can use the `--ask-deps` flag. Some dependencies may be automatically"
, "inferred from the patch's content and cannot be removed. A patch with"
, "specific dependencies can be empty."
, ""
, "The patch date is generated automatically. It can only be spoofed by"
, "using the `--pipe` option."
, ""
, "If you run record with the `--pipe` option, you will be prompted for"
, "the patch date, author, and the long comment. The long comment will extend"
, "until the end of file or stdin is reached. This interface is intended for"
, "scripting darcs, in particular for writing repository conversion scripts."
, "The prompts are intended mostly as a useful guide (since scripts won't"
, "need them), to help you understand the input format. Here's an example of"
, "what the `--pipe` prompts look like:"
, ""
, " What is the date? Mon Nov 15 13:38:01 EST 2004"
, " Who is the author? David Roundy"
, " What is the log? One or more comment lines"
]
onlySuccessfulExits :: ExitCode -> Maybe ()
onlySuccessfulExits :: ExitCode -> Maybe ()
onlySuccessfulExits ExitSuccess = () -> Maybe ()
forall a. a -> Maybe a
Just ()
onlySuccessfulExits _ = Maybe ()
forall a. Maybe a
Nothing
recordHelp'' :: String
recordHelp'' :: String
recordHelp'' =
"If a test command has been defined with `darcs setpref`, attempting to\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"record a patch will cause the test command to be run in a clean copy\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"of the working tree (that is, including only recorded changes). If\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"the test fails, you will be offered to abort the record operation.\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"The `--set-scripts-executable` option causes scripts to be made\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"executable in the clean copy of the working tree, prior to running the\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"test. See `darcs clone` for an explanation of the script heuristic.\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"If your test command is tediously slow (e.g. `make all`) and you are\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"recording several patches in a row, you may wish to use `--no-test` to\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"skip all but the final test.\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"To see some context (unchanged lines) around each change, use the\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"`--unified` option.\n"
patchSelOpts :: RecordConfig -> S.PatchSelectionOptions
patchSelOpts :: RecordConfig -> PatchSelectionOptions
patchSelOpts cfg :: RecordConfig
cfg = PatchSelectionOptions :: Verbosity
-> [MatchFlag]
-> Bool
-> SelectDeps
-> Summary
-> WithContext
-> PatchSelectionOptions
S.PatchSelectionOptions
{ verbosity :: Verbosity
S.verbosity = RecordConfig -> Verbosity
verbosity RecordConfig
cfg
, matchFlags :: [MatchFlag]
S.matchFlags = []
, interactive :: Bool
S.interactive = RecordConfig -> Bool
isInteractive RecordConfig
cfg
, selectDeps :: SelectDeps
S.selectDeps = SelectDeps
O.PromptDeps
, summary :: Summary
S.summary = Summary
O.NoSummary
, withContext :: WithContext
S.withContext = RecordConfig -> WithContext
withContext RecordConfig
cfg
}
diffingOpts :: RecordConfig -> (O.UseIndex, O.ScanKnown, O.DiffAlgorithm)
diffingOpts :: RecordConfig -> (UseIndex, ScanKnown, DiffAlgorithm)
diffingOpts cfg :: RecordConfig
cfg = UseIndex
-> LookForAdds
-> IncludeBoring
-> DiffAlgorithm
-> (UseIndex, ScanKnown, DiffAlgorithm)
diffOpts (RecordConfig -> UseIndex
useIndex RecordConfig
cfg) (LookFor -> LookForAdds
O.adds (RecordConfig -> LookFor
lookfor RecordConfig
cfg)) IncludeBoring
O.NoIncludeBoring (RecordConfig -> DiffAlgorithm
diffAlgorithm RecordConfig
cfg)
isInteractive :: RecordConfig -> Bool
isInteractive :: RecordConfig -> Bool
isInteractive = Bool -> (Bool -> Bool) -> Maybe Bool -> Bool
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Bool
True Bool -> Bool
forall a. a -> a
id (Maybe Bool -> Bool)
-> (RecordConfig -> Maybe Bool) -> RecordConfig -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. RecordConfig -> Maybe Bool
interactive