{- | All the concrete options.

Notes:

  * The term \"option\" refers to a flag or combination of flags that
    together form a part of a command's configuration. Ideally, options
    should be orthogonal to each other, so we can freely combine them.

  * A primitive (indivisible) option has an associate value type.

  * An option named \"xyzActions\" represents a set of flags that act as
    mutually exclusive sub-commands. They typically have a dedicated value
    type named \"XyzAction\".

  * This module is probably best imported qualified. This is in contrast to
    the current practice of using subtly differing names to avoid name
    clashes for closely related items. For instance, the data constructors
    for an option's value type and the corresponding data constructors in
    'F.DarcsFlag' may coincide. This is also why we import "Darcs.UI.Flags"
    qualified here.

  * When the new options system is finally in place, no code other than the
    one for constructing options should directly refer to 'F.DarcsFlag'
    constructors.

-}
module Darcs.UI.Options.All
    ( DarcsOption

    -- conversion to 'Bool'
    , YesNo (..)

    -- root
    , RootAction (..)
    , rootActions

    -- all commands
    , StdCmdAction (..)
    , stdCmdActions
    , debug
    , Verbosity (..) -- re-export
    , verbosity
    , timings
    , debugging
    , HooksConfig (..) -- re-export
    , HookConfig (..) -- re-export
    , preHook
    , postHook
    , hooks
    , UseCache (..) -- re-export
    , useCache

    -- interactivity
    , XmlOutput (..)
    , xmlOutput
    , DryRun (..) -- re-export
    , dryRun
    , dryRunXml
    , interactive
    , pipe
    , WantGuiPause (..) -- re-export
    , pauseForGui
    , askDeps

    -- patch selection
    , module Darcs.UI.Options.Matching -- re-export
    , SelectDeps (..)
    , selectDeps
    , changesReverse
    , maxCount

    -- local or remote repo(s)
    , repoDir
    , RemoteRepos (..) -- re-export
    , remoteRepos
    , possiblyRemoteRepo
    , newRepo
    , NotInRemote (..)
    , notInRemote
    , notInRemoteFlagName
    , RepoCombinator (..)
    , repoCombinator
    , allowUnrelatedRepos
    , justThisRepo
    , WithWorkingDir (..) -- re-export
    , withWorkingDir
    , SetDefault (..) -- re-export
    , setDefault
    , InheritDefault (..) -- re-export
    , inheritDefault

    -- patch meta-data
    , patchname
    , author
    , AskLongComment (..)
    , askLongComment
    , keepDate
    , Logfile (..)
    , logfile

    -- looking for changes
    , LookFor (..)
    , LookForAdds (..) -- re-export
    , LookForMoves (..) -- re-export
    , LookForReplaces (..) -- re-export
    , lookfor
    , lookforadds
    , lookforreplaces
    , lookformoves

    -- files to consider
    , UseIndex (..) -- re-export
    , ScanKnown (..) -- re-export
    , IncludeBoring (..)
    , includeBoring
    , allowProblematicFilenames
    , allowCaseDifferingFilenames
    , allowWindowsReservedFilenames
    , onlyToFiles
    , useIndex
    , recursive

    -- differences
    , DiffAlgorithm (..) -- re-export
    , diffAlgorithm
    , WithContext (..)
    , withContext
    , ExternalDiff (..)
    , extDiff

    -- tests
    , TestChanges (..)
    , testChanges
    , RunTest (..) -- re-export
    , runTest
    , LeaveTestDir (..) -- re-export
    , leaveTestDir

    -- mail related
    , HeaderFields (..)
    , headerFields
    , sendToContext
    , mail
    , sendmailCmd
    , charset
    , editDescription

    -- patch bundles
    , applyAs
    , Sign (..)
    , sign
    , Verify (..)
    , verify

    -- merging patches
    , AllowConflicts (..) -- re-export
    , conflictsNo
    , conflictsYes
    , ExternalMerge (..) -- re-export
    , externalMerge
    , reorder

    -- optimizations
    , Compression (..) -- re-export
    , compress
    , usePacks
    , WithPatchIndex (..) -- re-export
    , patchIndexNo
    , patchIndexYes
    , Reorder (..) -- re-export
    , minimize
    , storeInMemory

    -- miscellaneous
    , Output (..)
    , output
    , WithSummary (..)
    , withSummary
    , maybeSummary
    , RemoteDarcs (..) -- re-export
    , NetworkOptions (..)
    , network
    , UMask (..) -- re-export
    , umask
    , SetScriptsExecutable (..) -- re-export
    , setScriptsExecutable

    -- command specific

    -- amend
    , amendUnrecord
    , selectAuthor

    -- annotate
    , machineReadable

    -- clone
    , CloneKind (..)
    , cloneKind

    -- dist
    , distname
    , distzip

    -- convert import/export, init
    , marks
    , readMarks
    , writeMarks
    , PatchFormat (..)
    , patchFormat
    , hashed

    -- log
    , ChangesFormat (..)
    , changesFormat

    -- replace
    , tokens
    , forceReplace

    -- test
    , TestStrategy (..)
    , testStrategy

    -- show files/index
    , files
    , directories
    , pending
    , nullFlag

    -- show repo
    , EnumPatches (..)
    , enumPatches

    -- gzcrcs
    , GzcrcsAction (..)
    , gzcrcsActions

    -- optimize
    , siblings
    ) where

import Darcs.Prelude

import Darcs.Repository.Flags
    ( Compression (..)
    , RemoteDarcs (..)
    , Reorder (..)
    , Verbosity (..)
    , UseCache (..)
    , UMask (..)
    , DryRun (..)
    , LookForAdds (..)
    , LookForMoves (..)
    , LookForReplaces (..)
    , DiffAlgorithm (..)
    , RunTest (..)
    , SetScriptsExecutable (..)
    , LeaveTestDir (..)
    , RemoteRepos (..)
    , SetDefault (..)
    , InheritDefault (..)
    , UseIndex (..)
    , ScanKnown (..)
    , CloneKind (..)
    , ExternalMerge (..)
    , AllowConflicts (..)
    , WantGuiPause (..)
    , WithPatchIndex (..)
    , WithWorkingDir (..)
    , PatchFormat (..)
    , IncludeBoring (..)
    , HooksConfig (..)
    , HookConfig (..)
    )

import qualified Darcs.UI.Options.Flags as F ( DarcsFlag(..) )
import Darcs.UI.Options.Core
import Darcs.UI.Options.Iso
import Darcs.UI.Options.Util
import Darcs.UI.Options.Matching

-- * Type instantiations

-- | 'DarcsOption' instantiates the first two type parameters of 'OptSpec' to
-- what we need in darcs. The first parameter is instantiated to
-- The flag type is instantiate to 'Flag'.
type DarcsOption = OptSpec DarcsOptDescr Flag

type RawDarcsOption = forall v. v -> RawOptSpec Flag v

-- * Conversion to 'Bool'

class YesNo a where
  yes :: a -> Bool
  no :: a -> Bool
  no = Bool -> Bool
not forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. YesNo a => a -> Bool
yes

instance YesNo Compression where
  yes :: Compression -> Bool
yes Compression
NoCompression = Bool
False
  yes Compression
GzipCompression = Bool
True

instance YesNo WithPatchIndex where
  yes :: WithPatchIndex -> Bool
yes WithPatchIndex
NoPatchIndex = Bool
False
  yes WithPatchIndex
YesPatchIndex = Bool
True

instance YesNo Reorder where
  yes :: Reorder -> Bool
yes Reorder
NoReorder = Bool
False
  yes Reorder
Reorder = Bool
True

instance YesNo UseCache where
  yes :: UseCache -> Bool
yes UseCache
NoUseCache = Bool
False
  yes UseCache
YesUseCache = Bool
True

instance YesNo DryRun where
  yes :: DryRun -> Bool
yes DryRun
NoDryRun = Bool
False
  yes DryRun
YesDryRun = Bool
True

instance YesNo LookForAdds where
  yes :: LookForAdds -> Bool
yes LookForAdds
NoLookForAdds = Bool
False
  yes LookForAdds
YesLookForAdds = Bool
True

instance YesNo LookForReplaces where
  yes :: LookForReplaces -> Bool
yes LookForReplaces
NoLookForReplaces = Bool
False
  yes LookForReplaces
YesLookForReplaces = Bool
True

instance YesNo LookForMoves where
  yes :: LookForMoves -> Bool
yes LookForMoves
NoLookForMoves = Bool
False
  yes LookForMoves
YesLookForMoves = Bool
True

instance YesNo IncludeBoring where
  yes :: IncludeBoring -> Bool
yes IncludeBoring
NoIncludeBoring = Bool
False
  yes IncludeBoring
YesIncludeBoring = Bool
True

instance YesNo RunTest where
  yes :: RunTest -> Bool
yes RunTest
NoRunTest = Bool
False
  yes RunTest
YesRunTest = Bool
True

instance YesNo SetScriptsExecutable where
  yes :: SetScriptsExecutable -> Bool
yes SetScriptsExecutable
NoSetScriptsExecutable = Bool
False
  yes SetScriptsExecutable
YesSetScriptsExecutable = Bool
True

instance YesNo LeaveTestDir where
  yes :: LeaveTestDir -> Bool
yes LeaveTestDir
NoLeaveTestDir = Bool
False
  yes LeaveTestDir
YesLeaveTestDir = Bool
True

instance YesNo UseIndex where
  yes :: UseIndex -> Bool
yes UseIndex
IgnoreIndex = Bool
False
  yes UseIndex
UseIndex = Bool
True

instance YesNo WantGuiPause where
  yes :: WantGuiPause -> Bool
yes WantGuiPause
NoWantGuiPause = Bool
False
  yes WantGuiPause
YesWantGuiPause = Bool
True

instance YesNo WithWorkingDir where
  yes :: WithWorkingDir -> Bool
yes WithWorkingDir
NoWorkingDir = Bool
False
  yes WithWorkingDir
WithWorkingDir = Bool
True

data EnumPatches = NoEnumPatches | YesEnumPatches deriving (EnumPatches -> EnumPatches -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EnumPatches -> EnumPatches -> Bool
$c/= :: EnumPatches -> EnumPatches -> Bool
== :: EnumPatches -> EnumPatches -> Bool
$c== :: EnumPatches -> EnumPatches -> Bool
Eq, Int -> EnumPatches -> ShowS
[EnumPatches] -> ShowS
EnumPatches -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnumPatches] -> ShowS
$cshowList :: [EnumPatches] -> ShowS
show :: EnumPatches -> String
$cshow :: EnumPatches -> String
showsPrec :: Int -> EnumPatches -> ShowS
$cshowsPrec :: Int -> EnumPatches -> ShowS
Show)

instance YesNo EnumPatches where
  yes :: EnumPatches -> Bool
yes EnumPatches
NoEnumPatches = Bool
False
  yes EnumPatches
YesEnumPatches = Bool
True

instance YesNo InheritDefault where
  yes :: InheritDefault -> Bool
yes InheritDefault
NoInheritDefault = Bool
False
  yes InheritDefault
YesInheritDefault = Bool
True

-- * Root command

-- | Options for darcs iself that act like sub-commands.
data RootAction = RootHelp | Version | ExactVersion | ListCommands deriving (RootAction -> RootAction -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RootAction -> RootAction -> Bool
$c/= :: RootAction -> RootAction -> Bool
== :: RootAction -> RootAction -> Bool
$c== :: RootAction -> RootAction -> Bool
Eq, Int -> RootAction -> ShowS
[RootAction] -> ShowS
RootAction -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RootAction] -> ShowS
$cshowList :: [RootAction] -> ShowS
show :: RootAction -> String
$cshow :: RootAction -> String
showsPrec :: Int -> RootAction -> ShowS
$cshowsPrec :: Int -> RootAction -> ShowS
Show)

rootActions :: PrimDarcsOption (Maybe RootAction)
rootActions :: PrimDarcsOption (Maybe RootAction)
rootActions = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault forall a. Maybe a
Nothing
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [Char
'h'] [String
"help"] Flag
F.Help (forall a. a -> Maybe a
Just RootAction
RootHelp)
    String
"show a brief description of all darcs commands and top-level options"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [Char
'v',Char
'V'] [String
"version"] Flag
F.Version  (forall a. a -> Maybe a
Just RootAction
Version) String
"show the darcs version"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"exact-version"] Flag
F.ExactVersion (forall a. a -> Maybe a
Just RootAction
ExactVersion)
    String
"show the exact darcs version"
    -- the switch --commands is here for compatibility only
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"commands"] Flag
F.ListCommands (forall a. a -> Maybe a
Just RootAction
ListCommands)
    String
"show plain list of available options and commands, for auto-completion"
  ]

-- * Common to all commands

-- ** Standard command actions

data StdCmdAction = Help | ListOptions | Disable deriving (StdCmdAction -> StdCmdAction -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StdCmdAction -> StdCmdAction -> Bool
$c/= :: StdCmdAction -> StdCmdAction -> Bool
== :: StdCmdAction -> StdCmdAction -> Bool
$c== :: StdCmdAction -> StdCmdAction -> Bool
Eq, Int -> StdCmdAction -> ShowS
[StdCmdAction] -> ShowS
StdCmdAction -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StdCmdAction] -> ShowS
$cshowList :: [StdCmdAction] -> ShowS
show :: StdCmdAction -> String
$cshow :: StdCmdAction -> String
showsPrec :: Int -> StdCmdAction -> ShowS
$cshowsPrec :: Int -> StdCmdAction -> ShowS
Show)

stdCmdActions :: PrimDarcsOption (Maybe StdCmdAction)
stdCmdActions :: PrimDarcsOption (Maybe StdCmdAction)
stdCmdActions = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault forall a. Maybe a
Nothing
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"help"] Flag
F.Help (forall a. a -> Maybe a
Just StdCmdAction
Help)
    String
"show a description of the command and its options"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"list-options"] Flag
F.ListOptions (forall a. a -> Maybe a
Just StdCmdAction
ListOptions)
    String
"show plain list of available options and commands, for auto-completion"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"disable"] Flag
F.Disable (forall a. a -> Maybe a
Just StdCmdAction
Disable) String
"disable this command" ]

-- ** Verbosity related

debug :: PrimDarcsOption Bool
debug :: PrimDarcsOption Bool
debug = String -> [String] -> Flag -> String -> PrimDarcsOption Bool
singleNoArg [] [String
"debug"] Flag
F.Debug String
"enable general debug output"

debugHttp :: PrimDarcsOption Bool
debugHttp :: PrimDarcsOption Bool
debugHttp = String -> [String] -> Flag -> String -> PrimDarcsOption Bool
singleNoArg [] [String
"debug-http"] Flag
F.DebugHTTP String
"debug output from libcurl"

verbosity :: PrimDarcsOption Verbosity
verbosity :: PrimDarcsOption Verbosity
verbosity = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault Verbosity
NormalVerbosity
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [Char
'q'] [String
"quiet"] Flag
F.Quiet Verbosity
Quiet String
"suppress informational output"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"standard-verbosity"] Flag
F.NormalVerbosity Verbosity
NormalVerbosity
      String
"neither verbose nor quiet output"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [Char
'v'] [String
"verbose"] Flag
F.Verbose Verbosity
Verbose String
"enable verbose output" ]

timings :: PrimDarcsOption Bool
timings :: PrimDarcsOption Bool
timings = String -> [String] -> Flag -> String -> PrimDarcsOption Bool
singleNoArg [] [String
"timings"] Flag
F.Timings String
"provide debugging timings information"

debugging :: DarcsOption a (Bool -> Bool -> Bool -> a)
debugging :: forall a. DarcsOption a (Bool -> Bool -> Bool -> a)
debugging = PrimDarcsOption Bool
debug forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ PrimDarcsOption Bool
debugHttp forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ PrimDarcsOption Bool
timings

-- ** Hooks

hooks :: DarcsOption a (HooksConfig -> a)
hooks :: forall a. DarcsOption a (HooksConfig -> a)
hooks = forall (f :: * -> *) a b. IsoFunctor f => Iso a b -> f a -> f b
imap (forall a b. (a -> b) -> (b -> a) -> Iso a b
Iso forall {t}. (HookConfig -> HookConfig -> t) -> HooksConfig -> t
fw forall {t}. (HooksConfig -> t) -> HookConfig -> HookConfig -> t
bw) forall a b. (a -> b) -> a -> b
$ forall a. DarcsOption a (HookConfig -> a)
preHook forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ forall a. DarcsOption a (HookConfig -> a)
postHook where
  fw :: (HookConfig -> HookConfig -> t) -> HooksConfig -> t
fw HookConfig -> HookConfig -> t
k (HooksConfig HookConfig
pr HookConfig
po) = HookConfig -> HookConfig -> t
k HookConfig
pr HookConfig
po
  bw :: (HooksConfig -> t) -> HookConfig -> HookConfig -> t
bw HooksConfig -> t
k HookConfig
pr HookConfig
po = HooksConfig -> t
k (HookConfig -> HookConfig -> HooksConfig
HooksConfig HookConfig
pr HookConfig
po)

hookIso :: Iso (Maybe String -> Bool -> a) (HookConfig -> a)
hookIso :: forall a. Iso (Maybe String -> Bool -> a) (HookConfig -> a)
hookIso = (forall a b. (a -> b) -> (b -> a) -> Iso a b
Iso forall {t}. (Maybe String -> Bool -> t) -> HookConfig -> t
fw forall {t}. (HookConfig -> t) -> Maybe String -> Bool -> t
bw) where
    fw :: (Maybe String -> Bool -> t) -> HookConfig -> t
fw Maybe String -> Bool -> t
k (HookConfig Maybe String
c Bool
p) = Maybe String -> Bool -> t
k Maybe String
c Bool
p
    bw :: (HookConfig -> t) -> Maybe String -> Bool -> t
bw HookConfig -> t
k Maybe String
c Bool
p = HookConfig -> t
k (Maybe String -> Bool -> HookConfig
HookConfig Maybe String
c Bool
p)

preHook :: DarcsOption a (HookConfig -> a)
preHook :: forall a. DarcsOption a (HookConfig -> a)
preHook = forall (f :: * -> *) a b. IsoFunctor f => Iso a b -> f a -> f b
imap forall a. Iso (Maybe String -> Bool -> a) (HookConfig -> a)
hookIso forall a b. (a -> b) -> a -> b
$ PrimDarcsOption (Maybe String)
prehookCmd forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ String -> Flag -> Flag -> PrimDarcsOption Bool
hookPrompt String
"prehook" Flag
F.AskPrehook Flag
F.RunPrehook

postHook :: DarcsOption a (HookConfig -> a)
postHook :: forall a. DarcsOption a (HookConfig -> a)
postHook = forall (f :: * -> *) a b. IsoFunctor f => Iso a b -> f a -> f b
imap forall a. Iso (Maybe String -> Bool -> a) (HookConfig -> a)
hookIso forall a b. (a -> b) -> a -> b
$ PrimDarcsOption (Maybe String)
posthookCmd forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ String -> Flag -> Flag -> PrimDarcsOption Bool
hookPrompt String
"posthook" Flag
F.AskPosthook Flag
F.RunPosthook

prehookCmd :: PrimDarcsOption (Maybe String)
prehookCmd :: PrimDarcsOption (Maybe String)
prehookCmd = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault forall a. Maybe a
Nothing
    [ forall f v.
String
-> [String]
-> (String -> f)
-> (f -> [String])
-> (String -> v)
-> (v -> [String])
-> String
-> String
-> RawOptSpec f v
RawStrArg [] [String
"prehook"] String -> Flag
F.PrehookCmd Flag -> [String]
unF forall a. a -> Maybe a
Just forall {a}. Maybe a -> [a]
unV
      String
"COMMAND" String
"specify command to run before this darcs command"
    , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"no-prehook"] Flag
F.NoPrehook forall a. Maybe a
Nothing
      String
"don't run prehook command" ]
  where unF :: Flag -> [String]
unF Flag
f = [ String
s | F.PrehookCmd String
s <- [Flag
f] ]
        unV :: Maybe a -> [a]
unV Maybe a
v = [ a
s | Just a
s <- [Maybe a
v] ]

posthookCmd :: PrimDarcsOption (Maybe String)
posthookCmd :: PrimDarcsOption (Maybe String)
posthookCmd = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault forall a. Maybe a
Nothing
    [ forall f v.
String
-> [String]
-> (String -> f)
-> (f -> [String])
-> (String -> v)
-> (v -> [String])
-> String
-> String
-> RawOptSpec f v
RawStrArg [] [String
"posthook"] String -> Flag
F.PosthookCmd Flag -> [String]
unF forall a. a -> Maybe a
Just forall {a}. Maybe a -> [a]
unV String
"COMMAND"
      String
"specify command to run after this darcs command"
    , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"no-posthook"] Flag
F.NoPosthook forall a. Maybe a
Nothing
      String
"don't run posthook command" ]
  where unF :: Flag -> [String]
unF Flag
f = [ String
s | F.PosthookCmd String
s <- [Flag
f] ]
        unV :: Maybe a -> [a]
unV Maybe a
v = [ a
s | Just a
s <- [Maybe a
v] ]

hookPrompt :: String -> Flag -> Flag -> PrimDarcsOption Bool
hookPrompt :: String -> Flag -> Flag -> PrimDarcsOption Bool
hookPrompt String
name Flag
fask Flag
frun = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault Bool
False
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"prompt-"forall a. [a] -> [a] -> [a]
++String
name] Flag
fask Bool
True
    (String
"prompt before running "forall a. [a] -> [a] -> [a]
++String
name)
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"run-"forall a. [a] -> [a] -> [a]
++String
name] Flag
frun Bool
False
    (String
"run "forall a. [a] -> [a] -> [a]
++String
nameforall a. [a] -> [a] -> [a]
++String
" command without prompting") ]

-- ** Misc

useCache :: PrimDarcsOption UseCache
useCache :: PrimDarcsOption UseCache
useCache = (forall (f :: * -> *) a b. IsoFunctor f => Iso a b -> f a -> f b
imap forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b c. Iso a b -> Iso (a -> c) (b -> c)
cps) (forall a b. (a -> b) -> (b -> a) -> Iso a b
Iso Bool -> UseCache
fw UseCache -> Bool
bw) forall a b. (a -> b) -> a -> b
$ String -> [String] -> Flag -> String -> PrimDarcsOption Bool
singleNoArg [] [String
"no-cache"] Flag
F.NoCache String
"don't use patch caches"
  where
    fw :: Bool -> UseCache
fw Bool
True = UseCache
NoUseCache
    fw Bool
False = UseCache
YesUseCache
    bw :: UseCache -> Bool
bw UseCache
NoUseCache = Bool
True
    bw UseCache
YesUseCache = Bool
False

-- * Interactivity related

{- TODO: These options interact (no pun intended) in complex ways that are
very hard to figure out for users as well as maintainers. I think the only
solution here is a more radical (and probably incompatible) re-design
involving all interactivity related options. -}

data XmlOutput = NoXml | YesXml deriving (XmlOutput -> XmlOutput -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: XmlOutput -> XmlOutput -> Bool
$c/= :: XmlOutput -> XmlOutput -> Bool
== :: XmlOutput -> XmlOutput -> Bool
$c== :: XmlOutput -> XmlOutput -> Bool
Eq, Int -> XmlOutput -> ShowS
[XmlOutput] -> ShowS
XmlOutput -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [XmlOutput] -> ShowS
$cshowList :: [XmlOutput] -> ShowS
show :: XmlOutput -> String
$cshow :: XmlOutput -> String
showsPrec :: Int -> XmlOutput -> ShowS
$cshowsPrec :: Int -> XmlOutput -> ShowS
Show)

instance YesNo XmlOutput where
  yes :: XmlOutput -> Bool
yes XmlOutput
NoXml = Bool
False
  yes XmlOutput
YesXml = Bool
True

xmlOutput :: PrimDarcsOption XmlOutput
xmlOutput :: PrimDarcsOption XmlOutput
xmlOutput = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault XmlOutput
NoXml [RawDarcsOption
__xmloutput XmlOutput
YesXml]

__xmloutput :: RawDarcsOption
__xmloutput :: RawDarcsOption
__xmloutput v
val = forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"xml-output"] Flag
F.XMLOutput v
val String
"generate XML formatted output"

-- | TODO someone wrote here long ago that any time --dry-run is a possibility
-- automated users should be able to examine the results more
-- easily with --xml. See also issue2397.
-- dryRun w/o xml is currently used in add, pull, and repair.

dryRun :: PrimDarcsOption DryRun
dryRun :: PrimDarcsOption DryRun
dryRun = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault DryRun
NoDryRun
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"dry-run"] Flag
F.DryRun DryRun
YesDryRun String
"don't actually take the action" ]

dryRunXml :: DarcsOption a (DryRun -> XmlOutput -> a)
dryRunXml :: forall a. DarcsOption a (DryRun -> XmlOutput -> a)
dryRunXml = PrimDarcsOption DryRun
dryRun forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ PrimDarcsOption XmlOutput
xmlOutput

pipe :: PrimDarcsOption Bool
pipe :: PrimDarcsOption Bool
pipe = String -> [String] -> Flag -> String -> PrimDarcsOption Bool
singleNoArg [] [String
"pipe"] Flag
F.Pipe String
"ask user interactively for the patch metadata"

interactive :: PrimDarcsOption (Maybe Bool)
interactive :: PrimDarcsOption (Maybe Bool)
interactive = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault forall a. Maybe a
Nothing
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [Char
'a'] [String
"all",String
"no-interactive"] Flag
F.All (forall a. a -> Maybe a
Just Bool
False) String
"answer yes to all patches"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [Char
'i'] [String
"interactive"] Flag
F.Interactive (forall a. a -> Maybe a
Just Bool
True) String
"prompt user interactively" ]

pauseForGui :: PrimDarcsOption WantGuiPause
pauseForGui :: PrimDarcsOption WantGuiPause
pauseForGui = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault WantGuiPause
YesWantGuiPause
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"pause-for-gui"] Flag
F.PauseForGui WantGuiPause
YesWantGuiPause
    String
"pause for an external diff or merge command to finish"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"no-pause-for-gui"] Flag
F.NoPauseForGui WantGuiPause
NoWantGuiPause
    String
"return immediately after external diff or merge command finishes" ]

askDeps :: PrimDarcsOption Bool
askDeps :: PrimDarcsOption Bool
askDeps = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault Bool
False
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"ask-deps"] Flag
F.AskDeps Bool
True String
"manually select dependencies"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"no-ask-deps"] Flag
F.NoAskDeps Bool
False String
"automatically select dependencies" ]

-- * Patch selection related

data SelectDeps = NoDeps | AutoDeps | PromptDeps deriving (SelectDeps -> SelectDeps -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SelectDeps -> SelectDeps -> Bool
$c/= :: SelectDeps -> SelectDeps -> Bool
== :: SelectDeps -> SelectDeps -> Bool
$c== :: SelectDeps -> SelectDeps -> Bool
Eq, Int -> SelectDeps -> ShowS
[SelectDeps] -> ShowS
SelectDeps -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SelectDeps] -> ShowS
$cshowList :: [SelectDeps] -> ShowS
show :: SelectDeps -> String
$cshow :: SelectDeps -> String
showsPrec :: Int -> SelectDeps -> ShowS
$cshowsPrec :: Int -> SelectDeps -> ShowS
Show)

selectDeps :: PrimDarcsOption SelectDeps
selectDeps :: PrimDarcsOption SelectDeps
selectDeps = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault SelectDeps
PromptDeps
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"no-deps"] Flag
F.DontGrabDeps SelectDeps
NoDeps
    String
"don't automatically fulfill dependencies"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"auto-deps",String
"dont-prompt-for-dependencies"] Flag
F.DontPromptForDependencies SelectDeps
AutoDeps
    String
"don't ask about patches that are depended on by matched patches (with --match or --patch)"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"prompt-deps",String
"prompt-for-dependencies"] Flag
F.PromptForDependencies SelectDeps
PromptDeps
    String
"prompt about patches that are depended on by matched patches" ]

changesReverse :: PrimDarcsOption Bool
changesReverse :: PrimDarcsOption Bool
changesReverse = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault Bool
False
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"reverse"] Flag
F.Reverse Bool
True String
"show/consider changes in reverse order"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"no-reverse"] Flag
F.Forward Bool
False String
"show/consider changes in the usual order" ]

maxCount :: PrimDarcsOption (Maybe Int)
maxCount :: PrimDarcsOption (Maybe Int)
maxCount = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault forall a. Maybe a
Nothing
  [ forall f v.
String
-> [String]
-> (String -> f)
-> (f -> [String])
-> (String -> v)
-> (v -> [String])
-> String
-> String
-> RawOptSpec f v
RawStrArg [] [String
"max-count"] String -> Flag
F.MaxCount Flag -> [String]
unF String -> Maybe Int
toV Maybe Int -> [String]
unV String
"NUMBER" String
"return only NUMBER results" ]
  where
    unF :: Flag -> [String]
unF Flag
f = [ String
s | F.MaxCount String
s <- [Flag
f] ]
    unV :: Maybe Int -> [String]
unV Maybe Int
x = [ Int -> String
showIntArg Int
n | Just Int
n <- [Maybe Int
x] ]
    toV :: String -> Maybe Int
toV = forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> (Int -> Bool) -> String -> Int
parseIntArg String
"count" (forall a. Ord a => a -> a -> Bool
>=Int
0)

-- * Local or remote repo

repoDir :: PrimDarcsOption (Maybe String)
repoDir :: PrimDarcsOption (Maybe String)
repoDir = String
-> [String]
-> (String -> Flag)
-> (Flag -> Maybe String)
-> String
-> String
-> PrimDarcsOption (Maybe String)
singleStrArg [] [String
"repodir"] String -> Flag
F.WorkRepoDir Flag -> Maybe String
arg String
"DIRECTORY"
    String
"specify the repository directory in which to run"
  where arg :: Flag -> Maybe String
arg (F.WorkRepoDir String
s) = forall a. a -> Maybe a
Just String
s
        arg Flag
_ = forall a. Maybe a
Nothing

-- | This option is for when a new repo gets created. Used for clone, convert
-- import, convert darcs-2, and initialize. For clone and initialize it has the
-- same effect as giving the name as a normal argument.
--
-- The @--repodir@ alias is there for compatibility, should be removed eventually.
--
-- TODO We need a way to deprecate options / option names.
newRepo :: PrimDarcsOption (Maybe String)
newRepo :: PrimDarcsOption (Maybe String)
newRepo = String
-> [String]
-> (String -> Flag)
-> (Flag -> Maybe String)
-> String
-> String
-> PrimDarcsOption (Maybe String)
singleStrArg [] [String
"repo-name",String
"repodir"] String -> Flag
F.NewRepo Flag -> Maybe String
arg String
"DIRECTORY" String
"path of output directory"
  where arg :: Flag -> Maybe String
arg (F.NewRepo String
s) = forall a. a -> Maybe a
Just String
s; arg Flag
_ = forall a. Maybe a
Nothing

possiblyRemoteRepo :: PrimDarcsOption (Maybe String)
possiblyRemoteRepo :: PrimDarcsOption (Maybe String)
possiblyRemoteRepo = String
-> [String]
-> (String -> Flag)
-> (Flag -> Maybe String)
-> String
-> String
-> PrimDarcsOption (Maybe String)
singleStrArg [] [String
"repo"] String -> Flag
F.WorkRepoUrl Flag -> Maybe String
arg String
"URL"
    String
"specify the repository URL"
  where arg :: Flag -> Maybe String
arg (F.WorkRepoUrl String
s) = forall a. a -> Maybe a
Just String
s
        arg Flag
_ = forall a. Maybe a
Nothing

remoteRepos :: PrimDarcsOption RemoteRepos
remoteRepos :: PrimDarcsOption RemoteRepos
remoteRepos = (forall (f :: * -> *) a b. IsoFunctor f => Iso a b -> f a -> f b
imap forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b c. Iso a b -> Iso (a -> c) (b -> c)
cps) (forall a b. (a -> b) -> (b -> a) -> Iso a b
Iso [String] -> RemoteRepos
fw RemoteRepos -> [String]
bw) forall a b. (a -> b) -> a -> b
$ String
-> [String]
-> (String -> Flag)
-> ([Flag] -> [String])
-> String
-> String
-> PrimDarcsOption [String]
multiStrArg [] [String
"remote-repo"] String -> Flag
F.RemoteRepo [Flag] -> [String]
mkV String
"URL"
    String
"specify the remote repository URL to work with"
  where mkV :: [Flag] -> [String]
mkV [Flag]
fs = [ String
s | F.RemoteRepo String
s <- [Flag]
fs ]
        fw :: [String] -> RemoteRepos
fw [String]
ss = [String] -> RemoteRepos
RemoteRepos [String]
ss
        bw :: RemoteRepos -> [String]
bw (RemoteRepos [String]
ss) = [String]
ss

notInRemoteFlagName :: String
notInRemoteFlagName :: String
notInRemoteFlagName = String
"not-in-remote"

data NotInRemote
  = NotInDefaultRepo
  | NotInRemotePath String

notInRemote :: PrimDarcsOption [NotInRemote]
notInRemote :: PrimDarcsOption [NotInRemote]
notInRemote = (forall (f :: * -> *) a b. IsoFunctor f => Iso a b -> f a -> f b
imap forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b c. Iso a b -> Iso (a -> c) (b -> c)
cps) (forall a b. (a -> b) -> (b -> a) -> Iso a b
Iso (forall a b. (a -> b) -> [a] -> [b]
map Maybe String -> NotInRemote
fw) (forall a b. (a -> b) -> [a] -> [b]
map NotInRemote -> Maybe String
bw)) forall a b. (a -> b) -> a -> b
$
    String
-> [String]
-> (Maybe String -> Flag)
-> ([Flag] -> [Maybe String])
-> String
-> String
-> PrimDarcsOption [Maybe String]
multiOptStrArg [] [String
notInRemoteFlagName] Maybe String -> Flag
F.NotInRemote [Flag] -> [Maybe String]
args String
"URL/PATH" forall a b. (a -> b) -> a -> b
$
        String
"select all patches not in the default push/pull repository or at "
        forall a. [a] -> [a] -> [a]
++ String
"location URL/PATH"
  where
    args :: [Flag] -> [Maybe String]
args [Flag]
fs = [Maybe String
s | F.NotInRemote Maybe String
s <- [Flag]
fs]
    fw :: Maybe String -> NotInRemote
fw (Just String
s) = String -> NotInRemote
NotInRemotePath String
s
    fw Maybe String
Nothing = NotInRemote
NotInDefaultRepo
    bw :: NotInRemote -> Maybe String
bw (NotInRemotePath String
s) = forall a. a -> Maybe a
Just String
s
    bw NotInRemote
NotInDefaultRepo = forall a. Maybe a
Nothing

data RepoCombinator = Intersection | Union | Complement deriving (RepoCombinator -> RepoCombinator -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RepoCombinator -> RepoCombinator -> Bool
$c/= :: RepoCombinator -> RepoCombinator -> Bool
== :: RepoCombinator -> RepoCombinator -> Bool
$c== :: RepoCombinator -> RepoCombinator -> Bool
Eq, Int -> RepoCombinator -> ShowS
[RepoCombinator] -> ShowS
RepoCombinator -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RepoCombinator] -> ShowS
$cshowList :: [RepoCombinator] -> ShowS
show :: RepoCombinator -> String
$cshow :: RepoCombinator -> String
showsPrec :: Int -> RepoCombinator -> ShowS
$cshowsPrec :: Int -> RepoCombinator -> ShowS
Show)

repoCombinator :: PrimDarcsOption RepoCombinator
repoCombinator :: PrimDarcsOption RepoCombinator
repoCombinator = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault RepoCombinator
Union
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"intersection"] Flag
F.Intersection RepoCombinator
Intersection
    String
"take intersection of all repositories"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"union"] Flag
F.Union RepoCombinator
Union
    String
"take union of all repositories"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"complement"] Flag
F.Complement RepoCombinator
Complement
    String
"take complement of repositories (in order listed)" ]

allowUnrelatedRepos :: PrimDarcsOption Bool
allowUnrelatedRepos :: PrimDarcsOption Bool
allowUnrelatedRepos = String -> [String] -> Flag -> String -> PrimDarcsOption Bool
singleNoArg [] [String
"ignore-unrelated-repos"] Flag
F.AllowUnrelatedRepos
  String
"do not check if repositories are unrelated"

justThisRepo :: PrimDarcsOption Bool
justThisRepo :: PrimDarcsOption Bool
justThisRepo = String -> [String] -> Flag -> String -> PrimDarcsOption Bool
singleNoArg [] [String
"just-this-repo"] Flag
F.JustThisRepo
  String
"Limit the check or repair to the current repo"

-- | convert, clone, init
withWorkingDir :: PrimDarcsOption WithWorkingDir
withWorkingDir :: PrimDarcsOption WithWorkingDir
withWorkingDir = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault WithWorkingDir
WithWorkingDir
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"with-working-dir"] Flag
F.UseWorkingDir WithWorkingDir
WithWorkingDir
    String
"Create a working tree (normal repository)"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"no-working-dir"] Flag
F.UseNoWorkingDir WithWorkingDir
NoWorkingDir
    String
"Do not create a working tree (bare repository)" ]

setDefault :: PrimDarcsOption (Maybe Bool)
setDefault :: PrimDarcsOption (Maybe Bool)
setDefault = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault forall a. Maybe a
Nothing
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"set-default"] Flag
F.SetDefault (forall a. a -> Maybe a
Just Bool
True) String
"set default repository"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"no-set-default"] Flag
F.NoSetDefault (forall a. a -> Maybe a
Just Bool
False) String
"don't set default repository" ]

inheritDefault :: PrimDarcsOption InheritDefault
inheritDefault :: PrimDarcsOption InheritDefault
inheritDefault = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault InheritDefault
NoInheritDefault
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"inherit-default"] Flag
F.InheritDefault InheritDefault
YesInheritDefault String
"inherit default repository"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"no-inherit-default"] Flag
F.NoInheritDefault InheritDefault
NoInheritDefault String
"don't inherit default repository" ]

-- * Specifying patch meta-data

patchname :: PrimDarcsOption (Maybe String)
patchname :: PrimDarcsOption (Maybe String)
patchname = String
-> [String]
-> (String -> Flag)
-> (Flag -> Maybe String)
-> String
-> String
-> PrimDarcsOption (Maybe String)
singleStrArg [Char
'm'] [String
"name"] String -> Flag
F.PatchName Flag -> Maybe String
arg String
"PATCHNAME"
    String
"name of patch"
  where arg :: Flag -> Maybe String
arg (F.PatchName String
s) = forall a. a -> Maybe a
Just String
s
        arg Flag
_ = forall a. Maybe a
Nothing

author :: PrimDarcsOption (Maybe String)
author :: PrimDarcsOption (Maybe String)
author = String
-> [String]
-> (String -> Flag)
-> (Flag -> Maybe String)
-> String
-> String
-> PrimDarcsOption (Maybe String)
singleStrArg [Char
'A'] [String
"author"] String -> Flag
F.Author Flag -> Maybe String
arg
    String
"EMAIL" String
"specify author id"
  where arg :: Flag -> Maybe String
arg (F.Author String
s) = forall a. a -> Maybe a
Just String
s
        arg Flag
_ = forall a. Maybe a
Nothing

data AskLongComment = NoEditLongComment | YesEditLongComment | PromptLongComment
  deriving (AskLongComment -> AskLongComment -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AskLongComment -> AskLongComment -> Bool
$c/= :: AskLongComment -> AskLongComment -> Bool
== :: AskLongComment -> AskLongComment -> Bool
$c== :: AskLongComment -> AskLongComment -> Bool
Eq, Int -> AskLongComment -> ShowS
[AskLongComment] -> ShowS
AskLongComment -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AskLongComment] -> ShowS
$cshowList :: [AskLongComment] -> ShowS
show :: AskLongComment -> String
$cshow :: AskLongComment -> String
showsPrec :: Int -> AskLongComment -> ShowS
$cshowsPrec :: Int -> AskLongComment -> ShowS
Show)

askLongComment :: PrimDarcsOption (Maybe AskLongComment)
askLongComment :: PrimDarcsOption (Maybe AskLongComment)
askLongComment = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault forall a. Maybe a
Nothing
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"edit-long-comment"] Flag
F.EditLongComment (forall a. a -> Maybe a
Just AskLongComment
YesEditLongComment)
    String
"edit the long comment by default"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"skip-long-comment"] Flag
F.NoEditLongComment (forall a. a -> Maybe a
Just AskLongComment
NoEditLongComment)
    String
"don't give a long comment"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"prompt-long-comment"] Flag
F.PromptLongComment (forall a. a -> Maybe a
Just AskLongComment
PromptLongComment)
    String
"prompt for whether to edit the long comment" ]

keepDate :: PrimDarcsOption Bool
keepDate :: PrimDarcsOption Bool
keepDate = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault Bool
False
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"keep-date"] Flag
F.KeepDate Bool
True
   String
"keep the date of the original patch"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"no-keep-date"] Flag
F.NoKeepDate Bool
False
   String
"use the current date for the amended patch" ]

-- record, send
data Logfile = Logfile
  { Logfile -> Maybe AbsolutePath
_logfile :: Maybe AbsolutePath
  , Logfile -> Bool
_rmlogfile :: Bool
  }

logfile :: PrimDarcsOption Logfile
logfile :: PrimDarcsOption Logfile
logfile = forall (f :: * -> *) a b. IsoFunctor f => Iso a b -> f a -> f b
imap (forall a b. (a -> b) -> (b -> a) -> Iso a b
Iso forall {t}. (Maybe AbsolutePath -> Bool -> t) -> Logfile -> t
fw forall {t}. (Logfile -> t) -> Maybe AbsolutePath -> Bool -> t
bw) (PrimDarcsOption (Maybe AbsolutePath)
__logfile forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ PrimDarcsOption Bool
__rmlogfile) where
  fw :: (Maybe AbsolutePath -> Bool -> t) -> Logfile -> t
fw Maybe AbsolutePath -> Bool -> t
k (Logfile Maybe AbsolutePath
x Bool
y) = Maybe AbsolutePath -> Bool -> t
k Maybe AbsolutePath
x Bool
y
  bw :: (Logfile -> t) -> Maybe AbsolutePath -> Bool -> t
bw Logfile -> t
k Maybe AbsolutePath
x Bool
y = Logfile -> t
k (Maybe AbsolutePath -> Bool -> Logfile
Logfile Maybe AbsolutePath
x Bool
y)

__logfile :: PrimDarcsOption (Maybe AbsolutePath)
__logfile :: PrimDarcsOption (Maybe AbsolutePath)
__logfile = String
-> [String]
-> (AbsolutePath -> Flag)
-> (Flag -> Maybe AbsolutePath)
-> String
-> String
-> PrimDarcsOption (Maybe AbsolutePath)
singleAbsPathArg [] [String
"logfile"] AbsolutePath -> Flag
F.LogFile Flag -> Maybe AbsolutePath
arg String
"FILE"
    String
"give patch name and comment in file"
  where arg :: Flag -> Maybe AbsolutePath
arg (F.LogFile AbsolutePath
s) = forall a. a -> Maybe a
Just AbsolutePath
s
        arg Flag
_ = forall a. Maybe a
Nothing

__rmlogfile :: PrimDarcsOption Bool
__rmlogfile :: PrimDarcsOption Bool
__rmlogfile = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault Bool
False
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"delete-logfile"] Flag
F.RmLogFile Bool
True
    String
"delete the logfile when done"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"no-delete-logfile"] Flag
F.DontRmLogFile Bool
False
    String
"keep the logfile when done" ]

-- * Looking for changes

data LookFor = LookFor
  { LookFor -> LookForAdds
adds :: LookForAdds
  , LookFor -> LookForReplaces
replaces :: LookForReplaces
  , LookFor -> LookForMoves
moves :: LookForMoves
  }

lookfor :: PrimDarcsOption LookFor
lookfor :: PrimDarcsOption LookFor
lookfor = forall (f :: * -> *) a b. IsoFunctor f => Iso a b -> f a -> f b
imap (forall a b. (a -> b) -> (b -> a) -> Iso a b
Iso forall {t}.
(LookForAdds -> LookForReplaces -> LookForMoves -> t)
-> LookFor -> t
fw forall {t}.
(LookFor -> t)
-> LookForAdds -> LookForReplaces -> LookForMoves -> t
bw) (LookForAdds -> PrimDarcsOption LookForAdds
lookforadds LookForAdds
NoLookForAdds forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ PrimDarcsOption LookForReplaces
lookforreplaces forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ PrimDarcsOption LookForMoves
lookformoves) where
  fw :: (LookForAdds -> LookForReplaces -> LookForMoves -> t)
-> LookFor -> t
fw LookForAdds -> LookForReplaces -> LookForMoves -> t
k (LookFor LookForAdds
a LookForReplaces
r LookForMoves
m) = LookForAdds -> LookForReplaces -> LookForMoves -> t
k LookForAdds
a LookForReplaces
r LookForMoves
m
  bw :: (LookFor -> t)
-> LookForAdds -> LookForReplaces -> LookForMoves -> t
bw LookFor -> t
k LookForAdds
a LookForReplaces
r LookForMoves
m = LookFor -> t
k (LookForAdds -> LookForReplaces -> LookForMoves -> LookFor
LookFor LookForAdds
a LookForReplaces
r LookForMoves
m)

lookforadds :: LookForAdds -> PrimDarcsOption LookForAdds
lookforadds :: LookForAdds -> PrimDarcsOption LookForAdds
lookforadds LookForAdds
def = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault LookForAdds
def
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [Char
'l'] [String
"look-for-adds"] Flag
F.LookForAdds LookForAdds
YesLookForAdds
    String
"look for (non-boring) files that could be added"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"dont-look-for-adds",String
"no-look-for-adds"] Flag
F.NoLookForAdds LookForAdds
NoLookForAdds
    String
"don't look for any files that could be added" ]

lookforreplaces :: PrimDarcsOption LookForReplaces
lookforreplaces :: PrimDarcsOption LookForReplaces
lookforreplaces = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault LookForReplaces
NoLookForReplaces
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"look-for-replaces"] Flag
F.LookForReplaces LookForReplaces
YesLookForReplaces
    String
"look for replaces that could be marked"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"dont-look-for-replaces",String
"no-look-for-replaces"]
    Flag
F.NoLookForReplaces LookForReplaces
NoLookForReplaces
    String
"don't look for any replaces" ]

lookformoves :: PrimDarcsOption LookForMoves
lookformoves :: PrimDarcsOption LookForMoves
lookformoves = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault LookForMoves
NoLookForMoves
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"look-for-moves"] Flag
F.LookForMoves LookForMoves
YesLookForMoves
   String
"look for files that may be moved/renamed"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"dont-look-for-moves",String
"no-look-for-moves"]
    Flag
F.NoLookForMoves LookForMoves
NoLookForMoves
   String
"don't look for any files that could be moved/renamed" ]

-- * Files to consider

useIndex :: PrimDarcsOption UseIndex
useIndex :: PrimDarcsOption UseIndex
useIndex = (forall (f :: * -> *) a b. IsoFunctor f => Iso a b -> f a -> f b
imap forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b c. Iso a b -> Iso (a -> c) (b -> c)
cps) (forall a b. (a -> b) -> (b -> a) -> Iso a b
Iso Bool -> UseIndex
fw UseIndex -> Bool
bw) PrimDarcsOption Bool
ignoreTimes where
  fw :: Bool -> UseIndex
fw Bool
False = UseIndex
UseIndex
  fw Bool
True = UseIndex
IgnoreIndex
  bw :: UseIndex -> Bool
bw UseIndex
UseIndex = Bool
False
  bw UseIndex
IgnoreIndex = Bool
True

includeBoring :: PrimDarcsOption IncludeBoring
includeBoring :: PrimDarcsOption IncludeBoring
includeBoring = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault IncludeBoring
NoIncludeBoring
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"boring"] Flag
F.Boring IncludeBoring
YesIncludeBoring String
"don't skip boring files"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"no-boring"] Flag
F.SkipBoring IncludeBoring
NoIncludeBoring String
"skip boring files" ]

allowProblematicFilenames :: DarcsOption a (Bool -> Bool -> a)
allowProblematicFilenames :: forall a. DarcsOption a (Bool -> Bool -> a)
allowProblematicFilenames = PrimDarcsOption Bool
allowCaseDifferingFilenames forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ PrimDarcsOption Bool
allowWindowsReservedFilenames

allowCaseDifferingFilenames :: PrimDarcsOption Bool
allowCaseDifferingFilenames :: PrimDarcsOption Bool
allowCaseDifferingFilenames = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault Bool
False
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"case-ok"] Flag
F.AllowCaseOnly Bool
True
    String
"don't refuse to add files differing only in case"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"no-case-ok"] Flag
F.DontAllowCaseOnly Bool
False
    String
"refuse to add files whose name differ only in case" ]

allowWindowsReservedFilenames :: PrimDarcsOption Bool
allowWindowsReservedFilenames :: PrimDarcsOption Bool
allowWindowsReservedFilenames = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault Bool
False
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"reserved-ok"] Flag
F.AllowWindowsReserved Bool
True
    String
"don't refuse to add files with Windows-reserved names"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"no-reserved-ok"] Flag
F.DontAllowWindowsReserved Bool
False
    String
"refuse to add files with Windows-reserved names" ]

-- | TODO: see issue2395
onlyToFiles :: PrimDarcsOption Bool
onlyToFiles :: PrimDarcsOption Bool
onlyToFiles = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault Bool
False
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"only-to-files"] Flag
F.OnlyChangesToFiles Bool
True
    String
"show only changes to specified files"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"no-only-to-files"] Flag
F.ChangesToAllFiles Bool
False
    String
"show changes to all files" ]

ignoreTimes :: PrimDarcsOption Bool
ignoreTimes :: PrimDarcsOption Bool
ignoreTimes = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault Bool
False
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"ignore-times"] Flag
F.IgnoreTimes Bool
True
    String
"don't trust the file modification times"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"no-ignore-times"] Flag
F.DontIgnoreTimes Bool
False
    String
"trust modification times to find modified files" ]

recursive :: PrimDarcsOption Bool
recursive :: PrimDarcsOption Bool
recursive = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault Bool
False
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [Char
'r'] [String
"recursive"] Flag
F.Recursive Bool
True String
"recurse into subdirectories"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"not-recursive",String
"no-recursive"] Flag
F.NoRecursive Bool
False (String
"don't recurse into subdirectories") ]

-- * Differences

diffAlgorithm :: PrimDarcsOption DiffAlgorithm
diffAlgorithm :: PrimDarcsOption DiffAlgorithm
diffAlgorithm = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault DiffAlgorithm
PatienceDiff
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"myers"] Flag
F.UseMyersDiff DiffAlgorithm
MyersDiff
    String
"use myers diff algorithm"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"patience"] Flag
F.UsePatienceDiff DiffAlgorithm
PatienceDiff
    String
"use patience diff algorithm" ]

data WithContext = NoContext | YesContext deriving (WithContext -> WithContext -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WithContext -> WithContext -> Bool
$c/= :: WithContext -> WithContext -> Bool
== :: WithContext -> WithContext -> Bool
$c== :: WithContext -> WithContext -> Bool
Eq, Int -> WithContext -> ShowS
[WithContext] -> ShowS
WithContext -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WithContext] -> ShowS
$cshowList :: [WithContext] -> ShowS
show :: WithContext -> String
$cshow :: WithContext -> String
showsPrec :: Int -> WithContext -> ShowS
$cshowsPrec :: Int -> WithContext -> ShowS
Show)

instance YesNo WithContext where
  yes :: WithContext -> Bool
yes WithContext
NoContext = Bool
False
  yes WithContext
YesContext = Bool
True

withContext :: PrimDarcsOption WithContext
withContext :: PrimDarcsOption WithContext
withContext = (forall (f :: * -> *) a b. IsoFunctor f => Iso a b -> f a -> f b
imap forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b c. Iso a b -> Iso (a -> c) (b -> c)
cps) (forall a b. (a -> b) -> (b -> a) -> Iso a b
Iso Bool -> WithContext
fw WithContext -> Bool
bw) forall a b. (a -> b) -> a -> b
$ forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault Bool
False
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [Char
'u'] [String
"unified"] Flag
F.Unified Bool
True
    String
"output changes in a darcs-specific format similar to diff -u"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg  [] [String
"no-unified"] Flag
F.NonUnified Bool
False
    String
"output changes in darcs' usual format" ]
  where fw :: Bool -> WithContext
fw Bool
False = WithContext
NoContext
        fw Bool
True = WithContext
YesContext
        bw :: WithContext -> Bool
bw WithContext
NoContext = Bool
False
        bw WithContext
YesContext = Bool
True

data ExternalDiff = ExternalDiff
  { ExternalDiff -> Maybe String
diffCmd :: Maybe String
  , ExternalDiff -> [String]
diffOpts :: [String]
  , ExternalDiff -> Bool
diffUnified :: Bool
  } deriving (ExternalDiff -> ExternalDiff -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExternalDiff -> ExternalDiff -> Bool
$c/= :: ExternalDiff -> ExternalDiff -> Bool
== :: ExternalDiff -> ExternalDiff -> Bool
$c== :: ExternalDiff -> ExternalDiff -> Bool
Eq, Int -> ExternalDiff -> ShowS
[ExternalDiff] -> ShowS
ExternalDiff -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExternalDiff] -> ShowS
$cshowList :: [ExternalDiff] -> ShowS
show :: ExternalDiff -> String
$cshow :: ExternalDiff -> String
showsPrec :: Int -> ExternalDiff -> ShowS
$cshowsPrec :: Int -> ExternalDiff -> ShowS
Show)

extDiff :: PrimDarcsOption ExternalDiff
extDiff :: PrimDarcsOption ExternalDiff
extDiff = forall (f :: * -> *) a b. IsoFunctor f => Iso a b -> f a -> f b
imap (forall a b. (a -> b) -> (b -> a) -> Iso a b
Iso forall {t}.
(Maybe String -> [String] -> Bool -> t) -> ExternalDiff -> t
fw forall {t}.
(ExternalDiff -> t) -> Maybe String -> [String] -> Bool -> t
bw) forall a b. (a -> b) -> a -> b
$ PrimDarcsOption (Maybe String)
__extDiffCmd forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ PrimDarcsOption [String]
__extDiffOpts forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ PrimDarcsOption Bool
__unidiff where
  fw :: (Maybe String -> [String] -> Bool -> t) -> ExternalDiff -> t
fw Maybe String -> [String] -> Bool -> t
k (ExternalDiff Maybe String
cmd [String]
opts Bool
uni) = Maybe String -> [String] -> Bool -> t
k Maybe String
cmd [String]
opts Bool
uni
  bw :: (ExternalDiff -> t) -> Maybe String -> [String] -> Bool -> t
bw ExternalDiff -> t
k Maybe String
cmd [String]
opts Bool
uni = ExternalDiff -> t
k (Maybe String -> [String] -> Bool -> ExternalDiff
ExternalDiff Maybe String
cmd [String]
opts Bool
uni)

__extDiffCmd :: PrimDarcsOption (Maybe String)
__extDiffCmd :: PrimDarcsOption (Maybe String)
__extDiffCmd = String
-> [String]
-> (String -> Flag)
-> (Flag -> Maybe String)
-> String
-> String
-> PrimDarcsOption (Maybe String)
singleStrArg [] [String
"diff-command"] String -> Flag
F.DiffCmd Flag -> Maybe String
arg String
"COMMAND"
    String
"specify diff command (ignores --diff-opts)"
  where arg :: Flag -> Maybe String
arg (F.DiffCmd String
s) = forall a. a -> Maybe a
Just String
s
        arg Flag
_ = forall a. Maybe a
Nothing

__extDiffOpts :: PrimDarcsOption [String]
__extDiffOpts :: PrimDarcsOption [String]
__extDiffOpts = String
-> [String]
-> (String -> Flag)
-> ([Flag] -> [String])
-> String
-> String
-> PrimDarcsOption [String]
multiStrArg [] [String
"diff-opts"] String -> Flag
F.DiffFlags [Flag] -> [String]
mkV String
"OPTIONS"
    String
"options to pass to diff"
  where mkV :: [Flag] -> [String]
mkV [Flag]
fs = [ String
s | F.DiffFlags String
s <- [Flag]
fs ]

__unidiff :: PrimDarcsOption Bool
__unidiff :: PrimDarcsOption Bool
__unidiff = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault Bool
True
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [Char
'u'] [String
"unified"] Flag
F.Unified Bool
True String
"pass -u option to diff"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg  [] [String
"no-unified"] Flag
F.NonUnified Bool
False String
"output patch in diff's dumb format" ]

-- * Runnign tests

data TestChanges = NoTestChanges | YesTestChanges LeaveTestDir deriving (TestChanges -> TestChanges -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TestChanges -> TestChanges -> Bool
$c/= :: TestChanges -> TestChanges -> Bool
== :: TestChanges -> TestChanges -> Bool
$c== :: TestChanges -> TestChanges -> Bool
Eq)

testChanges :: PrimDarcsOption TestChanges
testChanges :: PrimDarcsOption TestChanges
testChanges = forall (f :: * -> *) a b. IsoFunctor f => Iso a b -> f a -> f b
imap (forall a b. (a -> b) -> (b -> a) -> Iso a b
Iso forall {t}. (RunTest -> LeaveTestDir -> t) -> TestChanges -> t
fw forall {t}. (TestChanges -> t) -> RunTest -> LeaveTestDir -> t
bw) forall a b. (a -> b) -> a -> b
$ PrimDarcsOption RunTest
runTest forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ PrimDarcsOption LeaveTestDir
leaveTestDir where
  fw :: (RunTest -> LeaveTestDir -> t) -> TestChanges -> t
fw RunTest -> LeaveTestDir -> t
k TestChanges
NoTestChanges = RunTest -> LeaveTestDir -> t
k RunTest
NoRunTest LeaveTestDir
NoLeaveTestDir
  fw RunTest -> LeaveTestDir -> t
k (YesTestChanges LeaveTestDir
ltd) = RunTest -> LeaveTestDir -> t
k RunTest
YesRunTest LeaveTestDir
ltd
  bw :: (TestChanges -> t) -> RunTest -> LeaveTestDir -> t
bw TestChanges -> t
k RunTest
NoRunTest LeaveTestDir
_ = TestChanges -> t
k TestChanges
NoTestChanges
  bw TestChanges -> t
k RunTest
YesRunTest LeaveTestDir
ltd = TestChanges -> t
k (LeaveTestDir -> TestChanges
YesTestChanges LeaveTestDir
ltd)

runTest :: PrimDarcsOption RunTest
runTest :: PrimDarcsOption RunTest
runTest = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault RunTest
NoRunTest
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"test"] Flag
F.Test RunTest
YesRunTest String
"run the test script"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"no-test"] Flag
F.NoTest RunTest
NoRunTest String
"don't run the test script" ]

leaveTestDir :: PrimDarcsOption LeaveTestDir
leaveTestDir :: PrimDarcsOption LeaveTestDir
leaveTestDir = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault LeaveTestDir
NoLeaveTestDir
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"leave-test-directory"]
    Flag
F.LeaveTestDir LeaveTestDir
YesLeaveTestDir String
"don't remove the test directory"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"remove-test-directory"]
    Flag
F.NoLeaveTestDir LeaveTestDir
NoLeaveTestDir String
"remove the test directory" ]

-- * Mail related

data HeaderFields = HeaderFields
  { HeaderFields -> [String]
_to, HeaderFields -> [String]
_cc :: [String]
  , HeaderFields -> Maybe String
_from, HeaderFields -> Maybe String
_subject, HeaderFields -> Maybe String
_inReplyTo :: Maybe String
  }

headerFields :: PrimDarcsOption HeaderFields
headerFields :: PrimDarcsOption HeaderFields
headerFields = forall (f :: * -> *) a b. IsoFunctor f => Iso a b -> f a -> f b
imap (forall a b. (a -> b) -> (b -> a) -> Iso a b
Iso forall {t}.
([String]
 -> [String] -> Maybe String -> Maybe String -> Maybe String -> t)
-> HeaderFields -> t
fw forall {t}.
(HeaderFields -> t)
-> [String]
-> [String]
-> Maybe String
-> Maybe String
-> Maybe String
-> t
bw) forall a b. (a -> b) -> a -> b
$ PrimDarcsOption [String]
to forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ PrimDarcsOption [String]
cc forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ PrimDarcsOption (Maybe String)
from forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ PrimDarcsOption (Maybe String)
subject forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ PrimDarcsOption (Maybe String)
inReplyTo where
  fw :: ([String]
 -> [String] -> Maybe String -> Maybe String -> Maybe String -> t)
-> HeaderFields -> t
fw [String]
-> [String] -> Maybe String -> Maybe String -> Maybe String -> t
k (HeaderFields [String]
t [String]
f Maybe String
c Maybe String
s Maybe String
i) = [String]
-> [String] -> Maybe String -> Maybe String -> Maybe String -> t
k [String]
t [String]
f Maybe String
c Maybe String
s Maybe String
i
  bw :: (HeaderFields -> t)
-> [String]
-> [String]
-> Maybe String
-> Maybe String
-> Maybe String
-> t
bw HeaderFields -> t
k [String]
t [String]
f Maybe String
c Maybe String
s Maybe String
i = HeaderFields -> t
k ([String]
-> [String]
-> Maybe String
-> Maybe String
-> Maybe String
-> HeaderFields
HeaderFields [String]
t [String]
f Maybe String
c Maybe String
s Maybe String
i)

from :: PrimDarcsOption (Maybe String)
from :: PrimDarcsOption (Maybe String)
from = String
-> [String]
-> (String -> Flag)
-> (Flag -> Maybe String)
-> String
-> String
-> PrimDarcsOption (Maybe String)
singleStrArg [] [String
"from"] String -> Flag
F.Author Flag -> Maybe String
arg
    String
"EMAIL" String
"specify email address"
  where arg :: Flag -> Maybe String
arg (F.Author String
s) = forall a. a -> Maybe a
Just String
s
        arg Flag
_ = forall a. Maybe a
Nothing

to :: PrimDarcsOption [String]
to :: PrimDarcsOption [String]
to = String
-> [String]
-> (String -> Flag)
-> ([Flag] -> [String])
-> String
-> String
-> PrimDarcsOption [String]
multiStrArg [] [String
"to"] String -> Flag
F.To [Flag] -> [String]
mkV String
"EMAIL" String
"specify destination email"
  where mkV :: [Flag] -> [String]
mkV [Flag]
fs = [ String
s | F.To String
s <- [Flag]
fs ]

cc :: PrimDarcsOption [String]
cc :: PrimDarcsOption [String]
cc = String
-> [String]
-> (String -> Flag)
-> ([Flag] -> [String])
-> String
-> String
-> PrimDarcsOption [String]
multiStrArg [] [String
"cc"] String -> Flag
F.Cc [Flag] -> [String]
mkV String
"EMAIL" String
"mail results to additional EMAIL(s)"
  where mkV :: [Flag] -> [String]
mkV [Flag]
fs = [ String
s | F.Cc String
s <- [Flag]
fs ]

subject :: PrimDarcsOption (Maybe String)
subject :: PrimDarcsOption (Maybe String)
subject = String
-> [String]
-> (String -> Flag)
-> (Flag -> Maybe String)
-> String
-> String
-> PrimDarcsOption (Maybe String)
singleStrArg [] [String
"subject"] String -> Flag
F.Subject Flag -> Maybe String
arg
    String
"SUBJECT" String
"specify mail subject"
  where arg :: Flag -> Maybe String
arg (F.Subject String
s) = forall a. a -> Maybe a
Just String
s
        arg Flag
_ = forall a. Maybe a
Nothing

inReplyTo :: PrimDarcsOption (Maybe String)
inReplyTo :: PrimDarcsOption (Maybe String)
inReplyTo = String
-> [String]
-> (String -> Flag)
-> (Flag -> Maybe String)
-> String
-> String
-> PrimDarcsOption (Maybe String)
singleStrArg [] [String
"in-reply-to"] String -> Flag
F.InReplyTo Flag -> Maybe String
arg
    String
"EMAIL" String
"specify in-reply-to header"
  where arg :: Flag -> Maybe String
arg (F.InReplyTo String
s) = forall a. a -> Maybe a
Just String
s
        arg Flag
_ = forall a. Maybe a
Nothing

sendToContext :: PrimDarcsOption (Maybe AbsolutePath)
sendToContext :: PrimDarcsOption (Maybe AbsolutePath)
sendToContext = String
-> [String]
-> (AbsolutePath -> Flag)
-> (Flag -> Maybe AbsolutePath)
-> String
-> String
-> PrimDarcsOption (Maybe AbsolutePath)
singleAbsPathArg [] [String
"context"] AbsolutePath -> Flag
F.Context Flag -> Maybe AbsolutePath
arg String
"FILENAME"
    String
"send to context stored in FILENAME"
  where arg :: Flag -> Maybe AbsolutePath
arg (F.Context AbsolutePath
s) = forall a. a -> Maybe a
Just AbsolutePath
s
        arg Flag
_ = forall a. Maybe a
Nothing

mail :: PrimDarcsOption Bool
mail :: PrimDarcsOption Bool
mail = String -> [String] -> Flag -> String -> PrimDarcsOption Bool
singleNoArg [] [String
"mail"] Flag
F.Mail String
"send patch using sendmail"

sendmailCmd :: PrimDarcsOption (Maybe String)
sendmailCmd :: PrimDarcsOption (Maybe String)
sendmailCmd = String
-> [String]
-> (String -> Flag)
-> (Flag -> Maybe String)
-> String
-> String
-> PrimDarcsOption (Maybe String)
singleStrArg [] [String
"sendmail-command"] String -> Flag
F.SendmailCmd Flag -> Maybe String
arg String
"COMMAND"
    String
"specify sendmail command"
  where arg :: Flag -> Maybe String
arg (F.SendmailCmd String
s) = forall a. a -> Maybe a
Just String
s
        arg Flag
_ = forall a. Maybe a
Nothing

minimize :: PrimDarcsOption Bool
minimize :: PrimDarcsOption Bool
minimize = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault Bool
True
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"minimize"] Flag
F.Minimize Bool
True String
"minimize context of patch bundle"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"no-minimize"] Flag
F.NoMinimize Bool
False (String
"don't minimize context of patch bundle") ]

charset :: PrimDarcsOption (Maybe String)
charset :: PrimDarcsOption (Maybe String)
charset = String
-> [String]
-> (String -> Flag)
-> (Flag -> Maybe String)
-> String
-> String
-> PrimDarcsOption (Maybe String)
singleStrArg [] [String
"charset"] String -> Flag
F.Charset Flag -> Maybe String
arg
    String
"CHARSET" String
"specify mail charset"
  where arg :: Flag -> Maybe String
arg (F.Charset String
s) = forall a. a -> Maybe a
Just String
s
        arg Flag
_ = forall a. Maybe a
Nothing

editDescription :: PrimDarcsOption Bool
editDescription :: PrimDarcsOption Bool
editDescription = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault Bool
True
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"edit-description"] Flag
F.EditDescription Bool
True
    String
"edit the patch bundle description"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"dont-edit-description",String
"no-edit-description"] Flag
F.NoEditDescription Bool
False
    String
"don't edit the patch bundle description" ]

-- * Patch bundle related

applyAs :: PrimDarcsOption (Maybe String)
applyAs :: PrimDarcsOption (Maybe String)
applyAs = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault forall a. Maybe a
Nothing
  [ forall f v.
String
-> [String]
-> (String -> f)
-> (f -> [String])
-> (String -> v)
-> (v -> [String])
-> String
-> String
-> RawOptSpec f v
RawStrArg [] [String
"apply-as"] String -> Flag
F.ApplyAs Flag -> [String]
unF forall a. a -> Maybe a
Just forall {a}. Maybe a -> [a]
unV String
"USERNAME"
    String
"apply patch as another user using sudo"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"no-apply-as"] Flag
F.NonApply forall a. Maybe a
Nothing
    String
"don't use sudo to apply as another user" ]
  where
    unF :: Flag -> [String]
unF Flag
f = [ String
s | F.ApplyAs String
s <- [Flag
f] ]
    unV :: Maybe a -> [a]
unV Maybe a
x = [ a
s | Just a
s <- [Maybe a
x] ]

data Sign = NoSign | Sign | SignAs String | SignSSL String deriving (Sign -> Sign -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Sign -> Sign -> Bool
$c/= :: Sign -> Sign -> Bool
== :: Sign -> Sign -> Bool
$c== :: Sign -> Sign -> Bool
Eq, Int -> Sign -> ShowS
[Sign] -> ShowS
Sign -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Sign] -> ShowS
$cshowList :: [Sign] -> ShowS
show :: Sign -> String
$cshow :: Sign -> String
showsPrec :: Int -> Sign -> ShowS
$cshowsPrec :: Int -> Sign -> ShowS
Show)

sign :: PrimDarcsOption Sign
sign :: PrimDarcsOption Sign
sign = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault Sign
NoSign
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"sign"] Flag
F.Sign Sign
Sign String
"sign the patch with your gpg key"
  , forall f v.
String
-> [String]
-> (String -> f)
-> (f -> [String])
-> (String -> v)
-> (v -> [String])
-> String
-> String
-> RawOptSpec f v
RawStrArg [] [String
"sign-as"] String -> Flag
F.SignAs Flag -> [String]
unFSignAs String -> Sign
SignAs Sign -> [String]
unSignAs String
"KEYID"
    String
"sign the patch with a given keyid"
  , forall f v.
String
-> [String]
-> (String -> f)
-> (f -> [String])
-> (String -> v)
-> (v -> [String])
-> String
-> String
-> RawOptSpec f v
RawStrArg [] [String
"sign-ssl"] String -> Flag
F.SignSSL  Flag -> [String]
unFSignSSL String -> Sign
SignSSL Sign -> [String]
unSignSSL String
"IDFILE"
    String
"sign the patch using openssl with a given private key"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"dont-sign",String
"no-sign"] Flag
F.NoSign Sign
NoSign String
"don't sign the patch" ]
  where unFSignAs :: Flag -> [String]
unFSignAs Flag
f = [ String
s | F.SignAs String
s <- [Flag
f] ]
        unSignAs :: Sign -> [String]
unSignAs Sign
v = [ String
s | SignAs String
s <- [Sign
v] ]
        unFSignSSL :: Flag -> [String]
unFSignSSL Flag
f = [ String
s | F.SignSSL String
s <- [Flag
f] ]
        unSignSSL :: Sign -> [String]
unSignSSL Sign
v = [ String
s | SignSSL String
s <- [Sign
v] ]

data Verify = NoVerify | VerifyKeyring AbsolutePath | VerifySSL AbsolutePath deriving (Verify -> Verify -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Verify -> Verify -> Bool
$c/= :: Verify -> Verify -> Bool
== :: Verify -> Verify -> Bool
$c== :: Verify -> Verify -> Bool
Eq, Int -> Verify -> ShowS
[Verify] -> ShowS
Verify -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Verify] -> ShowS
$cshowList :: [Verify] -> ShowS
show :: Verify -> String
$cshow :: Verify -> String
showsPrec :: Int -> Verify -> ShowS
$cshowsPrec :: Int -> Verify -> ShowS
Show)

verify :: PrimDarcsOption Verify
verify :: PrimDarcsOption Verify
verify = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault Verify
NoVerify
  [ forall f v.
String
-> [String]
-> (AbsolutePath -> f)
-> (f -> [AbsolutePath])
-> (AbsolutePath -> v)
-> (v -> [AbsolutePath])
-> String
-> String
-> RawOptSpec f v
RawAbsPathArg [] [String
"verify"] AbsolutePath -> Flag
F.Verify Flag -> [AbsolutePath]
unFKeyring AbsolutePath -> Verify
VerifyKeyring Verify -> [AbsolutePath]
unVKeyring String
"PUBRING"
    String
"verify that the patch was signed by a key in PUBRING"
  , forall f v.
String
-> [String]
-> (AbsolutePath -> f)
-> (f -> [AbsolutePath])
-> (AbsolutePath -> v)
-> (v -> [AbsolutePath])
-> String
-> String
-> RawOptSpec f v
RawAbsPathArg [] [String
"verify-ssl"] AbsolutePath -> Flag
F.VerifySSL Flag -> [AbsolutePath]
unFSSL AbsolutePath -> Verify
VerifySSL Verify -> [AbsolutePath]
unVSSL String
"KEYS"
    String
"verify using openSSL with authorized keys from file KEYS"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"no-verify"] Flag
F.NonVerify Verify
NoVerify
    String
"don't verify patch signature" ]
  where
    unFKeyring :: Flag -> [AbsolutePath]
unFKeyring Flag
f = [ AbsolutePath
s | F.Verify AbsolutePath
s <- [Flag
f] ]
    unVKeyring :: Verify -> [AbsolutePath]
unVKeyring Verify
x = [ AbsolutePath
s | VerifyKeyring AbsolutePath
s <- [Verify
x] ]
    unFSSL :: Flag -> [AbsolutePath]
unFSSL Flag
f = [ AbsolutePath
s | F.VerifySSL AbsolutePath
s <- [Flag
f] ]
    unVSSL :: Verify -> [AbsolutePath]
unVSSL Verify
x = [ AbsolutePath
s | VerifySSL AbsolutePath
s <- [Verify
x] ]

-- * Merging patches

-- | push, apply, rebase apply: default to 'NoAllowConflicts'
conflictsNo :: PrimDarcsOption (Maybe AllowConflicts)
conflictsNo :: PrimDarcsOption (Maybe AllowConflicts)
conflictsNo = AllowConflicts -> PrimDarcsOption (Maybe AllowConflicts)
conflicts AllowConflicts
NoAllowConflicts

-- | pull, rebase pull: default to 'YesAllowConflictsAndMark'
conflictsYes :: PrimDarcsOption (Maybe AllowConflicts)
conflictsYes :: PrimDarcsOption (Maybe AllowConflicts)
conflictsYes = AllowConflicts -> PrimDarcsOption (Maybe AllowConflicts)
conflicts AllowConflicts
YesAllowConflictsAndMark

conflicts :: AllowConflicts -> PrimDarcsOption (Maybe AllowConflicts)
conflicts :: AllowConflicts -> PrimDarcsOption (Maybe AllowConflicts)
conflicts AllowConflicts
def = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault (forall a. a -> Maybe a
Just AllowConflicts
def)
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"mark-conflicts"]
      Flag
F.MarkConflicts (forall a. a -> Maybe a
Just AllowConflicts
YesAllowConflictsAndMark) String
"mark conflicts"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"allow-conflicts"]
      Flag
F.AllowConflicts (forall a. a -> Maybe a
Just AllowConflicts
YesAllowConflicts) String
"allow conflicts, but don't mark them"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"dont-allow-conflicts",String
"no-allow-conflicts",String
"no-resolve-conflicts"]
      Flag
F.NoAllowConflicts (forall a. a -> Maybe a
Just AllowConflicts
NoAllowConflicts) String
"fail if there are patches that would create conflicts"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"skip-conflicts"]
      Flag
F.SkipConflicts forall a. Maybe a
Nothing String
"filter out any patches that would create conflicts" ]

-- Technically not an isomorphism.
externalMerge :: PrimDarcsOption ExternalMerge
externalMerge :: PrimDarcsOption ExternalMerge
externalMerge = forall (f :: * -> *) a b. IsoFunctor f => Iso a b -> f a -> f b
imap (forall a b. (a -> b) -> (b -> a) -> Iso a b
Iso forall {t}. (Maybe String -> t) -> ExternalMerge -> t
fw forall {t}. (ExternalMerge -> t) -> Maybe String -> t
bw) forall a b. (a -> b) -> a -> b
$ String
-> [String]
-> (String -> Flag)
-> (Flag -> Maybe String)
-> String
-> String
-> PrimDarcsOption (Maybe String)
singleStrArg [] [String
"external-merge"] String -> Flag
F.ExternalMerge Flag -> Maybe String
arg
    String
"COMMAND" String
"use external tool to merge conflicts"
  where
    arg :: Flag -> Maybe String
arg (F.ExternalMerge String
s) = forall a. a -> Maybe a
Just String
s
    arg Flag
_ = forall a. Maybe a
Nothing
    bw :: (ExternalMerge -> t) -> Maybe String -> t
bw ExternalMerge -> t
k (Just String
s) = ExternalMerge -> t
k (String -> ExternalMerge
YesExternalMerge String
s)
    bw ExternalMerge -> t
k Maybe String
Nothing = ExternalMerge -> t
k ExternalMerge
NoExternalMerge
    fw :: (Maybe String -> t) -> ExternalMerge -> t
fw Maybe String -> t
k (YesExternalMerge String
s) = Maybe String -> t
k (forall a. a -> Maybe a
Just String
s)
    fw Maybe String -> t
k ExternalMerge
NoExternalMerge = Maybe String -> t
k forall a. Maybe a
Nothing

-- | pull, apply, rebase pull, rebase apply
reorder :: PrimDarcsOption Reorder
reorder :: PrimDarcsOption Reorder
reorder = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault Reorder
NoReorder
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"reorder-patches"] Flag
F.Reorder Reorder
Reorder
    String
"put local-only patches on top of remote ones"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"no-reorder-patches"] Flag
F.NoReorder Reorder
NoReorder
    String
"put remote-only patches on top of local ones" ]

-- * Optimizations

compress :: PrimDarcsOption Compression
compress :: PrimDarcsOption Compression
compress = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault Compression
GzipCompression
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"compress"] Flag
F.Compress Compression
GzipCompression String
"compress patch data"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"dont-compress",String
"no-compress"] Flag
F.NoCompress Compression
NoCompression String
"don't compress patch data" ]

usePacks :: PrimDarcsOption Bool
usePacks :: PrimDarcsOption Bool
usePacks = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault Bool
True
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"packs"] Flag
F.Packs Bool
True String
"use repository packs"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"no-packs"] Flag
F.NoPacks Bool
False String
"don't use repository packs" ]

-- for init, clone and convert: patch index disabled by default
patchIndexNo :: PrimDarcsOption WithPatchIndex
patchIndexNo :: PrimDarcsOption WithPatchIndex
patchIndexNo = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault WithPatchIndex
NoPatchIndex [RawDarcsOption
__patchIndex WithPatchIndex
YesPatchIndex, RawDarcsOption
__noPatchIndex WithPatchIndex
NoPatchIndex]

-- for log and annotate: patch index enabled by default
patchIndexYes :: PrimDarcsOption WithPatchIndex
patchIndexYes :: PrimDarcsOption WithPatchIndex
patchIndexYes = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault WithPatchIndex
YesPatchIndex [RawDarcsOption
__patchIndex WithPatchIndex
YesPatchIndex, RawDarcsOption
__noPatchIndex WithPatchIndex
NoPatchIndex]

__patchIndex, __noPatchIndex :: RawDarcsOption
__patchIndex :: RawDarcsOption
__patchIndex v
val = forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"with-patch-index"] Flag
F.PatchIndexFlag v
val String
"build patch index"
__noPatchIndex :: RawDarcsOption
__noPatchIndex v
val = forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"no-patch-index"] Flag
F.NoPatchIndexFlag v
val String
"don't build patch index"

-- diff, dist
storeInMemory :: PrimDarcsOption Bool
storeInMemory :: PrimDarcsOption Bool
storeInMemory = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault Bool
False
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"store-in-memory"] Flag
F.StoreInMemory Bool
True
    String
"do patch application in memory rather than on disk"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"no-store-in-memory"] Flag
F.ApplyOnDisk Bool
False
    String
"do patch application on disk" ]

-- * Output

data Output = Output AbsolutePathOrStd
            | OutputAutoName AbsolutePath
            deriving (Output -> Output -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Output -> Output -> Bool
$c/= :: Output -> Output -> Bool
== :: Output -> Output -> Bool
$c== :: Output -> Output -> Bool
Eq, Int -> Output -> ShowS
[Output] -> ShowS
Output -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Output] -> ShowS
$cshowList :: [Output] -> ShowS
show :: Output -> String
$cshow :: Output -> String
showsPrec :: Int -> Output -> ShowS
$cshowsPrec :: Int -> Output -> ShowS
Show)

output :: PrimDarcsOption (Maybe Output)
output :: PrimDarcsOption (Maybe Output)
output = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault forall a. Maybe a
Nothing
    [ forall f v.
String
-> [String]
-> (AbsolutePathOrStd -> f)
-> (f -> [AbsolutePathOrStd])
-> (AbsolutePathOrStd -> v)
-> (v -> [AbsolutePathOrStd])
-> String
-> String
-> RawOptSpec f v
RawAbsPathOrStdArg [Char
'o'] [String
"output"]
      AbsolutePathOrStd -> Flag
F.Output Flag -> [AbsolutePathOrStd]
unOutputF (forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. AbsolutePathOrStd -> Output
Output) Maybe Output -> [AbsolutePathOrStd]
unOutput
      String
"FILE" String
"specify output filename"
    , forall f v.
String
-> [String]
-> (AbsolutePath -> f)
-> (f -> [AbsolutePath])
-> (AbsolutePath -> v)
-> (v -> [AbsolutePath])
-> String
-> String
-> String
-> RawOptSpec f v
RawOptAbsPathArg [Char
'O'] [String
"output-auto-name"]
      AbsolutePath -> Flag
F.OutputAutoName Flag -> [AbsolutePath]
unOutputAutoNameF (forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. AbsolutePath -> Output
OutputAutoName) Maybe Output -> [AbsolutePath]
unOutputAutoName
      String
"." String
"DIRECTORY"
      String
"output to automatically named file in DIRECTORY, default: current directory"
    ]
  where
    unOutputF :: Flag -> [AbsolutePathOrStd]
unOutputF Flag
f = [ AbsolutePathOrStd
p | F.Output AbsolutePathOrStd
p <- [Flag
f] ]
    unOutput :: Maybe Output -> [AbsolutePathOrStd]
unOutput (Just (Output AbsolutePathOrStd
p)) = [AbsolutePathOrStd
p]
    unOutput Maybe Output
_ = []
    unOutputAutoNameF :: Flag -> [AbsolutePath]
unOutputAutoNameF Flag
f = [ AbsolutePath
p | F.OutputAutoName AbsolutePath
p <- [Flag
f] ]
    unOutputAutoName :: Maybe Output -> [AbsolutePath]
unOutputAutoName (Just (OutputAutoName AbsolutePath
p)) = [AbsolutePath
p]
    unOutputAutoName Maybe Output
_ = []

-- * Miscellaneous

data WithSummary = NoSummary | YesSummary deriving (WithSummary -> WithSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WithSummary -> WithSummary -> Bool
$c/= :: WithSummary -> WithSummary -> Bool
== :: WithSummary -> WithSummary -> Bool
$c== :: WithSummary -> WithSummary -> Bool
Eq, Int -> WithSummary -> ShowS
[WithSummary] -> ShowS
WithSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WithSummary] -> ShowS
$cshowList :: [WithSummary] -> ShowS
show :: WithSummary -> String
$cshow :: WithSummary -> String
showsPrec :: Int -> WithSummary -> ShowS
$cshowsPrec :: Int -> WithSummary -> ShowS
Show)

instance YesNo WithSummary where
  yes :: WithSummary -> Bool
yes WithSummary
NoSummary = Bool
False
  yes WithSummary
YesSummary = Bool
True

-- all commands except whatsnew
withSummary :: PrimDarcsOption WithSummary
withSummary :: PrimDarcsOption WithSummary
withSummary = (forall (f :: * -> *) a b. IsoFunctor f => Iso a b -> f a -> f b
imap forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b c. Iso a b -> Iso (a -> c) (b -> c)
cps) (forall a b. (a -> b) -> (b -> a) -> Iso a b
Iso Maybe WithSummary -> WithSummary
fw WithSummary -> Maybe WithSummary
bw) forall a b. (a -> b) -> a -> b
$ Maybe WithSummary -> PrimDarcsOption (Maybe WithSummary)
maybeSummary forall a. Maybe a
Nothing
  where
    fw :: Maybe WithSummary -> WithSummary
fw Maybe WithSummary
Nothing = WithSummary
NoSummary
    fw (Just WithSummary
NoSummary) = WithSummary
NoSummary
    fw (Just WithSummary
YesSummary) = WithSummary
YesSummary
    bw :: WithSummary -> Maybe WithSummary
bw WithSummary
NoSummary = forall a. Maybe a
Nothing
    bw WithSummary
YesSummary = forall a. a -> Maybe a
Just WithSummary
YesSummary

-- needed for whatsnew
maybeSummary :: Maybe WithSummary -> PrimDarcsOption (Maybe WithSummary)
maybeSummary :: Maybe WithSummary -> PrimDarcsOption (Maybe WithSummary)
maybeSummary Maybe WithSummary
def = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault Maybe WithSummary
def
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [Char
's'] [String
"summary"] Flag
F.Summary (forall a. a -> Maybe a
Just WithSummary
YesSummary) String
"summarize changes"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"no-summary"] Flag
F.NoSummary (forall a. a -> Maybe a
Just WithSummary
NoSummary) String
"don't summarize changes" ]

-- | TODO: reconsider this grouping of options
data NetworkOptions = NetworkOptions
  { NetworkOptions -> Bool
noHttpPipelining :: Bool
  , NetworkOptions -> RemoteDarcs
remoteDarcs :: RemoteDarcs }

networkIso :: Iso (Bool -> Maybe String -> a) (NetworkOptions -> a)
networkIso :: forall a. Iso (Bool -> Maybe String -> a) (NetworkOptions -> a)
networkIso = forall a b. (a -> b) -> (b -> a) -> Iso a b
Iso forall {t}. (Bool -> Maybe String -> t) -> NetworkOptions -> t
fw forall {t}. (NetworkOptions -> t) -> Bool -> Maybe String -> t
bw where
  fw :: (Bool -> Maybe String -> t) -> NetworkOptions -> t
fw Bool -> Maybe String -> t
k (NetworkOptions Bool
x (RemoteDarcs String
y)) = Bool -> Maybe String -> t
k Bool
x (forall a. a -> Maybe a
Just String
y)
  fw Bool -> Maybe String -> t
k (NetworkOptions Bool
x RemoteDarcs
DefaultRemoteDarcs) = Bool -> Maybe String -> t
k Bool
x forall a. Maybe a
Nothing
  bw :: (NetworkOptions -> t) -> Bool -> Maybe String -> t
bw NetworkOptions -> t
k Bool
x (Just String
y) = NetworkOptions -> t
k (Bool -> RemoteDarcs -> NetworkOptions
NetworkOptions Bool
x (String -> RemoteDarcs
RemoteDarcs String
y))
  bw NetworkOptions -> t
k Bool
x Maybe String
Nothing = NetworkOptions -> t
k (Bool -> RemoteDarcs -> NetworkOptions
NetworkOptions Bool
x RemoteDarcs
DefaultRemoteDarcs)

network :: PrimDarcsOption NetworkOptions
network :: PrimDarcsOption NetworkOptions
network = forall (f :: * -> *) a b. IsoFunctor f => Iso a b -> f a -> f b
imap forall a. Iso (Bool -> Maybe String -> a) (NetworkOptions -> a)
networkIso
  forall a b. (a -> b) -> a -> b
$ String -> [String] -> Flag -> String -> PrimDarcsOption Bool
singleNoArg [] [String
"no-http-pipelining"] Flag
F.NoHTTPPipelining String
"disable HTTP pipelining"
  forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ String
-> [String]
-> (String -> Flag)
-> (Flag -> Maybe String)
-> String
-> String
-> PrimDarcsOption (Maybe String)
singleStrArg [] [String
"remote-darcs"] String -> Flag
F.RemoteDarcsOpt Flag -> Maybe String
arg String
"COMMAND"
    String
"name of the darcs executable on the remote server"
  where arg :: Flag -> Maybe String
arg (F.RemoteDarcsOpt String
s) = forall a. a -> Maybe a
Just String
s
        arg Flag
_ = forall a. Maybe a
Nothing

umask :: PrimDarcsOption UMask
umask :: PrimDarcsOption UMask
umask = (forall (f :: * -> *) a b. IsoFunctor f => Iso a b -> f a -> f b
imap forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b c. Iso a b -> Iso (a -> c) (b -> c)
cps) (forall a b. (a -> b) -> (b -> a) -> Iso a b
Iso Maybe String -> UMask
fw UMask -> Maybe String
bw) forall a b. (a -> b) -> a -> b
$ String
-> [String]
-> (String -> Flag)
-> (Flag -> Maybe String)
-> String
-> String
-> PrimDarcsOption (Maybe String)
singleStrArg [] [String
"umask"] String -> Flag
F.UMask Flag -> Maybe String
arg String
"UMASK"
    String
"specify umask to use when writing"
  where
    arg :: Flag -> Maybe String
arg (F.UMask String
s) = forall a. a -> Maybe a
Just String
s
    arg Flag
_ = forall a. Maybe a
Nothing
    fw :: Maybe String -> UMask
fw (Just String
s) = String -> UMask
YesUMask String
s
    fw Maybe String
Nothing = UMask
NoUMask
    bw :: UMask -> Maybe String
bw (YesUMask String
s) = forall a. a -> Maybe a
Just String
s
    bw UMask
NoUMask = forall a. Maybe a
Nothing

setScriptsExecutable :: PrimDarcsOption SetScriptsExecutable
setScriptsExecutable :: PrimDarcsOption SetScriptsExecutable
setScriptsExecutable = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault SetScriptsExecutable
NoSetScriptsExecutable
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"set-scripts-executable"] Flag
F.SetScriptsExecutable SetScriptsExecutable
YesSetScriptsExecutable
    String
"make scripts executable"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"dont-set-scripts-executable",String
"no-set-scripts-executable"]
    Flag
F.DontSetScriptsExecutable SetScriptsExecutable
NoSetScriptsExecutable String
"don't make scripts executable" ]

-- * Specific to a single command

-- ** amend

amendUnrecord :: PrimDarcsOption Bool
amendUnrecord :: PrimDarcsOption Bool
amendUnrecord = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault Bool
False
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"unrecord"] Flag
F.AmendUnrecord Bool
True String
"remove changes from the patch"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"record"] Flag
F.NoAmendUnrecord Bool
False String
"add more changes to the patch" ]

selectAuthor :: PrimDarcsOption Bool
selectAuthor :: PrimDarcsOption Bool
selectAuthor = String -> [String] -> Flag -> String -> PrimDarcsOption Bool
singleNoArg [] [String
"select-author"] Flag
F.SelectAuthor
  String
"select author id from a menu"

-- ** annotate

machineReadable :: PrimDarcsOption Bool
machineReadable :: PrimDarcsOption Bool
machineReadable = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault Bool
False
  [ RawDarcsOption
__humanReadable Bool
False
  , RawDarcsOption
__machineReadable Bool
True ]

__humanReadable :: RawDarcsOption
__humanReadable :: RawDarcsOption
__humanReadable v
val = forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"human-readable"] Flag
F.HumanReadable v
val String
"normal human-readable output"

__machineReadable :: RawDarcsOption
__machineReadable :: RawDarcsOption
__machineReadable v
val = forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"machine-readable"] Flag
F.MachineReadable v
val String
"machine-readable output"

-- ** clone

cloneKind :: PrimDarcsOption CloneKind
cloneKind :: PrimDarcsOption CloneKind
cloneKind = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault CloneKind
NormalClone
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"lazy"] Flag
F.Lazy CloneKind
LazyClone String
"get patch files only as needed"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"complete"] Flag
F.Complete CloneKind
CompleteClone String
"get a complete copy of the repository" ]

-- ** convert import/export

marks :: DarcsOption a (Maybe String -> Maybe String -> a)
marks :: forall a. DarcsOption a (Maybe String -> Maybe String -> a)
marks = PrimDarcsOption (Maybe String)
readMarks forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ PrimDarcsOption (Maybe String)
writeMarks

readMarks :: PrimDarcsOption (Maybe String)
readMarks :: PrimDarcsOption (Maybe String)
readMarks = String
-> [String]
-> (String -> Flag)
-> (Flag -> Maybe String)
-> String
-> String
-> PrimDarcsOption (Maybe String)
singleStrArg [] [String
"read-marks"] String -> Flag
F.ReadMarks Flag -> Maybe String
arg
    String
"FILE" String
"continue conversion, previously checkpointed by --write-marks"
  where arg :: Flag -> Maybe String
arg (F.ReadMarks String
s) = forall a. a -> Maybe a
Just String
s
        arg Flag
_ = forall a. Maybe a
Nothing

writeMarks :: PrimDarcsOption (Maybe String)
writeMarks :: PrimDarcsOption (Maybe String)
writeMarks = String
-> [String]
-> (String -> Flag)
-> (Flag -> Maybe String)
-> String
-> String
-> PrimDarcsOption (Maybe String)
singleStrArg [] [String
"write-marks"] String -> Flag
F.WriteMarks Flag -> Maybe String
arg
    String
"FILE" String
"checkpoint conversion to continue it later"
  where arg :: Flag -> Maybe String
arg (F.WriteMarks String
s) = forall a. a -> Maybe a
Just String
s
        arg Flag
_ = forall a. Maybe a
Nothing

-- | Deprecated flag, still present to output an error message.
hashed :: PrimDarcsOption ()
hashed :: PrimDarcsOption ()
hashed = forall v. [String] -> [RawOptSpec Flag v] -> PrimDarcsOption ()
deprecated
  [ String
"All repositories are now \"hashed\", so this option was removed."
  , String
"Use --darcs-1 to get the effect that --hashed had previously." ] forall a b. (a -> b) -> a -> b
$
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"hashed"] Flag
F.Hashed () String
"deprecated, use --darcs-1 instead" ]

patchFormat :: PrimDarcsOption PatchFormat
patchFormat :: PrimDarcsOption PatchFormat
patchFormat = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault PatchFormat
PatchFormat2
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"darcs-3"] Flag
F.UseFormat3 PatchFormat
PatchFormat3
    String
"New darcs patch format"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"darcs-2"] Flag
F.UseFormat2 PatchFormat
PatchFormat2
    String
"Standard darcs patch format"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"darcs-1"] Flag
F.UseFormat1 PatchFormat
PatchFormat1
    String
"Older patch format (for compatibility)" ]

-- ** dist

distname :: PrimDarcsOption (Maybe String)
distname :: PrimDarcsOption (Maybe String)
distname = String
-> [String]
-> (String -> Flag)
-> (Flag -> Maybe String)
-> String
-> String
-> PrimDarcsOption (Maybe String)
singleStrArg [Char
'd'] [String
"dist-name"] String -> Flag
F.DistName Flag -> Maybe String
arg String
"DISTNAME" String
"name of version"
  where arg :: Flag -> Maybe String
arg (F.DistName String
s) = forall a. a -> Maybe a
Just String
s
        arg Flag
_ = forall a. Maybe a
Nothing

distzip :: PrimDarcsOption Bool
distzip :: PrimDarcsOption Bool
distzip = String -> [String] -> Flag -> String -> PrimDarcsOption Bool
singleNoArg [] [String
"zip"] Flag
F.DistZip String
"generate zip archive instead of gzip'ed tar"

-- ** log

data ChangesFormat
  = HumanReadable
  | MachineReadable
  | GenContext
  | GenXml
  | NumberPatches
  | CountPatches
  deriving (ChangesFormat -> ChangesFormat -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChangesFormat -> ChangesFormat -> Bool
$c/= :: ChangesFormat -> ChangesFormat -> Bool
== :: ChangesFormat -> ChangesFormat -> Bool
$c== :: ChangesFormat -> ChangesFormat -> Bool
Eq, Int -> ChangesFormat -> ShowS
[ChangesFormat] -> ShowS
ChangesFormat -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChangesFormat] -> ShowS
$cshowList :: [ChangesFormat] -> ShowS
show :: ChangesFormat -> String
$cshow :: ChangesFormat -> String
showsPrec :: Int -> ChangesFormat -> ShowS
$cshowsPrec :: Int -> ChangesFormat -> ShowS
Show)

changesFormat :: PrimDarcsOption (Maybe ChangesFormat)
changesFormat :: PrimDarcsOption (Maybe ChangesFormat)
changesFormat = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault forall a. Maybe a
Nothing
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"context"] Flag
F.GenContext (forall a. a -> Maybe a
Just ChangesFormat
GenContext) String
"produce output suitable for clone --context"
  , RawDarcsOption
__xmloutput (forall a. a -> Maybe a
Just ChangesFormat
GenXml)
  , RawDarcsOption
__humanReadable (forall a. a -> Maybe a
Just ChangesFormat
HumanReadable)
  , RawDarcsOption
__machineReadable (forall a. a -> Maybe a
Just ChangesFormat
MachineReadable)
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"number"] Flag
F.NumberPatches (forall a. a -> Maybe a
Just ChangesFormat
NumberPatches) String
"number the changes"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"count"] Flag
F.Count (forall a. a -> Maybe a
Just ChangesFormat
CountPatches) String
"output count of changes" ]

-- ** replace

tokens :: PrimDarcsOption (Maybe String)
tokens :: PrimDarcsOption (Maybe String)
tokens = String
-> [String]
-> (String -> Flag)
-> (Flag -> Maybe String)
-> String
-> String
-> PrimDarcsOption (Maybe String)
singleStrArg [] [String
"token-chars"] String -> Flag
F.Toks Flag -> Maybe String
arg String
"\"[CHARS]\""
    String
"define token to contain these characters"
  where arg :: Flag -> Maybe String
arg (F.Toks String
s) = forall a. a -> Maybe a
Just String
s; arg Flag
_ = forall a. Maybe a
Nothing

forceReplace :: PrimDarcsOption Bool
forceReplace :: PrimDarcsOption Bool
forceReplace = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault Bool
False
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [Char
'f'] [String
"force"] Flag
F.ForceReplace Bool
True
    String
"proceed with replace even if 'new' token already exists"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"no-force"] Flag
F.NonForce Bool
False
    String
"don't force the replace if it looks scary" ]

-- ** test

data TestStrategy = Once | Linear | Backoff | Bisect deriving (TestStrategy -> TestStrategy -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TestStrategy -> TestStrategy -> Bool
$c/= :: TestStrategy -> TestStrategy -> Bool
== :: TestStrategy -> TestStrategy -> Bool
$c== :: TestStrategy -> TestStrategy -> Bool
Eq, Int -> TestStrategy -> ShowS
[TestStrategy] -> ShowS
TestStrategy -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TestStrategy] -> ShowS
$cshowList :: [TestStrategy] -> ShowS
show :: TestStrategy -> String
$cshow :: TestStrategy -> String
showsPrec :: Int -> TestStrategy -> ShowS
$cshowsPrec :: Int -> TestStrategy -> ShowS
Show)

testStrategy :: PrimDarcsOption TestStrategy
testStrategy :: PrimDarcsOption TestStrategy
testStrategy = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault TestStrategy
Once
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"once"] Flag
F.Once TestStrategy
Once String
"run test on current version only"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"linear"] Flag
F.Linear TestStrategy
Linear String
"locate the most recent version lacking an error"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"backoff"] Flag
F.Backoff TestStrategy
Backoff String
"exponential backoff search"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"bisect"] Flag
F.Bisect TestStrategy
Bisect String
"binary instead of linear search" ]

-- ** show files

files :: PrimDarcsOption Bool
files :: PrimDarcsOption Bool
files = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault Bool
True
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"files"] Flag
F.Files Bool
True String
"include files in output"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"no-files"] Flag
F.NoFiles Bool
False String
"don't include files in output" ]

directories :: PrimDarcsOption Bool
directories :: PrimDarcsOption Bool
directories = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault Bool
True
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"directories"] Flag
F.Directories Bool
True String
"include directories in output"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"no-directories"] Flag
F.NoDirectories Bool
False String
"don't include directories in output" ]

pending :: PrimDarcsOption Bool
pending :: PrimDarcsOption Bool
pending = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault Bool
True
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"pending"] Flag
F.Pending Bool
True String
"reflect pending patches in output"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"no-pending"] Flag
F.NoPending Bool
False String
"only include recorded patches in output" ]

-- "null" is already taken
nullFlag :: PrimDarcsOption Bool
nullFlag :: PrimDarcsOption Bool
nullFlag = String -> [String] -> Flag -> String -> PrimDarcsOption Bool
singleNoArg [Char
'0'] [String
"null"] Flag
F.NullFlag String
"separate file names by NUL characters"

-- ** show repo

enumPatches :: PrimDarcsOption EnumPatches
enumPatches :: PrimDarcsOption EnumPatches
enumPatches = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault EnumPatches
YesEnumPatches
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"enum-patches"] Flag
F.EnumPatches EnumPatches
YesEnumPatches
    String
"include statistics requiring enumeration of patches"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"no-enum-patches"] Flag
F.NoEnumPatches EnumPatches
NoEnumPatches
    String
"don't include statistics requiring enumeration of patches" ]

-- ** gzcrcs

data GzcrcsAction = GzcrcsCheck | GzcrcsRepair deriving (GzcrcsAction -> GzcrcsAction -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GzcrcsAction -> GzcrcsAction -> Bool
$c/= :: GzcrcsAction -> GzcrcsAction -> Bool
== :: GzcrcsAction -> GzcrcsAction -> Bool
$c== :: GzcrcsAction -> GzcrcsAction -> Bool
Eq, Int -> GzcrcsAction -> ShowS
[GzcrcsAction] -> ShowS
GzcrcsAction -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GzcrcsAction] -> ShowS
$cshowList :: [GzcrcsAction] -> ShowS
show :: GzcrcsAction -> String
$cshow :: GzcrcsAction -> String
showsPrec :: Int -> GzcrcsAction -> ShowS
$cshowsPrec :: Int -> GzcrcsAction -> ShowS
Show)

gzcrcsActions :: PrimDarcsOption (Maybe GzcrcsAction)
gzcrcsActions :: PrimDarcsOption (Maybe GzcrcsAction)
gzcrcsActions = forall v. Eq v => v -> [RawOptSpec Flag v] -> PrimDarcsOption v
withDefault forall a. Maybe a
Nothing
  [ forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"check"] Flag
F.Check (forall a. a -> Maybe a
Just GzcrcsAction
GzcrcsCheck) String
"Specify checking mode"
  , forall f v.
String -> [String] -> f -> v -> String -> RawOptSpec f v
RawNoArg [] [String
"repair"] Flag
F.Repair (forall a. a -> Maybe a
Just GzcrcsAction
GzcrcsRepair) String
"Specify repair mode" ]

-- ** optimize

siblings :: PrimDarcsOption [AbsolutePath]
siblings :: PrimDarcsOption [AbsolutePath]
siblings = String
-> [String]
-> (AbsolutePath -> Flag)
-> ([Flag] -> [AbsolutePath])
-> String
-> String
-> PrimDarcsOption [AbsolutePath]
multiAbsPathArg [] [String
"sibling"] AbsolutePath -> Flag
F.Sibling [Flag] -> [AbsolutePath]
mkV String
"DIRECTORY"
    String
"specify a sibling directory"
  where mkV :: [Flag] -> [AbsolutePath]
mkV [Flag]
fs = [ AbsolutePath
s | F.Sibling AbsolutePath
s <- [Flag]
fs ]