--  Copyright (C) 2009 Ganesh Sittampalam
--
--  BSD3

{-# LANGUAGE TypeOperators #-}

module Darcs.UI.Commands.Rebase ( rebase ) where

import Prelude ()
import Darcs.Prelude

import Darcs.UI.Commands
    ( DarcsCommand(..), withStdOpts
    , normalCommand, hiddenCommand
    , commandAlias
    , defaultRepo, nodefaults
    , putInfo, putVerbose
    , setEnvDarcsPatches
    , amInHashedRepository
    )
import Darcs.UI.Commands.Util ( printDryRunMessageAndExit )
import Darcs.UI.Commands.Apply ( applyCmd )
import Darcs.UI.Commands.Log ( changelog, getLogInfo )
import Darcs.UI.Commands.Pull ( pullCmd, revertable )
import Darcs.UI.Commands.Unrecord ( getLastPatches, matchingHead )
import Darcs.UI.CommandsAux ( checkPaths )
import Darcs.UI.Completion ( fileArgs, prefArgs, noArgs )
import Darcs.UI.Flags
    ( DarcsFlag
    , externalMerge, allowConflicts
    , compress, diffingOpts
    , dryRun, reorder, verbosity, verbose
    , useCache, wantGuiPause
    , umask, matchAny, changesReverse
    , onlyToFiles
    , diffAlgorithm, maxCount, isInteractive
    , selectDeps, xmlOutput, hasXmlOutput
    )
import Darcs.UI.Options
    ( (^), oid, odesc, ocheck, onormalise
    , defaultFlags, parseFlags, (?)
    )
import qualified Darcs.UI.Options.All as O
import Darcs.UI.PatchHeader ( HijackT, HijackOptions(..), runHijackT
                            , getAuthor
                            , updatePatchHeader, AskAboutDeps(..) )
import Darcs.Repository
    ( Repository, RepoJob(..), withRepoLock, withRepository
    , RebaseJobFlags(..)
    , tentativelyAddPatch, finalizeRepositoryChanges
    , invalidateIndex
    , tentativelyRemovePatches, readRepo
    , tentativelyAddToPending, unrecordedChanges, applyToWorking
    , revertRepositoryChanges
    , setScriptsExecutablePatches
    )
import Darcs.Repository.Flags ( UpdateWorking(..), ExternalMerge(..) )
import Darcs.Repository.Merge ( tentativelyMergePatches, announceMergeConflicts )
import Darcs.Repository.Resolution ( standardResolution )
import Darcs.Patch ( invert, effect, commute, RepoPatch, description )
import Darcs.Patch.Apply ( ApplyState )
import Darcs.Patch.Commute ( selfCommuter )
import Darcs.Patch.CommuteFn ( commuterIdFL )
import Darcs.Patch.Info ( displayPatchInfo )
import Darcs.Patch.Match ( firstMatch, secondMatch, splitSecondFL )
import Darcs.Patch.Named ( Named, fmapFL_Named, patchcontents, patch2patchinfo )
import Darcs.Patch.Named.Wrapped ( mkRebase, toRebasing, fromRebasing )
import Darcs.Patch.PatchInfoAnd ( PatchInfoAnd, info, n2pia, hopefully )
import Darcs.Patch.Prim ( PrimOf, canonizeFL, fromPrim )
import Darcs.Patch.Rebase ( takeHeadRebase, takeHeadRebaseFL )
import Darcs.Patch.Rebase.Container ( Suspended(..) )
import Darcs.Patch.Rebase.Fixup ( RebaseFixup(..), flToNamesPrims )
import Darcs.Patch.Rebase.Item ( RebaseItem(..), simplifyPush, simplifyPushes )
import Darcs.Patch.Rebase.Name ( RebaseName(..), commuteNameNamed )
import Darcs.Patch.Rebase.Viewing
    ( RebaseSelect(RSFwd), rsToPia
    , toRebaseSelect, fromRebaseSelect, extractRebaseSelect, reifyRebaseSelect
    , partitionUnconflicted
    , WithDroppedDeps(..), WDDNamed, commuterIdWDD
    , toRebaseChanges
    )
import Darcs.Patch.Permutations ( partitionConflictingFL )
import Darcs.Patch.Progress ( progressFL )
import Darcs.Patch.RepoType ( RepoType(..), RebaseType(..) )
import Darcs.Patch.Set ( PatchSet(..), appendPSFL )
import Darcs.Patch.Show ( showNicely )
import Darcs.Patch.Split ( primSplitter )
import Darcs.UI.ApplyPatches ( PatchApplier(..), PatchProxy(..) )
import Darcs.UI.SelectChanges
    ( runSelection
    , selectionContext, selectionContextGeneric, selectionContextPrim
    , WhichChanges(First, Last, LastReversed)
    , viewChanges
    )
import qualified Darcs.UI.SelectChanges as S ( PatchSelectionOptions (..) )
import Darcs.Patch.Witnesses.Eq ( EqCheck(..) )
import Darcs.Patch.Witnesses.Ordered
    ( FL(..), (+>+), mapFL_FL
    , concatFL, mapFL, nullFL, lengthFL
    , (:>)(..)
    , RL(..), reverseRL
    )
import Darcs.Patch.Witnesses.Sealed
    ( Sealed(..), seal, unseal
    , FlippedSeal(..)
    , Sealed2(..)
    )
import Darcs.Patch.Witnesses.Unsafe ( unsafeCoerceP )
import Darcs.Util.English ( englishNum, Noun(Noun) )
import Darcs.Util.Printer
    ( vcat, text, ($$), redText
    , putDocLnWith, simplePrinters
    , renderString
    )
import Darcs.Util.Printer.Color ( fancyPrinters )
import Darcs.Util.Progress ( debugMessage )
import Darcs.Util.Path ( AbsolutePath )

import Darcs.Util.Tree ( Tree )

import Control.Exception ( catch, IOException )
import Control.Monad ( when )
import Control.Monad.Trans ( liftIO )
import System.Exit ( exitSuccess )

rebaseDescription :: String
rebaseDescription :: String
rebaseDescription = "Edit several patches at once."

rebaseHelp :: String
rebaseHelp :: String
rebaseHelp =
 "The `darcs rebase' command is used to edit a collection of darcs patches.\n"

rebase :: DarcsCommand [DarcsFlag]
rebase :: DarcsCommand [DarcsFlag]
rebase = SuperCommand :: forall parsedFlags.
String
-> String
-> String
-> String
-> ([DarcsFlag] -> IO (Either String ()))
-> [CommandControl]
-> DarcsCommand parsedFlags
SuperCommand
    { commandProgramName :: String
commandProgramName = "darcs"
    , commandName :: String
commandName = "rebase"
    , commandHelp :: String
commandHelp = String
rebaseHelp
    , commandDescription :: String
commandDescription = String
rebaseDescription
    , commandPrereq :: [DarcsFlag] -> IO (Either String ())
commandPrereq = [DarcsFlag] -> IO (Either String ())
amInHashedRepository
    , commandSubCommands :: [CommandControl]
commandSubCommands =
        [ DarcsCommand [DarcsFlag] -> CommandControl
forall parsedFlags. DarcsCommand parsedFlags -> CommandControl
normalCommand DarcsCommand [DarcsFlag]
pull
        , DarcsCommand [DarcsFlag] -> CommandControl
forall parsedFlags. DarcsCommand parsedFlags -> CommandControl
normalCommand DarcsCommand [DarcsFlag]
apply
        , DarcsCommand [DarcsFlag] -> CommandControl
forall parsedFlags. DarcsCommand parsedFlags -> CommandControl
normalCommand DarcsCommand [DarcsFlag]
suspend
        , DarcsCommand [DarcsFlag] -> CommandControl
forall parsedFlags. DarcsCommand parsedFlags -> CommandControl
normalCommand DarcsCommand [DarcsFlag]
unsuspend
        , DarcsCommand [DarcsFlag] -> CommandControl
forall parsedFlags. DarcsCommand parsedFlags -> CommandControl
hiddenCommand DarcsCommand [DarcsFlag]
reify
        , DarcsCommand [DarcsFlag] -> CommandControl
forall parsedFlags. DarcsCommand parsedFlags -> CommandControl
hiddenCommand DarcsCommand [DarcsFlag]
inject
        , DarcsCommand [DarcsFlag] -> CommandControl
forall parsedFlags. DarcsCommand parsedFlags -> CommandControl
normalCommand DarcsCommand [DarcsFlag]
obliterate
        , DarcsCommand [DarcsFlag] -> CommandControl
forall parsedFlags. DarcsCommand parsedFlags -> CommandControl
normalCommand DarcsCommand [DarcsFlag]
log
        , DarcsCommand [DarcsFlag] -> CommandControl
forall parsedFlags. DarcsCommand parsedFlags -> CommandControl
hiddenCommand DarcsCommand [DarcsFlag]
changes
        ]
    }

suspend :: DarcsCommand [DarcsFlag]
suspend :: DarcsCommand [DarcsFlag]
suspend = DarcsCommand :: forall parsedFlags.
String
-> String
-> String
-> String
-> Int
-> [String]
-> ((AbsolutePath, AbsolutePath)
    -> parsedFlags -> [String] -> IO ())
-> ([DarcsFlag] -> IO (Either String ()))
-> ((AbsolutePath, AbsolutePath)
    -> [DarcsFlag] -> [String] -> IO [String])
-> ([DarcsFlag] -> AbsolutePath -> [String] -> IO [String])
-> [DarcsOptDescr DarcsFlag]
-> [DarcsOptDescr DarcsFlag]
-> [DarcsFlag]
-> ([DarcsFlag] -> [String])
-> ([DarcsFlag] -> parsedFlags)
-> DarcsCommand parsedFlags
DarcsCommand
    { commandProgramName :: String
commandProgramName = "darcs"
    , commandName :: String
commandName = "suspend"
    , commandHelp :: String
commandHelp = "Select patches to move into a suspended state at the end of the repo.\n"
    , commandDescription :: String
commandDescription = "Select patches to move into a suspended state at the end of the repo."
    , commandPrereq :: [DarcsFlag] -> IO (Either String ())
commandPrereq = [DarcsFlag] -> IO (Either String ())
amInHashedRepository
    , commandExtraArgs :: Int
commandExtraArgs = 0
    , commandExtraArgHelp :: [String]
commandExtraArgHelp = []
    , commandCommand :: (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
commandCommand = (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
suspendCmd
    , commandCompleteArgs :: (AbsolutePath, AbsolutePath)
-> [DarcsFlag] -> [String] -> IO [String]
commandCompleteArgs = (AbsolutePath, AbsolutePath)
-> [DarcsFlag] -> [String] -> IO [String]
noArgs
    , commandArgdefaults :: [DarcsFlag] -> AbsolutePath -> [String] -> IO [String]
commandArgdefaults = [DarcsFlag] -> AbsolutePath -> [String] -> IO [String]
nodefaults
    , commandAdvancedOptions :: [DarcsOptDescr DarcsFlag]
commandAdvancedOptions = OptSpec DarcsOptDescr DarcsFlag Any (Bool -> UseIndex -> Any)
-> [DarcsOptDescr DarcsFlag]
forall (d :: * -> *) f a b. OptSpec d f a b -> [d f]
odesc OptSpec DarcsOptDescr DarcsFlag Any (Bool -> UseIndex -> Any)
forall a. OptSpec DarcsOptDescr DarcsFlag a (Bool -> UseIndex -> a)
suspendAdvancedOpts
    , commandBasicOptions :: [DarcsOptDescr DarcsFlag]
commandBasicOptions = OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  ([MatchFlag]
   -> SelectDeps -> Maybe Bool -> Summary -> DiffAlgorithm -> Any)
-> [DarcsOptDescr DarcsFlag]
forall (d :: * -> *) f a b. OptSpec d f a b -> [d f]
odesc OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  ([MatchFlag]
   -> SelectDeps -> Maybe Bool -> Summary -> DiffAlgorithm -> Any)
forall a.
OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  ([MatchFlag]
   -> SelectDeps -> Maybe Bool -> Summary -> DiffAlgorithm -> a)
suspendBasicOpts
    , commandDefaults :: [DarcsFlag]
commandDefaults = OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  ([MatchFlag]
   -> SelectDeps
   -> Maybe Bool
   -> Summary
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> Bool
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> [DarcsFlag])
-> [DarcsFlag]
forall (d :: * -> *) f b. OptSpec d f [f] b -> [f]
defaultFlags OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  ([MatchFlag]
   -> SelectDeps
   -> Maybe Bool
   -> Summary
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> Bool
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> [DarcsFlag])
forall a.
DarcsOption
  a
  ([MatchFlag]
   -> SelectDeps
   -> Maybe Bool
   -> Summary
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> Bool
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> a)
suspendOpts
    , commandCheckOptions :: [DarcsFlag] -> [String]
commandCheckOptions = OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  ([MatchFlag]
   -> SelectDeps
   -> Maybe Bool
   -> Summary
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> Bool
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> Any)
-> [DarcsFlag] -> [String]
forall (d :: * -> *) f a b. OptSpec d f a b -> [f] -> [String]
ocheck OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  ([MatchFlag]
   -> SelectDeps
   -> Maybe Bool
   -> Summary
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> Bool
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> Any)
forall a.
DarcsOption
  a
  ([MatchFlag]
   -> SelectDeps
   -> Maybe Bool
   -> Summary
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> Bool
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> a)
suspendOpts
    , commandParseOptions :: [DarcsFlag] -> [DarcsFlag]
commandParseOptions = OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  ([MatchFlag]
   -> SelectDeps
   -> Maybe Bool
   -> Summary
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> Bool
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> [DarcsFlag])
-> [DarcsFlag] -> [DarcsFlag]
forall (d :: * -> *) f b. OptSpec d f [f] b -> [f] -> [f]
onormalise OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  ([MatchFlag]
   -> SelectDeps
   -> Maybe Bool
   -> Summary
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> Bool
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> [DarcsFlag])
forall a.
DarcsOption
  a
  ([MatchFlag]
   -> SelectDeps
   -> Maybe Bool
   -> Summary
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> Bool
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> a)
suspendOpts
    }
  where
    suspendBasicOpts :: OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  ([MatchFlag]
   -> SelectDeps -> Maybe Bool -> Summary -> DiffAlgorithm -> a)
suspendBasicOpts
      = PrimOptSpec
  DarcsOptDescr
  DarcsFlag
  (SelectDeps -> Maybe Bool -> Summary -> DiffAlgorithm -> a)
  [MatchFlag]
MatchOption
O.matchSeveralOrLast
      PrimOptSpec
  DarcsOptDescr
  DarcsFlag
  (SelectDeps -> Maybe Bool -> Summary -> DiffAlgorithm -> a)
  [MatchFlag]
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Maybe Bool -> Summary -> DiffAlgorithm -> a)
     (SelectDeps -> Maybe Bool -> Summary -> DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Maybe Bool -> Summary -> DiffAlgorithm -> a)
     ([MatchFlag]
      -> SelectDeps -> Maybe Bool -> Summary -> DiffAlgorithm -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe Bool -> Summary -> DiffAlgorithm -> a)
  (SelectDeps -> Maybe Bool -> Summary -> DiffAlgorithm -> a)
PrimDarcsOption SelectDeps
O.selectDeps
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe Bool -> Summary -> DiffAlgorithm -> a)
  ([MatchFlag]
   -> SelectDeps -> Maybe Bool -> Summary -> DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Summary -> DiffAlgorithm -> a)
     (Maybe Bool -> Summary -> DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Summary -> DiffAlgorithm -> a)
     ([MatchFlag]
      -> SelectDeps -> Maybe Bool -> Summary -> DiffAlgorithm -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (Summary -> DiffAlgorithm -> a)
  (Maybe Bool -> Summary -> DiffAlgorithm -> a)
PrimDarcsOption (Maybe Bool)
O.interactive
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (Summary -> DiffAlgorithm -> a)
  ([MatchFlag]
   -> SelectDeps -> Maybe Bool -> Summary -> DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (DiffAlgorithm -> a)
     (Summary -> DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (DiffAlgorithm -> a)
     ([MatchFlag]
      -> SelectDeps -> Maybe Bool -> Summary -> DiffAlgorithm -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (DiffAlgorithm -> a)
  (Summary -> DiffAlgorithm -> a)
PrimDarcsOption Summary
O.summary
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (DiffAlgorithm -> a)
  ([MatchFlag]
   -> SelectDeps -> Maybe Bool -> Summary -> DiffAlgorithm -> a)
-> OptSpec DarcsOptDescr DarcsFlag a (DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     a
     ([MatchFlag]
      -> SelectDeps -> Maybe Bool -> Summary -> DiffAlgorithm -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec DarcsOptDescr DarcsFlag a (DiffAlgorithm -> a)
PrimDarcsOption DiffAlgorithm
O.diffAlgorithm
    suspendAdvancedOpts :: OptSpec DarcsOptDescr DarcsFlag a (Bool -> UseIndex -> a)
suspendAdvancedOpts
      = PrimOptSpec DarcsOptDescr DarcsFlag (UseIndex -> a) Bool
PrimDarcsOption Bool
O.changesReverse
      PrimOptSpec DarcsOptDescr DarcsFlag (UseIndex -> a) Bool
-> OptSpec DarcsOptDescr DarcsFlag a (UseIndex -> a)
-> OptSpec DarcsOptDescr DarcsFlag a (Bool -> UseIndex -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec DarcsOptDescr DarcsFlag a (UseIndex -> a)
PrimDarcsOption UseIndex
O.useIndex
    suspendOpts :: DarcsOption
  a
  ([MatchFlag]
   -> SelectDeps
   -> Maybe Bool
   -> Summary
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> Bool
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> a)
suspendOpts = OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> Bool
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> a)
  ([MatchFlag]
   -> SelectDeps
   -> Maybe Bool
   -> Summary
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> Bool
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> a)
forall a.
OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  ([MatchFlag]
   -> SelectDeps -> Maybe Bool -> Summary -> DiffAlgorithm -> a)
suspendBasicOpts OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> Bool
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> a)
  ([MatchFlag]
   -> SelectDeps
   -> Maybe Bool
   -> Summary
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> Bool
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> a)
-> DarcsOption
     (UseCache -> HooksConfig -> a)
     (Bool -> UseIndex -> UseCache -> HooksConfig -> a)
-> DarcsOption
     a
     ([MatchFlag]
      -> SelectDeps
      -> Maybe Bool
      -> Summary
      -> DiffAlgorithm
      -> Maybe StdCmdAction
      -> Bool
      -> Bool
      -> Verbosity
      -> Bool
      -> Bool
      -> UseIndex
      -> UseCache
      -> HooksConfig
      -> a)
forall b c a.
DarcsOption
  (Maybe StdCmdAction -> Bool -> Bool -> Verbosity -> Bool -> b) c
-> DarcsOption (UseCache -> HooksConfig -> a) b -> DarcsOption a c
`withStdOpts` DarcsOption
  (UseCache -> HooksConfig -> a)
  (Bool -> UseIndex -> UseCache -> HooksConfig -> a)
forall a. OptSpec DarcsOptDescr DarcsFlag a (Bool -> UseIndex -> a)
suspendAdvancedOpts

suspendCmd :: (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
suspendCmd :: (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
suspendCmd _ opts :: [DarcsFlag]
opts _args :: [String]
_args =
    DryRun -> UseCache -> UpdateWorking -> UMask -> RepoJob () -> IO ()
forall a.
DryRun -> UseCache -> UpdateWorking -> UMask -> RepoJob a -> IO a
withRepoLock (PrimDarcsOption DryRun
dryRun PrimDarcsOption DryRun -> [DarcsFlag] -> DryRun
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) (PrimDarcsOption UseCache
useCache PrimDarcsOption UseCache -> [DarcsFlag] -> UseCache
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) UpdateWorking
YesUpdateWorking (PrimDarcsOption UMask
umask PrimDarcsOption UMask -> [DarcsFlag] -> UMask
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) (RepoJob () -> IO ()) -> RepoJob () -> IO ()
forall a b. (a -> b) -> a -> b
$
    RebaseJobFlags
-> (forall (p :: * -> * -> *) wR wU.
    (RepoPatch p, ApplyState p ~ Tree) =>
    Repository ('RepoType 'IsRebase) p wR wU wR -> IO ())
-> RepoJob ()
forall a.
RebaseJobFlags
-> (forall (p :: * -> * -> *) wR wU.
    (RepoPatch p, ApplyState p ~ Tree) =>
    Repository ('RepoType 'IsRebase) p wR wU wR -> IO a)
-> RepoJob a
StartRebaseJob (Compression -> Verbosity -> UpdateWorking -> RebaseJobFlags
RebaseJobFlags (PrimDarcsOption Compression
compress PrimDarcsOption Compression -> [DarcsFlag] -> Compression
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) (PrimDarcsOption Verbosity
verbosity PrimDarcsOption Verbosity -> [DarcsFlag] -> Verbosity
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) UpdateWorking
YesUpdateWorking) ((forall (p :: * -> * -> *) wR wU.
  (RepoPatch p, ApplyState p ~ Tree) =>
  Repository ('RepoType 'IsRebase) p wR wU wR -> IO ())
 -> RepoJob ())
-> (forall (p :: * -> * -> *) wR wU.
    (RepoPatch p, ApplyState p ~ Tree) =>
    Repository ('RepoType 'IsRebase) p wR wU wR -> IO ())
-> RepoJob ()
forall a b. (a -> b) -> a -> b
$
    \repository :: Repository ('RepoType 'IsRebase) p wR wU wR
repository -> do
    PatchSet ('RepoType 'IsRebase) p Origin wR
allpatches <- Repository ('RepoType 'IsRebase) p wR wU wR
-> IO (PatchSet ('RepoType 'IsRebase) p Origin wR)
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
(IsRepoType rt, RepoPatch p) =>
Repository rt p wR wU wT -> IO (PatchSet rt p Origin wR)
readRepo Repository ('RepoType 'IsRebase) p wR wU wR
repository
    (rOld :: PatchInfoAnd ('RepoType 'IsRebase) p wR wR
rOld, suspended :: Suspended p wR wR
suspended, allpatches_tail :: PatchSet ('RepoType 'IsRebase) p Origin wR
allpatches_tail) <- (PatchInfoAnd ('RepoType 'IsRebase) p wR wR, Suspended p wR wR,
 PatchSet ('RepoType 'IsRebase) p Origin wR)
-> IO
     (PatchInfoAnd ('RepoType 'IsRebase) p wR wR, Suspended p wR wR,
      PatchSet ('RepoType 'IsRebase) p Origin wR)
forall (m :: * -> *) a. Monad m => a -> m a
return ((PatchInfoAnd ('RepoType 'IsRebase) p wR wR, Suspended p wR wR,
  PatchSet ('RepoType 'IsRebase) p Origin wR)
 -> IO
      (PatchInfoAnd ('RepoType 'IsRebase) p wR wR, Suspended p wR wR,
       PatchSet ('RepoType 'IsRebase) p Origin wR))
-> (PatchInfoAnd ('RepoType 'IsRebase) p wR wR, Suspended p wR wR,
    PatchSet ('RepoType 'IsRebase) p Origin wR)
-> IO
     (PatchInfoAnd ('RepoType 'IsRebase) p wR wR, Suspended p wR wR,
      PatchSet ('RepoType 'IsRebase) p Origin wR)
forall a b. (a -> b) -> a -> b
$ PatchSet ('RepoType 'IsRebase) p Origin wR
-> (PatchInfoAnd ('RepoType 'IsRebase) p wR wR, Suspended p wR wR,
    PatchSet ('RepoType 'IsRebase) p Origin wR)
forall (p :: * -> * -> *) wA wB.
PatchSet ('RepoType 'IsRebase) p wA wB
-> (PatchInfoAnd ('RepoType 'IsRebase) p wB wB, Suspended p wB wB,
    PatchSet ('RepoType 'IsRebase) p wA wB)
takeHeadRebase PatchSet ('RepoType 'IsRebase) p Origin wR
allpatches
    (_ :> patches :: FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wR
patches) <-
        (:>)
  (PatchSet ('RepoType 'IsRebase) p)
  (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
  Origin
  wR
-> IO
     ((:>)
        (PatchSet ('RepoType 'IsRebase) p)
        (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
        Origin
        wR)
forall (m :: * -> *) a. Monad m => a -> m a
return ((:>)
   (PatchSet ('RepoType 'IsRebase) p)
   (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
   Origin
   wR
 -> IO
      ((:>)
         (PatchSet ('RepoType 'IsRebase) p)
         (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
         Origin
         wR))
-> (:>)
     (PatchSet ('RepoType 'IsRebase) p)
     (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
     Origin
     wR
-> IO
     ((:>)
        (PatchSet ('RepoType 'IsRebase) p)
        (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
        Origin
        wR)
forall a b. (a -> b) -> a -> b
$ if [MatchFlag] -> Bool
firstMatch (MatchOption -> [DarcsFlag] -> [MatchFlag]
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
parseFlags MatchOption
O.matchSeveralOrLast [DarcsFlag]
opts)
                 then [MatchFlag]
-> PatchSet ('RepoType 'IsRebase) p Origin wR
-> (:>)
     (PatchSet ('RepoType 'IsRebase) p)
     (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
     Origin
     wR
forall (rt :: RepoType) (p :: * -> * -> *) wR.
(IsRepoType rt, RepoPatch p) =>
[MatchFlag]
-> PatchSet rt p Origin wR
-> (:>) (PatchSet rt p) (FL (PatchInfoAnd rt p)) Origin wR
getLastPatches (MatchOption -> [DarcsFlag] -> [MatchFlag]
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
parseFlags MatchOption
O.matchSeveralOrLast [DarcsFlag]
opts) PatchSet ('RepoType 'IsRebase) p Origin wR
allpatches_tail
                 else [MatchFlag]
-> PatchSet ('RepoType 'IsRebase) p Origin wR
-> (:>)
     (PatchSet ('RepoType 'IsRebase) p)
     (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
     Origin
     wR
forall (rt :: RepoType) (p :: * -> * -> *) wR.
(IsRepoType rt, RepoPatch p) =>
[MatchFlag]
-> PatchSet rt p Origin wR
-> (:>) (PatchSet rt p) (FL (PatchInfoAnd rt p)) Origin wR
matchingHead (MatchOption -> [DarcsFlag] -> [MatchFlag]
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
parseFlags MatchOption
O.matchSeveralOrLast [DarcsFlag]
opts) PatchSet ('RepoType 'IsRebase) p Origin wR
allpatches_tail
    let direction :: WhichChanges
direction = if PrimDarcsOption Bool
changesReverse PrimDarcsOption Bool -> [DarcsFlag] -> Bool
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts then WhichChanges
Last else WhichChanges
LastReversed
        patches_context :: PatchSelectionContext (PatchInfoAnd ('RepoType 'IsRebase) p)
patches_context = WhichChanges
-> String
-> PatchSelectionOptions
-> Maybe (Splitter (PatchInfoAnd ('RepoType 'IsRebase) p))
-> Maybe [String]
-> PatchSelectionContext (PatchInfoAnd ('RepoType 'IsRebase) p)
forall (rt :: RepoType) (p :: * -> * -> *).
(IsRepoType rt, RepoPatch p) =>
WhichChanges
-> String
-> PatchSelectionOptions
-> Maybe (Splitter (PatchInfoAnd rt p))
-> Maybe [String]
-> PatchSelectionContext (PatchInfoAnd rt p)
selectionContext WhichChanges
direction "suspend" (Bool -> [DarcsFlag] -> PatchSelectionOptions
patchSelOpts Bool
True [DarcsFlag]
opts) Maybe (Splitter (PatchInfoAnd ('RepoType 'IsRebase) p))
forall a. Maybe a
Nothing Maybe [String]
forall a. Maybe a
Nothing
    (_ :> psToSuspend :: FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wR
psToSuspend) <-
        FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wR
-> PatchSelectionContext (PatchInfoAnd ('RepoType 'IsRebase) p)
-> IO
     ((:>)
        (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
        (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
        wZ
        wR)
forall (p :: * -> * -> *) wX wY.
(Invert p, Commute p, Apply p, PatchInspect p, ShowPatch p,
 ShowContextPatch p, ApplyState p ~ Tree) =>
FL p wX wY
-> PatchSelectionContext p -> IO ((:>) (FL p) (FL p) wX wY)
runSelection
            FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wR
patches
            PatchSelectionContext (PatchInfoAnd ('RepoType 'IsRebase) p)
patches_context
    Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wR -> Bool
forall (a :: * -> * -> *) wX wZ. FL a wX wZ -> Bool
nullFL FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wR
psToSuspend) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ do
        String -> IO ()
putStrLn "No patches selected!"
        IO ()
forall a. IO a
exitSuccess
    -- test all patches for hijacking and abort if rejected
    HijackOptions -> HijackT IO () -> IO ()
forall (m :: * -> *) a.
Monad m =>
HijackOptions -> HijackT m a -> m a
runHijackT HijackOptions
RequestHijackPermission
        (HijackT IO () -> IO ()) -> HijackT IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ (PatchInfo -> StateT HijackOptions IO String)
-> [PatchInfo] -> HijackT IO ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ (String
-> Bool
-> Maybe String
-> PatchInfo
-> StateT HijackOptions IO String
getAuthor "suspend" Bool
False Maybe String
forall a. Maybe a
Nothing)
        ([PatchInfo] -> HijackT IO ()) -> [PatchInfo] -> HijackT IO ()
forall a b. (a -> b) -> a -> b
$ (forall wW wZ.
 PatchInfoAnd ('RepoType 'IsRebase) p wW wZ -> PatchInfo)
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wR -> [PatchInfo]
forall (a :: * -> * -> *) b wX wY.
(forall wW wZ. a wW wZ -> b) -> FL a wX wY -> [b]
mapFL forall wW wZ.
PatchInfoAnd ('RepoType 'IsRebase) p wW wZ -> PatchInfo
forall (rt :: RepoType) (p :: * -> * -> *) wA wB.
PatchInfoAnd rt p wA wB -> PatchInfo
info FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wR
psToSuspend
    Repository ('RepoType 'IsRebase) p wR wU wZ
repository' <- [DarcsFlag]
-> Repository ('RepoType 'IsRebase) p wR wU wR
-> Suspended p wR wR
-> PatchInfoAnd ('RepoType 'IsRebase) p wR wR
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wR
-> IO (Repository ('RepoType 'IsRebase) p wR wU wZ)
forall (p :: * -> * -> *) wR wU wT wX.
(RepoPatch p, ApplyState p ~ Tree) =>
[DarcsFlag]
-> Repository ('RepoType 'IsRebase) p wR wU wT
-> Suspended p wT wT
-> PatchInfoAnd ('RepoType 'IsRebase) p wT wT
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wT
-> IO (Repository ('RepoType 'IsRebase) p wR wU wX)
doSuspend [DarcsFlag]
opts Repository ('RepoType 'IsRebase) p wR wU wR
repository Suspended p wR wR
suspended PatchInfoAnd ('RepoType 'IsRebase) p wR wR
rOld FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wR
psToSuspend
    Repository ('RepoType 'IsRebase) p wR wU wZ
-> UpdateWorking -> Compression -> IO ()
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wT -> UpdateWorking -> Compression -> IO ()
finalizeRepositoryChanges Repository ('RepoType 'IsRebase) p wR wU wZ
repository' UpdateWorking
YesUpdateWorking (PrimDarcsOption Compression
compress PrimDarcsOption Compression -> [DarcsFlag] -> Compression
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts)
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

doSuspend
    :: forall p wR wU wT wX
     . (RepoPatch p, ApplyState p ~ Tree)
    => [DarcsFlag]
    -> Repository ('RepoType 'IsRebase) p wR wU wT
    -> Suspended p wT wT
    -> PatchInfoAnd ('RepoType 'IsRebase) p wT wT
    -> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wT
    -> IO (Repository ('RepoType 'IsRebase) p wR wU wX)
doSuspend :: [DarcsFlag]
-> Repository ('RepoType 'IsRebase) p wR wU wT
-> Suspended p wT wT
-> PatchInfoAnd ('RepoType 'IsRebase) p wT wT
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wT
-> IO (Repository ('RepoType 'IsRebase) p wR wU wX)
doSuspend opts :: [DarcsFlag]
opts repository :: Repository ('RepoType 'IsRebase) p wR wU wT
repository (Items qs :: FL (RebaseItem p) wT wY
qs) rOld :: PatchInfoAnd ('RepoType 'IsRebase) p wT wT
rOld psToSuspend :: FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wT
psToSuspend = do
    FL (PrimOf p) wT wU
pend <- (UseIndex, ScanKnown, DiffAlgorithm)
-> LookForMoves
-> LookForReplaces
-> Repository ('RepoType 'IsRebase) p wR wU wT
-> Maybe [SubPath]
-> IO (FL (PrimOf p) wT wU)
forall (p :: * -> * -> *) (rt :: RepoType) wR wU wT.
(RepoPatch p, ApplyState p ~ Tree) =>
(UseIndex, ScanKnown, DiffAlgorithm)
-> LookForMoves
-> LookForReplaces
-> Repository rt p wR wU wT
-> Maybe [SubPath]
-> IO (FL (PrimOf p) wT wU)
unrecordedChanges ([DarcsFlag] -> (UseIndex, ScanKnown, DiffAlgorithm)
diffingOpts [DarcsFlag]
opts)
      LookForMoves
O.NoLookForMoves LookForReplaces
O.NoLookForReplaces
      Repository ('RepoType 'IsRebase) p wR wU wT
repository Maybe [SubPath]
forall a. Maybe a
Nothing
    FlippedSeal psAfterPending :: FL (PrimOf p) wX wU
psAfterPending <-
        let effectPsToSuspend :: FL (PrimOf (FL (PatchInfoAnd ('RepoType 'IsRebase) p))) wX wT
effectPsToSuspend = FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wT
-> FL (PrimOf (FL (PatchInfoAnd ('RepoType 'IsRebase) p))) wX wT
forall (p :: * -> * -> *) wX wY.
Effect p =>
p wX wY -> FL (PrimOf p) wX wY
effect FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wT
psToSuspend in
        case (:>) (FL (PrimOf p)) (FL (PrimOf p)) wX wU
-> Maybe ((:>) (FL (PrimOf p)) (FL (PrimOf p)) wX wU)
forall (p :: * -> * -> *) wX wY.
Commute p =>
(:>) p p wX wY -> Maybe ((:>) p p wX wY)
commute (FL (PrimOf p) wX wT
effectPsToSuspend FL (PrimOf p) wX wT
-> FL (PrimOf p) wT wU
-> (:>) (FL (PrimOf p)) (FL (PrimOf p)) wX wU
forall (a1 :: * -> * -> *) (a2 :: * -> * -> *) wX wY wZ.
a1 wX wZ -> a2 wZ wY -> (:>) a1 a2 wX wY
:> FL (PrimOf p) wT wU
pend) of
            Just (_ :> res :: FL (PrimOf p) wZ wU
res) -> FlippedSeal (FL (PrimOf p)) wU
-> IO (FlippedSeal (FL (PrimOf p)) wU)
forall (m :: * -> *) a. Monad m => a -> m a
return (FL (PrimOf p) wZ wU -> FlippedSeal (FL (PrimOf p)) wU
forall (a :: * -> * -> *) wX wY. a wX wY -> FlippedSeal a wY
FlippedSeal FL (PrimOf p) wZ wU
res)
            Nothing -> do
                [DarcsFlag] -> Doc -> IO ()
putVerbose [DarcsFlag]
opts (Doc -> IO ()) -> Doc -> IO ()
forall a b. (a -> b) -> a -> b
$
                    let invPsEffect :: FL (PrimOf p) wT wX
invPsEffect = FL (PrimOf p) wX wT -> FL (PrimOf p) wT wX
forall (p :: * -> * -> *) wX wY. Invert p => p wX wY -> p wY wX
invert FL (PrimOf p) wX wT
effectPsToSuspend
                        doPartition :: FL (PrimOf p) wX wY
-> FL (PrimOf p) wX wZ
-> (:>) (FL (PrimOf p)) (FL (PrimOf p)) wX wY
doPartition = CommuteFn (PrimOf p) (FL (PrimOf p))
-> FL (PrimOf p) wX wY
-> FL (PrimOf p) wX wZ
-> (:>) (FL (PrimOf p)) (FL (PrimOf p)) wX wY
forall (p1 :: * -> * -> *) (p2 :: * -> * -> *) wX wY wZ.
(Commute p1, Invert p1) =>
CommuteFn p1 p2
-> FL p1 wX wY -> p2 wX wZ -> (:>) (FL p1) (FL p1) wX wY
partitionConflictingFL (CommuteFn (PrimOf p) (PrimOf p)
-> CommuteFn (PrimOf p) (FL (PrimOf p))
forall (p1 :: * -> * -> *) (p2 :: * -> * -> *).
CommuteFn p1 p2 -> CommuteFn p1 (FL p2)
commuterIdFL CommuteFn (PrimOf p) (PrimOf p)
forall (p :: * -> * -> *) wX wY.
Commute p =>
(:>) p p wX wY -> Maybe ((:>) p p wX wY)
selfCommuter)
                    in
                    case (FL (PrimOf p) wT wX
-> FL (PrimOf p) wT wU
-> (:>) (FL (PrimOf p)) (FL (PrimOf p)) wT wX
forall wX wY wZ.
FL (PrimOf p) wX wY
-> FL (PrimOf p) wX wZ
-> (:>) (FL (PrimOf p)) (FL (PrimOf p)) wX wY
doPartition FL (PrimOf p) wT wX
invPsEffect FL (PrimOf p) wT wU
pend, FL (PrimOf p) wT wU
-> FL (PrimOf p) wT wX
-> (:>) (FL (PrimOf p)) (FL (PrimOf p)) wT wU
forall wX wY wZ.
FL (PrimOf p) wX wY
-> FL (PrimOf p) wX wZ
-> (:>) (FL (PrimOf p)) (FL (PrimOf p)) wX wY
doPartition FL (PrimOf p) wT wU
pend FL (PrimOf p) wT wX
invPsEffect) of
                        (_ :> invSuspendedConflicts :: FL (PrimOf p) wZ wX
invSuspendedConflicts, _ :> pendConflicts :: FL (PrimOf p) wZ wU
pendConflicts) ->
                            let suspendedConflicts :: FL (PrimOf p) wX wZ
suspendedConflicts = FL (PrimOf p) wZ wX -> FL (PrimOf p) wX wZ
forall (p :: * -> * -> *) wX wY. Invert p => p wX wY -> p wY wX
invert FL (PrimOf p) wZ wX
invSuspendedConflicts in
                            String -> Doc
redText "These changes in the suspended patches:" Doc -> Doc -> Doc
$$
                            FL (PrimOf p) wX wZ -> Doc
forall (p :: * -> * -> *) wX wY. ShowPatch p => p wX wY -> Doc
showNicely FL (PrimOf p) wX wZ
suspendedConflicts Doc -> Doc -> Doc
$$
                            String -> Doc
redText "...conflict with these local changes:" Doc -> Doc -> Doc
$$
                            FL (PrimOf p) wZ wU -> Doc
forall (p :: * -> * -> *) wX wY. ShowPatch p => p wX wY -> Doc
showNicely FL (PrimOf p) wZ wU
pendConflicts
                String -> IO (FlippedSeal (FL (PrimOf p)) wU)
forall (m :: * -> *) a. MonadFail m => String -> m a
fail (String -> IO (FlippedSeal (FL (PrimOf p)) wU))
-> String -> IO (FlippedSeal (FL (PrimOf p)) wU)
forall a b. (a -> b) -> a -> b
$ "Can't suspend selected patches without reverting some unrecorded change."
                    String -> String -> String
forall a. [a] -> [a] -> [a]
++ if ([DarcsFlag] -> Bool
verbose [DarcsFlag]
opts) then "" else " Use --verbose to see the details."


    WrappedNamed ('RepoType 'IsRebase) p wX wX
rNew <- Suspended p wX wX
-> IO (WrappedNamed ('RepoType 'IsRebase) p wX wX)
forall (p :: * -> * -> *) wX.
(PrimPatchBase p, FromPrim p, Effect p) =>
Suspended p wX wX
-> IO (WrappedNamed ('RepoType 'IsRebase) p wX wX)
mkRebase (FL (RebaseItem p) wX wY -> Suspended p wX wX
forall (p :: * -> * -> *) wX wY.
FL (RebaseItem p) wX wY -> Suspended p wX wX
Items ((forall wW wY.
 PatchInfoAnd ('RepoType 'IsRebase) p wW wY -> RebaseItem p wW wY)
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wT
-> FL (RebaseItem p) wX wT
forall (a :: * -> * -> *) (b :: * -> * -> *) wX wZ.
(forall wW wY. a wW wY -> b wW wY) -> FL a wX wZ -> FL b wX wZ
mapFL_FL (Named p wW wY -> RebaseItem p wW wY
forall (p :: * -> * -> *) wX wY.
Named p wX wY -> RebaseItem p wX wY
ToEdit (Named p wW wY -> RebaseItem p wW wY)
-> (PatchInfoAnd ('RepoType 'IsRebase) p wW wY -> Named p wW wY)
-> PatchInfoAnd ('RepoType 'IsRebase) p wW wY
-> RebaseItem p wW wY
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WrappedNamed ('RepoType 'IsRebase) p wW wY -> Named p wW wY
forall (p :: * -> * -> *) wX wY.
WrappedNamed ('RepoType 'IsRebase) p wX wY -> Named p wX wY
fromRebasing (WrappedNamed ('RepoType 'IsRebase) p wW wY -> Named p wW wY)
-> (PatchInfoAnd ('RepoType 'IsRebase) p wW wY
    -> WrappedNamed ('RepoType 'IsRebase) p wW wY)
-> PatchInfoAnd ('RepoType 'IsRebase) p wW wY
-> Named p wW wY
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PatchInfoAnd ('RepoType 'IsRebase) p wW wY
-> WrappedNamed ('RepoType 'IsRebase) p wW wY
forall (rt :: RepoType) (p :: * -> * -> *) wA wB.
PatchInfoAnd rt p wA wB -> WrappedNamed rt p wA wB
hopefully) FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wT
psToSuspend FL (RebaseItem p) wX wT
-> FL (RebaseItem p) wT wY -> FL (RebaseItem p) wX wY
forall (a :: * -> * -> *) wX wY wZ.
FL a wX wY -> FL a wY wZ -> FL a wX wZ
+>+ FL (RebaseItem p) wT wY
qs))
    Repository ('RepoType 'IsRebase) p wR wU wT -> IO ()
forall t. t -> IO ()
invalidateIndex Repository ('RepoType 'IsRebase) p wR wU wT
repository
    -- remove the old rebase patch and the patches to suspend
    Repository ('RepoType 'IsRebase) p wR wU wX
repository' <- Repository ('RepoType 'IsRebase) p wR wU wT
-> Compression
-> UpdateWorking
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wT
-> IO (Repository ('RepoType 'IsRebase) p wR wU wX)
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT wX.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wT
-> Compression
-> UpdateWorking
-> FL (PatchInfoAnd rt p) wX wT
-> IO (Repository rt p wR wU wX)
tentativelyRemovePatches Repository ('RepoType 'IsRebase) p wR wU wT
repository (PrimDarcsOption Compression
compress PrimDarcsOption Compression -> [DarcsFlag] -> Compression
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) UpdateWorking
YesUpdateWorking (FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wT
psToSuspend FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wT
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wT wT
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wT
forall (a :: * -> * -> *) wX wY wZ.
FL a wX wY -> FL a wY wZ -> FL a wX wZ
+>+ (PatchInfoAnd ('RepoType 'IsRebase) p wT wT
rOld PatchInfoAnd ('RepoType 'IsRebase) p wT wT
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wT wT
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wT wT
forall (a :: * -> * -> *) wX wY wZ.
a wX wY -> FL a wY wZ -> FL a wX wZ
:>: FL (PatchInfoAnd ('RepoType 'IsRebase) p) wT wT
forall (a :: * -> * -> *) wX. FL a wX wX
NilFL))
    Repository ('RepoType 'IsRebase) p wR wU wX
-> UpdateWorking -> FL (PrimOf p) wT wX -> IO ()
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT wX wY.
RepoPatch p =>
Repository rt p wR wU wT
-> UpdateWorking -> FL (PrimOf p) wX wY -> IO ()
tentativelyAddToPending Repository ('RepoType 'IsRebase) p wR wU wX
repository' UpdateWorking
YesUpdateWorking (FL (PrimOf p) wT wX -> IO ()) -> FL (PrimOf p) wT wX -> IO ()
forall a b. (a -> b) -> a -> b
$ FL (PrimOf p) wX wT -> FL (PrimOf p) wT wX
forall (p :: * -> * -> *) wX wY. Invert p => p wX wY -> p wY wX
invert (FL (PrimOf p) wX wT -> FL (PrimOf p) wT wX)
-> FL (PrimOf p) wX wT -> FL (PrimOf p) wT wX
forall a b. (a -> b) -> a -> b
$ FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wT
-> FL (PrimOf (FL (PatchInfoAnd ('RepoType 'IsRebase) p))) wX wT
forall (p :: * -> * -> *) wX wY.
Effect p =>
p wX wY -> FL (PrimOf p) wX wY
effect FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wT
psToSuspend
    -- add the new rebase patch
    Repository ('RepoType 'IsRebase) p wR wU wX
repository'' <- Repository ('RepoType 'IsRebase) p wR wU wX
-> Compression
-> Verbosity
-> UpdateWorking
-> PatchInfoAnd ('RepoType 'IsRebase) p wX wX
-> IO (Repository ('RepoType 'IsRebase) p wR wU wX)
forall (p :: * -> * -> *) (rt :: RepoType) wR wU wT wY.
(RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wT
-> Compression
-> Verbosity
-> UpdateWorking
-> PatchInfoAnd rt p wT wY
-> IO (Repository rt p wR wU wY)
tentativelyAddPatch Repository ('RepoType 'IsRebase) p wR wU wX
repository' (PrimDarcsOption Compression
compress PrimDarcsOption Compression -> [DarcsFlag] -> Compression
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) (Verbosity -> Verbosity
unVerbose (PrimDarcsOption Verbosity
verbosity PrimDarcsOption Verbosity -> [DarcsFlag] -> Verbosity
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts)) UpdateWorking
YesUpdateWorking (WrappedNamed ('RepoType 'IsRebase) p wX wX
-> PatchInfoAnd ('RepoType 'IsRebase) p wX wX
forall (rt :: RepoType) (p :: * -> * -> *) wX wY.
WrappedNamed rt p wX wY -> PatchInfoAnd rt p wX wY
n2pia WrappedNamed ('RepoType 'IsRebase) p wX wX
rNew)
    Repository ('RepoType 'IsRebase) p wR wX wX
_ <- Repository ('RepoType 'IsRebase) p wR wU wX
-> Verbosity
-> FL (PrimOf p) wU wX
-> IO (Repository ('RepoType 'IsRebase) p wR wX wX)
forall (p :: * -> * -> *) (rt :: RepoType) wR wU wT wY.
(ApplyState p ~ Tree, RepoPatch p) =>
Repository rt p wR wU wT
-> Verbosity
-> FL (PrimOf p) wU wY
-> IO (Repository rt p wR wY wT)
applyToWorking Repository ('RepoType 'IsRebase) p wR wU wX
repository'' (PrimDarcsOption Verbosity
verbosity PrimDarcsOption Verbosity -> [DarcsFlag] -> Verbosity
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) (FL (PrimOf p) wX wU -> FL (PrimOf p) wU wX
forall (p :: * -> * -> *) wX wY. Invert p => p wX wY -> p wY wX
invert FL (PrimOf p) wX wU
psAfterPending)
            IO (Repository ('RepoType 'IsRebase) p wR wX wX)
-> (IOException
    -> IO (Repository ('RepoType 'IsRebase) p wR wX wX))
-> IO (Repository ('RepoType 'IsRebase) p wR wX wX)
forall e a. Exception e => IO a -> (e -> IO a) -> IO a
`catch` \(IOException
e :: IOException) -> String -> IO (Repository ('RepoType 'IsRebase) p wR wX wX)
forall (m :: * -> *) a. MonadFail m => String -> m a
fail ("Couldn't undo patch in working dir.\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++ IOException -> String
forall a. Show a => a -> String
show IOException
e)
    Repository ('RepoType 'IsRebase) p wR wU wX
-> IO (Repository ('RepoType 'IsRebase) p wR wU wX)
forall (m :: * -> *) a. Monad m => a -> m a
return Repository ('RepoType 'IsRebase) p wR wU wX
repository''

-- Certain repository functions will display the rebase patch in verbose mode
-- so we use this function to suppress it when passing the verbosity.
unVerbose :: O.Verbosity -> O.Verbosity
unVerbose :: Verbosity -> Verbosity
unVerbose O.Verbose = Verbosity
O.NormalVerbosity
unVerbose x :: Verbosity
x = Verbosity
x

unsuspend :: DarcsCommand [DarcsFlag]
unsuspend :: DarcsCommand [DarcsFlag]
unsuspend = DarcsCommand :: forall parsedFlags.
String
-> String
-> String
-> String
-> Int
-> [String]
-> ((AbsolutePath, AbsolutePath)
    -> parsedFlags -> [String] -> IO ())
-> ([DarcsFlag] -> IO (Either String ()))
-> ((AbsolutePath, AbsolutePath)
    -> [DarcsFlag] -> [String] -> IO [String])
-> ([DarcsFlag] -> AbsolutePath -> [String] -> IO [String])
-> [DarcsOptDescr DarcsFlag]
-> [DarcsOptDescr DarcsFlag]
-> [DarcsFlag]
-> ([DarcsFlag] -> [String])
-> ([DarcsFlag] -> parsedFlags)
-> DarcsCommand parsedFlags
DarcsCommand
    { commandProgramName :: String
commandProgramName = "darcs"
    , commandName :: String
commandName = "unsuspend"
    , commandHelp :: String
commandHelp = "Selected patches to restore from a suspended state to the end of the repo.\n"
    , commandDescription :: String
commandDescription = "Select suspended patches to restore to the end of the repo."
    , commandPrereq :: [DarcsFlag] -> IO (Either String ())
commandPrereq = [DarcsFlag] -> IO (Either String ())
amInHashedRepository
    , commandExtraArgs :: Int
commandExtraArgs = 0
    , commandExtraArgHelp :: [String]
commandExtraArgHelp = []
    , commandCommand :: (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
commandCommand = Bool
-> (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
unsuspendCmd Bool
False
    , commandCompleteArgs :: (AbsolutePath, AbsolutePath)
-> [DarcsFlag] -> [String] -> IO [String]
commandCompleteArgs = (AbsolutePath, AbsolutePath)
-> [DarcsFlag] -> [String] -> IO [String]
noArgs
    , commandArgdefaults :: [DarcsFlag] -> AbsolutePath -> [String] -> IO [String]
commandArgdefaults = [DarcsFlag] -> AbsolutePath -> [String] -> IO [String]
nodefaults
    , commandAdvancedOptions :: [DarcsOptDescr DarcsFlag]
commandAdvancedOptions = OptSpec DarcsOptDescr DarcsFlag Any (UseIndex -> Any)
-> [DarcsOptDescr DarcsFlag]
forall (d :: * -> *) f a b. OptSpec d f a b -> [d f]
odesc OptSpec DarcsOptDescr DarcsFlag Any (UseIndex -> Any)
PrimDarcsOption UseIndex
unsuspendAdvancedOpts
    , commandBasicOptions :: [DarcsOptDescr DarcsFlag]
commandBasicOptions = OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> Summary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Any)
-> [DarcsOptDescr DarcsFlag]
forall (d :: * -> *) f a b. OptSpec d f a b -> [d f]
odesc OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> Summary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Any)
forall a.
OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> Summary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> a)
unsuspendBasicOpts
    , commandDefaults :: [DarcsFlag]
commandDefaults = OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> Summary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> [DarcsFlag])
-> [DarcsFlag]
forall (d :: * -> *) f b. OptSpec d f [f] b -> [f]
defaultFlags OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> Summary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> [DarcsFlag])
forall a.
DarcsOption
  a
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> Summary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> a)
unsuspendOpts
    , commandCheckOptions :: [DarcsFlag] -> [String]
commandCheckOptions = OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> Summary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> Any)
-> [DarcsFlag] -> [String]
forall (d :: * -> *) f a b. OptSpec d f a b -> [f] -> [String]
ocheck OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> Summary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> Any)
forall a.
DarcsOption
  a
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> Summary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> a)
unsuspendOpts
    , commandParseOptions :: [DarcsFlag] -> [DarcsFlag]
commandParseOptions = OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> Summary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> [DarcsFlag])
-> [DarcsFlag] -> [DarcsFlag]
forall (d :: * -> *) f b. OptSpec d f [f] b -> [f] -> [f]
onormalise OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> Summary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> [DarcsFlag])
forall a.
DarcsOption
  a
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> Summary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> a)
unsuspendOpts
    }
  where
    unsuspendBasicOpts :: OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> Summary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> a)
unsuspendBasicOpts
      = PrimOptSpec
  DarcsOptDescr
  DarcsFlag
  ([MatchFlag]
   -> Maybe Bool
   -> Summary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> a)
  (Maybe AllowConflicts)
PrimDarcsOption (Maybe AllowConflicts)
O.conflictsYes
      PrimOptSpec
  DarcsOptDescr
  DarcsFlag
  ([MatchFlag]
   -> Maybe Bool
   -> Summary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> a)
  (Maybe AllowConflicts)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Maybe Bool
      -> Summary
      -> ExternalMerge
      -> Bool
      -> Maybe String
      -> DiffAlgorithm
      -> a)
     ([MatchFlag]
      -> Maybe Bool
      -> Summary
      -> ExternalMerge
      -> Bool
      -> Maybe String
      -> DiffAlgorithm
      -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Maybe Bool
      -> Summary
      -> ExternalMerge
      -> Bool
      -> Maybe String
      -> DiffAlgorithm
      -> a)
     (Maybe AllowConflicts
      -> [MatchFlag]
      -> Maybe Bool
      -> Summary
      -> ExternalMerge
      -> Bool
      -> Maybe String
      -> DiffAlgorithm
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe Bool
   -> Summary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> a)
  ([MatchFlag]
   -> Maybe Bool
   -> Summary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> a)
MatchOption
O.matchSeveralOrFirst
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe Bool
   -> Summary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> a)
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> Summary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Summary
      -> ExternalMerge -> Bool -> Maybe String -> DiffAlgorithm -> a)
     (Maybe Bool
      -> Summary
      -> ExternalMerge
      -> Bool
      -> Maybe String
      -> DiffAlgorithm
      -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Summary
      -> ExternalMerge -> Bool -> Maybe String -> DiffAlgorithm -> a)
     (Maybe AllowConflicts
      -> [MatchFlag]
      -> Maybe Bool
      -> Summary
      -> ExternalMerge
      -> Bool
      -> Maybe String
      -> DiffAlgorithm
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (Summary
   -> ExternalMerge -> Bool -> Maybe String -> DiffAlgorithm -> a)
  (Maybe Bool
   -> Summary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> a)
PrimDarcsOption (Maybe Bool)
O.interactive
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (Summary
   -> ExternalMerge -> Bool -> Maybe String -> DiffAlgorithm -> a)
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> Summary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (ExternalMerge -> Bool -> Maybe String -> DiffAlgorithm -> a)
     (Summary
      -> ExternalMerge -> Bool -> Maybe String -> DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (ExternalMerge -> Bool -> Maybe String -> DiffAlgorithm -> a)
     (Maybe AllowConflicts
      -> [MatchFlag]
      -> Maybe Bool
      -> Summary
      -> ExternalMerge
      -> Bool
      -> Maybe String
      -> DiffAlgorithm
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (ExternalMerge -> Bool -> Maybe String -> DiffAlgorithm -> a)
  (Summary
   -> ExternalMerge -> Bool -> Maybe String -> DiffAlgorithm -> a)
PrimDarcsOption Summary
O.summary
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (ExternalMerge -> Bool -> Maybe String -> DiffAlgorithm -> a)
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> Summary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Bool -> Maybe String -> DiffAlgorithm -> a)
     (ExternalMerge -> Bool -> Maybe String -> DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Bool -> Maybe String -> DiffAlgorithm -> a)
     (Maybe AllowConflicts
      -> [MatchFlag]
      -> Maybe Bool
      -> Summary
      -> ExternalMerge
      -> Bool
      -> Maybe String
      -> DiffAlgorithm
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (Bool -> Maybe String -> DiffAlgorithm -> a)
  (ExternalMerge -> Bool -> Maybe String -> DiffAlgorithm -> a)
PrimDarcsOption ExternalMerge
O.externalMerge
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (Bool -> Maybe String -> DiffAlgorithm -> a)
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> Summary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Maybe String -> DiffAlgorithm -> a)
     (Bool -> Maybe String -> DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Maybe String -> DiffAlgorithm -> a)
     (Maybe AllowConflicts
      -> [MatchFlag]
      -> Maybe Bool
      -> Summary
      -> ExternalMerge
      -> Bool
      -> Maybe String
      -> DiffAlgorithm
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe String -> DiffAlgorithm -> a)
  (Bool -> Maybe String -> DiffAlgorithm -> a)
PrimDarcsOption Bool
O.keepDate
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe String -> DiffAlgorithm -> a)
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> Summary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (DiffAlgorithm -> a)
     (Maybe String -> DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (DiffAlgorithm -> a)
     (Maybe AllowConflicts
      -> [MatchFlag]
      -> Maybe Bool
      -> Summary
      -> ExternalMerge
      -> Bool
      -> Maybe String
      -> DiffAlgorithm
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (DiffAlgorithm -> a)
  (Maybe String -> DiffAlgorithm -> a)
PrimDarcsOption (Maybe String)
O.author
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (DiffAlgorithm -> a)
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> Summary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> a)
-> OptSpec DarcsOptDescr DarcsFlag a (DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     a
     (Maybe AllowConflicts
      -> [MatchFlag]
      -> Maybe Bool
      -> Summary
      -> ExternalMerge
      -> Bool
      -> Maybe String
      -> DiffAlgorithm
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec DarcsOptDescr DarcsFlag a (DiffAlgorithm -> a)
PrimDarcsOption DiffAlgorithm
O.diffAlgorithm
    unsuspendAdvancedOpts :: PrimOptSpec DarcsOptDescr DarcsFlag a UseIndex
unsuspendAdvancedOpts = PrimOptSpec DarcsOptDescr DarcsFlag a UseIndex
PrimDarcsOption UseIndex
O.useIndex
    unsuspendOpts :: DarcsOption
  a
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> Summary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> a)
unsuspendOpts = OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> a)
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> Summary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> a)
forall a.
OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> Summary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> a)
unsuspendBasicOpts OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> a)
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> Summary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> a)
-> DarcsOption
     (UseCache -> HooksConfig -> a)
     (UseIndex -> UseCache -> HooksConfig -> a)
-> DarcsOption
     a
     (Maybe AllowConflicts
      -> [MatchFlag]
      -> Maybe Bool
      -> Summary
      -> ExternalMerge
      -> Bool
      -> Maybe String
      -> DiffAlgorithm
      -> Maybe StdCmdAction
      -> Bool
      -> Bool
      -> Verbosity
      -> Bool
      -> UseIndex
      -> UseCache
      -> HooksConfig
      -> a)
forall b c a.
DarcsOption
  (Maybe StdCmdAction -> Bool -> Bool -> Verbosity -> Bool -> b) c
-> DarcsOption (UseCache -> HooksConfig -> a) b -> DarcsOption a c
`withStdOpts` DarcsOption
  (UseCache -> HooksConfig -> a)
  (UseIndex -> UseCache -> HooksConfig -> a)
PrimDarcsOption UseIndex
unsuspendAdvancedOpts

reify :: DarcsCommand [DarcsFlag]
reify :: DarcsCommand [DarcsFlag]
reify = DarcsCommand :: forall parsedFlags.
String
-> String
-> String
-> String
-> Int
-> [String]
-> ((AbsolutePath, AbsolutePath)
    -> parsedFlags -> [String] -> IO ())
-> ([DarcsFlag] -> IO (Either String ()))
-> ((AbsolutePath, AbsolutePath)
    -> [DarcsFlag] -> [String] -> IO [String])
-> ([DarcsFlag] -> AbsolutePath -> [String] -> IO [String])
-> [DarcsOptDescr DarcsFlag]
-> [DarcsOptDescr DarcsFlag]
-> [DarcsFlag]
-> ([DarcsFlag] -> [String])
-> ([DarcsFlag] -> parsedFlags)
-> DarcsCommand parsedFlags
DarcsCommand
    { commandProgramName :: String
commandProgramName = "darcs"
    , commandName :: String
commandName = "reify"
    , commandHelp :: String
commandHelp = "Select suspended patches to restore to the end of the repo, reifying any fixup patches.\n"
    , commandDescription :: String
commandDescription = "Select suspended patches to restore to the end of the repo, reifying any fixup patches."
    , commandPrereq :: [DarcsFlag] -> IO (Either String ())
commandPrereq = [DarcsFlag] -> IO (Either String ())
amInHashedRepository
    , commandExtraArgs :: Int
commandExtraArgs = 0
    , commandExtraArgHelp :: [String]
commandExtraArgHelp = []
    , commandCommand :: (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
commandCommand = Bool
-> (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
unsuspendCmd Bool
True
    , commandCompleteArgs :: (AbsolutePath, AbsolutePath)
-> [DarcsFlag] -> [String] -> IO [String]
commandCompleteArgs = (AbsolutePath, AbsolutePath)
-> [DarcsFlag] -> [String] -> IO [String]
noArgs
    , commandArgdefaults :: [DarcsFlag] -> AbsolutePath -> [String] -> IO [String]
commandArgdefaults = [DarcsFlag] -> AbsolutePath -> [String] -> IO [String]
nodefaults
    , commandAdvancedOptions :: [DarcsOptDescr DarcsFlag]
commandAdvancedOptions = []
    , commandBasicOptions :: [DarcsOptDescr DarcsFlag]
commandBasicOptions = OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  ([MatchFlag]
   -> Maybe Bool -> Bool -> Maybe String -> DiffAlgorithm -> Any)
-> [DarcsOptDescr DarcsFlag]
forall (d :: * -> *) f a b. OptSpec d f a b -> [d f]
odesc OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  ([MatchFlag]
   -> Maybe Bool -> Bool -> Maybe String -> DiffAlgorithm -> Any)
forall a.
OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  ([MatchFlag]
   -> Maybe Bool -> Bool -> Maybe String -> DiffAlgorithm -> a)
reifyBasicOpts
    , commandDefaults :: [DarcsFlag]
commandDefaults = OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  ([MatchFlag]
   -> Maybe Bool
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> [DarcsFlag])
-> [DarcsFlag]
forall (d :: * -> *) f b. OptSpec d f [f] b -> [f]
defaultFlags OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  ([MatchFlag]
   -> Maybe Bool
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> [DarcsFlag])
forall a.
DarcsOption
  a
  ([MatchFlag]
   -> Maybe Bool
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> a)
reifyOpts
    , commandCheckOptions :: [DarcsFlag] -> [String]
commandCheckOptions = OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  ([MatchFlag]
   -> Maybe Bool
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> Any)
-> [DarcsFlag] -> [String]
forall (d :: * -> *) f a b. OptSpec d f a b -> [f] -> [String]
ocheck OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  ([MatchFlag]
   -> Maybe Bool
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> Any)
forall a.
DarcsOption
  a
  ([MatchFlag]
   -> Maybe Bool
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> a)
reifyOpts
    , commandParseOptions :: [DarcsFlag] -> [DarcsFlag]
commandParseOptions = OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  ([MatchFlag]
   -> Maybe Bool
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> [DarcsFlag])
-> [DarcsFlag] -> [DarcsFlag]
forall (d :: * -> *) f b. OptSpec d f [f] b -> [f] -> [f]
onormalise OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  ([MatchFlag]
   -> Maybe Bool
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> [DarcsFlag])
forall a.
DarcsOption
  a
  ([MatchFlag]
   -> Maybe Bool
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> a)
reifyOpts
    }
  where
    reifyBasicOpts :: OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  ([MatchFlag]
   -> Maybe Bool -> Bool -> Maybe String -> DiffAlgorithm -> a)
reifyBasicOpts
      = PrimOptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe Bool -> Bool -> Maybe String -> DiffAlgorithm -> a)
  [MatchFlag]
MatchOption
O.matchSeveralOrFirst
      PrimOptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe Bool -> Bool -> Maybe String -> DiffAlgorithm -> a)
  [MatchFlag]
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Bool -> Maybe String -> DiffAlgorithm -> a)
     (Maybe Bool -> Bool -> Maybe String -> DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Bool -> Maybe String -> DiffAlgorithm -> a)
     ([MatchFlag]
      -> Maybe Bool -> Bool -> Maybe String -> DiffAlgorithm -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (Bool -> Maybe String -> DiffAlgorithm -> a)
  (Maybe Bool -> Bool -> Maybe String -> DiffAlgorithm -> a)
PrimDarcsOption (Maybe Bool)
O.interactive
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (Bool -> Maybe String -> DiffAlgorithm -> a)
  ([MatchFlag]
   -> Maybe Bool -> Bool -> Maybe String -> DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Maybe String -> DiffAlgorithm -> a)
     (Bool -> Maybe String -> DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Maybe String -> DiffAlgorithm -> a)
     ([MatchFlag]
      -> Maybe Bool -> Bool -> Maybe String -> DiffAlgorithm -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe String -> DiffAlgorithm -> a)
  (Bool -> Maybe String -> DiffAlgorithm -> a)
PrimDarcsOption Bool
O.keepDate
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe String -> DiffAlgorithm -> a)
  ([MatchFlag]
   -> Maybe Bool -> Bool -> Maybe String -> DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (DiffAlgorithm -> a)
     (Maybe String -> DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (DiffAlgorithm -> a)
     ([MatchFlag]
      -> Maybe Bool -> Bool -> Maybe String -> DiffAlgorithm -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (DiffAlgorithm -> a)
  (Maybe String -> DiffAlgorithm -> a)
PrimDarcsOption (Maybe String)
O.author
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (DiffAlgorithm -> a)
  ([MatchFlag]
   -> Maybe Bool -> Bool -> Maybe String -> DiffAlgorithm -> a)
-> OptSpec DarcsOptDescr DarcsFlag a (DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     a
     ([MatchFlag]
      -> Maybe Bool -> Bool -> Maybe String -> DiffAlgorithm -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec DarcsOptDescr DarcsFlag a (DiffAlgorithm -> a)
PrimDarcsOption DiffAlgorithm
O.diffAlgorithm
    reifyOpts :: DarcsOption
  a
  ([MatchFlag]
   -> Maybe Bool
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> a)
reifyOpts = OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> a)
  ([MatchFlag]
   -> Maybe Bool
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> a)
forall a.
OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  ([MatchFlag]
   -> Maybe Bool -> Bool -> Maybe String -> DiffAlgorithm -> a)
reifyBasicOpts OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> a)
  ([MatchFlag]
   -> Maybe Bool
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> a)
-> DarcsOption
     (UseCache -> HooksConfig -> a) (UseCache -> HooksConfig -> a)
-> DarcsOption
     a
     ([MatchFlag]
      -> Maybe Bool
      -> Bool
      -> Maybe String
      -> DiffAlgorithm
      -> Maybe StdCmdAction
      -> Bool
      -> Bool
      -> Verbosity
      -> Bool
      -> UseCache
      -> HooksConfig
      -> a)
forall b c a.
DarcsOption
  (Maybe StdCmdAction -> Bool -> Bool -> Verbosity -> Bool -> b) c
-> DarcsOption (UseCache -> HooksConfig -> a) b -> DarcsOption a c
`withStdOpts` DarcsOption
  (UseCache -> HooksConfig -> a) (UseCache -> HooksConfig -> a)
forall (d :: * -> *) f a. OptSpec d f a a
oid

unsuspendCmd :: Bool -> (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
unsuspendCmd :: Bool
-> (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
unsuspendCmd reifyFixups :: Bool
reifyFixups _ opts :: [DarcsFlag]
opts _args :: [String]
_args =
    DryRun -> UseCache -> UpdateWorking -> UMask -> RepoJob () -> IO ()
forall a.
DryRun -> UseCache -> UpdateWorking -> UMask -> RepoJob a -> IO a
withRepoLock (PrimDarcsOption DryRun
dryRun PrimDarcsOption DryRun -> [DarcsFlag] -> DryRun
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) (PrimDarcsOption UseCache
useCache PrimDarcsOption UseCache -> [DarcsFlag] -> UseCache
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) UpdateWorking
YesUpdateWorking (PrimDarcsOption UMask
umask PrimDarcsOption UMask -> [DarcsFlag] -> UMask
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) (RepoJob () -> IO ()) -> RepoJob () -> IO ()
forall a b. (a -> b) -> a -> b
$
    RebaseJobFlags
-> (forall (p :: * -> * -> *) wR wU.
    (RepoPatch p, ApplyState p ~ Tree) =>
    Repository ('RepoType 'IsRebase) p wR wU wR -> IO ())
-> RepoJob ()
forall a.
RebaseJobFlags
-> (forall (p :: * -> * -> *) wR wU.
    (RepoPatch p, ApplyState p ~ Tree) =>
    Repository ('RepoType 'IsRebase) p wR wU wR -> IO a)
-> RepoJob a
RebaseJob (Compression -> Verbosity -> UpdateWorking -> RebaseJobFlags
RebaseJobFlags (PrimDarcsOption Compression
compress PrimDarcsOption Compression -> [DarcsFlag] -> Compression
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) (PrimDarcsOption Verbosity
verbosity PrimDarcsOption Verbosity -> [DarcsFlag] -> Verbosity
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) UpdateWorking
YesUpdateWorking) ((forall (p :: * -> * -> *) wR wU.
  (RepoPatch p, ApplyState p ~ Tree) =>
  Repository ('RepoType 'IsRebase) p wR wU wR -> IO ())
 -> RepoJob ())
-> (forall (p :: * -> * -> *) wR wU.
    (RepoPatch p, ApplyState p ~ Tree) =>
    Repository ('RepoType 'IsRebase) p wR wU wR -> IO ())
-> RepoJob ()
forall a b. (a -> b) -> a -> b
$
    \(Repository ('RepoType 'IsRebase) p wR wU wR
repository :: Repository ('RepoType 'IsRebase) p wR wU wR) -> (do
    PatchSet ('RepoType 'IsRebase) p Origin wR
patches <- Repository ('RepoType 'IsRebase) p wR wU wR
-> IO (PatchSet ('RepoType 'IsRebase) p Origin wR)
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
(IsRepoType rt, RepoPatch p) =>
Repository rt p wR wU wT -> IO (PatchSet rt p Origin wR)
readRepo Repository ('RepoType 'IsRebase) p wR wU wR
repository
    FL (PrimOf p) wR wU
pend <- (UseIndex, ScanKnown, DiffAlgorithm)
-> LookForMoves
-> LookForReplaces
-> Repository ('RepoType 'IsRebase) p wR wU wR
-> Maybe [SubPath]
-> IO (FL (PrimOf p) wR wU)
forall (p :: * -> * -> *) (rt :: RepoType) wR wU wT.
(RepoPatch p, ApplyState p ~ Tree) =>
(UseIndex, ScanKnown, DiffAlgorithm)
-> LookForMoves
-> LookForReplaces
-> Repository rt p wR wU wT
-> Maybe [SubPath]
-> IO (FL (PrimOf p) wT wU)
unrecordedChanges ([DarcsFlag] -> (UseIndex, ScanKnown, DiffAlgorithm)
diffingOpts [DarcsFlag]
opts)
      LookForMoves
O.NoLookForMoves LookForReplaces
O.NoLookForReplaces
      Repository ('RepoType 'IsRebase) p wR wU wR
repository Maybe [SubPath]
forall a. Maybe a
Nothing
    let checkChanges :: FL (PrimOf p) wA wB -> IO (EqCheck wA wB)
        checkChanges :: FL (PrimOf p) wA wB -> IO (EqCheck wA wB)
checkChanges NilFL = EqCheck wA wA -> IO (EqCheck wA wA)
forall (m :: * -> *) a. Monad m => a -> m a
return EqCheck wA wA
forall wA. EqCheck wA wA
IsEq
        checkChanges _ = String -> IO (EqCheck wA wB)
forall a. HasCallStack => String -> a
error "can't unsuspend when there are unrecorded changes"
    EqCheck wR wU
IsEq <- FL (PrimOf p) wR wU -> IO (EqCheck wR wU)
forall wA wB. FL (PrimOf p) wA wB -> IO (EqCheck wA wB)
checkChanges FL (PrimOf p) wR wU
pend :: IO (EqCheck wR wU)
    (rOld :: PatchInfoAnd ('RepoType 'IsRebase) p wR wR
rOld, Items ps :: FL (RebaseItem p) wR wY
ps, _) <- (PatchInfoAnd ('RepoType 'IsRebase) p wR wR, Suspended p wR wR,
 PatchSet ('RepoType 'IsRebase) p Origin wR)
-> IO
     (PatchInfoAnd ('RepoType 'IsRebase) p wR wR, Suspended p wR wR,
      PatchSet ('RepoType 'IsRebase) p Origin wR)
forall (m :: * -> *) a. Monad m => a -> m a
return ((PatchInfoAnd ('RepoType 'IsRebase) p wR wR, Suspended p wR wR,
  PatchSet ('RepoType 'IsRebase) p Origin wR)
 -> IO
      (PatchInfoAnd ('RepoType 'IsRebase) p wR wR, Suspended p wR wR,
       PatchSet ('RepoType 'IsRebase) p Origin wR))
-> (PatchInfoAnd ('RepoType 'IsRebase) p wR wR, Suspended p wR wR,
    PatchSet ('RepoType 'IsRebase) p Origin wR)
-> IO
     (PatchInfoAnd ('RepoType 'IsRebase) p wR wR, Suspended p wR wR,
      PatchSet ('RepoType 'IsRebase) p Origin wR)
forall a b. (a -> b) -> a -> b
$ PatchSet ('RepoType 'IsRebase) p Origin wR
-> (PatchInfoAnd ('RepoType 'IsRebase) p wR wR, Suspended p wR wR,
    PatchSet ('RepoType 'IsRebase) p Origin wR)
forall (p :: * -> * -> *) wA wB.
PatchSet ('RepoType 'IsRebase) p wA wB
-> (PatchInfoAnd ('RepoType 'IsRebase) p wB wB, Suspended p wB wB,
    PatchSet ('RepoType 'IsRebase) p wA wB)
takeHeadRebase PatchSet ('RepoType 'IsRebase) p Origin wR
patches

    let selects :: FL (RebaseSelect p) wR wY
selects = FL (RebaseItem p) wR wY -> FL (RebaseSelect p) wR wY
forall (p :: * -> * -> *) wX wY.
PrimPatchBase p =>
FL (RebaseItem p) wX wY -> FL (RebaseSelect p) wX wY
toRebaseSelect FL (RebaseItem p) wR wY
ps

    let matchFlags :: [MatchFlag]
matchFlags = MatchOption
matchAny MatchOption -> [DarcsFlag] -> [MatchFlag]
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts
    inRange :: FL (RebaseSelect p) wR wZ
inRange :> outOfRange :: FL (RebaseSelect p) wZ wY
outOfRange <-
        (:>) (FL (RebaseSelect p)) (FL (RebaseSelect p)) wR wY
-> IO ((:>) (FL (RebaseSelect p)) (FL (RebaseSelect p)) wR wY)
forall (m :: * -> *) a. Monad m => a -> m a
return ((:>) (FL (RebaseSelect p)) (FL (RebaseSelect p)) wR wY
 -> IO ((:>) (FL (RebaseSelect p)) (FL (RebaseSelect p)) wR wY))
-> (:>) (FL (RebaseSelect p)) (FL (RebaseSelect p)) wR wY
-> IO ((:>) (FL (RebaseSelect p)) (FL (RebaseSelect p)) wR wY)
forall a b. (a -> b) -> a -> b
$
            if [MatchFlag] -> Bool
secondMatch [MatchFlag]
matchFlags then
            (forall wA wB.
 RebaseSelect p wA wB
 -> Sealed2 (PatchInfoAnd ('RepoType 'NoRebase) p))
-> [MatchFlag]
-> FL (RebaseSelect p) wR wY
-> (:>) (FL (RebaseSelect p)) (FL (RebaseSelect p)) wR wY
forall (p :: * -> * -> *) (q :: * -> * -> *) (rt :: RepoType) wX
       wY.
Matchable p =>
(forall wA wB. q wA wB -> Sealed2 (PatchInfoAnd rt p))
-> [MatchFlag] -> FL q wX wY -> (:>) (FL q) (FL q) wX wY
splitSecondFL forall wA wB.
RebaseSelect p wA wB
-> Sealed2 (PatchInfoAnd ('RepoType 'NoRebase) p)
forall (p :: * -> * -> *) wX wY.
RebaseSelect p wX wY
-> Sealed2 (PatchInfoAnd ('RepoType 'NoRebase) p)
rsToPia [MatchFlag]
matchFlags FL (RebaseSelect p) wR wY
selects
            else FL (RebaseSelect p) wR wY
selects FL (RebaseSelect p) wR wY
-> FL (RebaseSelect p) wY wY
-> (:>) (FL (RebaseSelect p)) (FL (RebaseSelect p)) wR wY
forall (a1 :: * -> * -> *) (a2 :: * -> * -> *) wX wY wZ.
a1 wX wZ -> a2 wZ wY -> (:>) a1 a2 wX wY
:> FL (RebaseSelect p) wY wY
forall (a :: * -> * -> *) wX. FL a wX wX
NilFL

    offer :: FL (RebaseSelect p) wR wZ
offer :> dontoffer :: RL (RebaseSelect p) wZ wZ
dontoffer <-
        (:>) (FL (RebaseSelect p)) (RL (RebaseSelect p)) wR wZ
-> IO ((:>) (FL (RebaseSelect p)) (RL (RebaseSelect p)) wR wZ)
forall (m :: * -> *) a. Monad m => a -> m a
return ((:>) (FL (RebaseSelect p)) (RL (RebaseSelect p)) wR wZ
 -> IO ((:>) (FL (RebaseSelect p)) (RL (RebaseSelect p)) wR wZ))
-> (:>) (FL (RebaseSelect p)) (RL (RebaseSelect p)) wR wZ
-> IO ((:>) (FL (RebaseSelect p)) (RL (RebaseSelect p)) wR wZ)
forall a b. (a -> b) -> a -> b
$
            case PrimDarcsOption (Maybe AllowConflicts)
O.conflictsYes PrimDarcsOption (Maybe AllowConflicts)
-> [DarcsFlag] -> Maybe AllowConflicts
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts of
              Nothing -> FL (RebaseSelect p) wR wZ
-> (:>) (FL (RebaseSelect p)) (RL (RebaseSelect p)) wR wZ
forall (p :: * -> * -> *) wX wY.
(PrimPatchBase p, FromPrim p, Effect p, Commute p, Invert p) =>
FL (RebaseSelect p) wX wY
-> (:>) (FL (RebaseSelect p)) (RL (RebaseSelect p)) wX wY
partitionUnconflicted FL (RebaseSelect p) wR wZ
inRange -- skip conflicts
              Just _ -> FL (RebaseSelect p) wR wZ
inRange FL (RebaseSelect p) wR wZ
-> RL (RebaseSelect p) wZ wZ
-> (:>) (FL (RebaseSelect p)) (RL (RebaseSelect p)) wR wZ
forall (a1 :: * -> * -> *) (a2 :: * -> * -> *) wX wY wZ.
a1 wX wZ -> a2 wZ wY -> (:>) a1 a2 wX wY
:> RL (RebaseSelect p) wZ wZ
forall (a :: * -> * -> *) wX. RL a wX wX
NilRL

    let warnSkip :: RL q wX wY -> IO ()
        warnSkip :: RL q wX wY -> IO ()
warnSkip NilRL = () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
        warnSkip _ = String -> IO ()
putStrLn "Skipping some patches which would cause conflicts."

    RL (RebaseSelect p) wZ wZ -> IO ()
forall (q :: * -> * -> *) wX wY. RL q wX wY -> IO ()
warnSkip RL (RebaseSelect p) wZ wZ
dontoffer

    let patches_context :: PatchSelectionContext (RebaseSelect p)
patches_context = (forall wA wB.
 RebaseSelect p wA wB
 -> Sealed2 (PatchInfoAnd ('RepoType 'NoRebase) p))
-> WhichChanges
-> String
-> PatchSelectionOptions
-> Maybe [String]
-> PatchSelectionContext (RebaseSelect p)
forall (rt :: RepoType) (p :: * -> * -> *) (q :: * -> * -> *).
(IsRepoType rt, RepoPatch p, Invert q) =>
(forall wX wY. q wX wY -> Sealed2 (PatchInfoAnd rt p))
-> WhichChanges
-> String
-> PatchSelectionOptions
-> Maybe [String]
-> PatchSelectionContext q
selectionContextGeneric forall wA wB.
RebaseSelect p wA wB
-> Sealed2 (PatchInfoAnd ('RepoType 'NoRebase) p)
forall (p :: * -> * -> *) wX wY.
RebaseSelect p wX wY
-> Sealed2 (PatchInfoAnd ('RepoType 'NoRebase) p)
rsToPia WhichChanges
First "unsuspend" (Bool -> [DarcsFlag] -> PatchSelectionOptions
patchSelOpts Bool
True [DarcsFlag]
opts) Maybe [String]
forall a. Maybe a
Nothing
    (chosen :: FL (RebaseSelect p) wR wZ
chosen :> keep :: FL (RebaseSelect p) wZ wZ
keep) <- FL (RebaseSelect p) wR wZ
-> PatchSelectionContext (RebaseSelect p)
-> IO ((:>) (FL (RebaseSelect p)) (FL (RebaseSelect p)) wR wZ)
forall (p :: * -> * -> *) wX wY.
(Invert p, Commute p, Apply p, PatchInspect p, ShowPatch p,
 ShowContextPatch p, ApplyState p ~ Tree) =>
FL p wX wY
-> PatchSelectionContext p -> IO ((:>) (FL p) (FL p) wX wY)
runSelection FL (RebaseSelect p) wR wZ
offer PatchSelectionContext (RebaseSelect p)
patches_context
    Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (FL (RebaseSelect p) wR wZ -> Bool
forall (a :: * -> * -> *) wX wZ. FL a wX wZ -> Bool
nullFL FL (RebaseSelect p) wR wZ
chosen) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ do String -> IO ()
putStrLn "No patches selected!"
                              IO ()
forall a. IO a
exitSuccess

    (FL (WDDNamed p) wR wZ
ps_to_unsuspend :: FL (WDDNamed p) wR wZ) :> chosen_fixups :: FL (RebaseFixup p) wZ wZ
chosen_fixups
           <- (if Bool
reifyFixups then FL (RebaseSelect p) wR wZ
-> IO ((:>) (FL (WDDNamed p)) (FL (RebaseFixup p)) wR wZ)
forall (p :: * -> * -> *) wX wY.
(PrimPatchBase p, FromPrim p) =>
FL (RebaseSelect p) wX wY
-> IO ((:>) (FL (WDDNamed p)) (FL (RebaseFixup p)) wX wY)
reifyRebaseSelect else (:>) (FL (WDDNamed p)) (FL (RebaseFixup p)) wR wZ
-> IO ((:>) (FL (WDDNamed p)) (FL (RebaseFixup p)) wR wZ)
forall (m :: * -> *) a. Monad m => a -> m a
return ((:>) (FL (WDDNamed p)) (FL (RebaseFixup p)) wR wZ
 -> IO ((:>) (FL (WDDNamed p)) (FL (RebaseFixup p)) wR wZ))
-> (FL (RebaseSelect p) wR wZ
    -> (:>) (FL (WDDNamed p)) (FL (RebaseFixup p)) wR wZ)
-> FL (RebaseSelect p) wR wZ
-> IO ((:>) (FL (WDDNamed p)) (FL (RebaseFixup p)) wR wZ)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FL (RebaseSelect p) wR wZ
-> (:>) (FL (WDDNamed p)) (FL (RebaseFixup p)) wR wZ
forall (p :: * -> * -> *) wX wY.
(Merge p, Invert p, Effect p, FromPrim p, PrimPatchBase p) =>
FL (RebaseSelect p) wX wY
-> (:>) (FL (WDDNamed p)) (FL (RebaseFixup p)) wX wY
extractRebaseSelect) FL (RebaseSelect p) wR wZ
chosen

    let da :: DiffAlgorithm
da = PrimDarcsOption DiffAlgorithm
diffAlgorithm PrimDarcsOption DiffAlgorithm -> [DarcsFlag] -> DiffAlgorithm
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts
        ps_to_keep :: Sealed (FL (RebaseItem p) wZ)
ps_to_keep = DiffAlgorithm
-> FL (RebaseFixup p) wZ wZ
-> FL (RebaseItem p) wZ wY
-> Sealed (FL (RebaseItem p) wZ)
forall (p :: * -> * -> *) wX wY wZ.
(PrimPatchBase p, Commute p, FromPrim p, Effect p) =>
DiffAlgorithm
-> FL (RebaseFixup p) wX wY
-> FL (RebaseItem p) wY wZ
-> Sealed (FL (RebaseItem p) wX)
simplifyPushes DiffAlgorithm
da FL (RebaseFixup p) wZ wZ
chosen_fixups (FL (RebaseItem p) wZ wY -> Sealed (FL (RebaseItem p) wZ))
-> (FL (RebaseSelect p) wZ wY -> FL (RebaseItem p) wZ wY)
-> FL (RebaseSelect p) wZ wY
-> Sealed (FL (RebaseItem p) wZ)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
                     FL (RebaseSelect p) wZ wY -> FL (RebaseItem p) wZ wY
forall (p :: * -> * -> *) wX wY.
FL (RebaseSelect p) wX wY -> FL (RebaseItem p) wX wY
fromRebaseSelect (FL (RebaseSelect p) wZ wY -> Sealed (FL (RebaseItem p) wZ))
-> FL (RebaseSelect p) wZ wY -> Sealed (FL (RebaseItem p) wZ)
forall a b. (a -> b) -> a -> b
$
                     FL (RebaseSelect p) wZ wZ
keep FL (RebaseSelect p) wZ wZ
-> FL (RebaseSelect p) wZ wY -> FL (RebaseSelect p) wZ wY
forall (a :: * -> * -> *) wX wY wZ.
FL a wX wY -> FL a wY wZ -> FL a wX wZ
+>+ RL (RebaseSelect p) wZ wZ -> FL (RebaseSelect p) wZ wZ
forall (a :: * -> * -> *) wX wZ. RL a wX wZ -> FL a wX wZ
reverseRL RL (RebaseSelect p) wZ wZ
dontoffer FL (RebaseSelect p) wZ wZ
-> FL (RebaseSelect p) wZ wY -> FL (RebaseSelect p) wZ wY
forall (a :: * -> * -> *) wX wY wZ.
FL a wX wY -> FL a wY wZ -> FL a wX wZ
+>+ FL (RebaseSelect p) wZ wY
outOfRange

    Sealed standard_resolved_p :: FL (PrimOf p) wZ wX
standard_resolved_p <- Sealed (FL (PrimOf p) wZ) -> IO (Sealed (FL (PrimOf p) wZ))
forall (m :: * -> *) a. Monad m => a -> m a
return (Sealed (FL (PrimOf p) wZ) -> IO (Sealed (FL (PrimOf p) wZ)))
-> Sealed (FL (PrimOf p) wZ) -> IO (Sealed (FL (PrimOf p) wZ))
forall a b. (a -> b) -> a -> b
$ FL p wR wZ -> Sealed (FL (PrimOf p) wZ)
forall (p :: * -> * -> *) wX wY.
(PrimPatchBase p, Conflict p, CommuteNoConflicts p) =>
FL p wX wY -> Sealed (FL (PrimOf p) wY)
standardResolution (FL p wR wZ -> Sealed (FL (PrimOf p) wZ))
-> FL p wR wZ -> Sealed (FL (PrimOf p) wZ)
forall a b. (a -> b) -> a -> b
$ FL (FL p) wR wZ -> FL p wR wZ
forall (a :: * -> * -> *) wX wZ. FL (FL a) wX wZ -> FL a wX wZ
concatFL
                                         (FL (FL p) wR wZ -> FL p wR wZ) -> FL (FL p) wR wZ -> FL p wR wZ
forall a b. (a -> b) -> a -> b
$ String -> FL (FL p) wR wZ -> FL (FL p) wR wZ
forall (a :: * -> * -> *) wX wY. String -> FL a wX wY -> FL a wX wY
progressFL "Examining patches for conflicts"
                                         (FL (FL p) wR wZ -> FL (FL p) wR wZ)
-> FL (FL p) wR wZ -> FL (FL p) wR wZ
forall a b. (a -> b) -> a -> b
$ (forall wW wY. WDDNamed p wW wY -> FL p wW wY)
-> FL (WDDNamed p) wR wZ -> FL (FL p) wR wZ
forall (a :: * -> * -> *) (b :: * -> * -> *) wX wZ.
(forall wW wY. a wW wY -> b wW wY) -> FL a wX wZ -> FL b wX wZ
mapFL_FL (Named p wW wY -> FL p wW wY
forall (p :: * -> * -> *) wX wY. Named p wX wY -> FL p wX wY
patchcontents (Named p wW wY -> FL p wW wY)
-> (WithDroppedDeps (Named p) wW wY -> Named p wW wY)
-> WithDroppedDeps (Named p) wW wY
-> FL p wW wY
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WithDroppedDeps (Named p) wW wY -> Named p wW wY
forall (p :: * -> * -> *) wX wY. WithDroppedDeps p wX wY -> p wX wY
wddPatch) FL (WDDNamed p) wR wZ
ps_to_unsuspend
                                    :: IO (Sealed (FL (PrimOf p) wZ))

    Bool
have_conflicts <- String
-> AllowConflicts
-> ExternalMerge
-> FL (PrimOf p) wZ wX
-> IO Bool
forall (p :: * -> * -> *) wX wY.
PrimPatch p =>
String -> AllowConflicts -> ExternalMerge -> FL p wX wY -> IO Bool
announceMergeConflicts "unsuspend"
        ([DarcsFlag] -> AllowConflicts
allowConflicts [DarcsFlag]
opts) (PrimDarcsOption ExternalMerge
externalMerge PrimDarcsOption ExternalMerge -> [DarcsFlag] -> ExternalMerge
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) FL (PrimOf p) wZ wX
standard_resolved_p
    Sealed (resolved_p  :: FL (PrimOf p) wA wB) <-
        case (PrimDarcsOption ExternalMerge
externalMerge PrimDarcsOption ExternalMerge -> [DarcsFlag] -> ExternalMerge
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts, Bool
have_conflicts) of
            (NoExternalMerge, _) ->
                case PrimDarcsOption (Maybe AllowConflicts)
O.conflictsYes PrimDarcsOption (Maybe AllowConflicts)
-> [DarcsFlag] -> Maybe AllowConflicts
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts of
                    Just O.YesAllowConflicts -> Sealed (FL (PrimOf p) wZ) -> IO (Sealed (FL (PrimOf p) wZ))
forall (m :: * -> *) a. Monad m => a -> m a
return (Sealed (FL (PrimOf p) wZ) -> IO (Sealed (FL (PrimOf p) wZ)))
-> Sealed (FL (PrimOf p) wZ) -> IO (Sealed (FL (PrimOf p) wZ))
forall a b. (a -> b) -> a -> b
$ FL (PrimOf p) wZ wZ -> Sealed (FL (PrimOf p) wZ)
forall (a :: * -> *) wX. a wX -> Sealed a
seal FL (PrimOf p) wZ wZ
forall (a :: * -> * -> *) wX. FL a wX wX
NilFL -- i.e. don't mark them
                    _ -> Sealed (FL (PrimOf p) wZ) -> IO (Sealed (FL (PrimOf p) wZ))
forall (m :: * -> *) a. Monad m => a -> m a
return (Sealed (FL (PrimOf p) wZ) -> IO (Sealed (FL (PrimOf p) wZ)))
-> Sealed (FL (PrimOf p) wZ) -> IO (Sealed (FL (PrimOf p) wZ))
forall a b. (a -> b) -> a -> b
$ FL (PrimOf p) wZ wX -> Sealed (FL (PrimOf p) wZ)
forall (a :: * -> *) wX. a wX -> Sealed a
seal FL (PrimOf p) wZ wX
standard_resolved_p
            (_, False) -> Sealed (FL (PrimOf p) wZ) -> IO (Sealed (FL (PrimOf p) wZ))
forall (m :: * -> *) a. Monad m => a -> m a
return (Sealed (FL (PrimOf p) wZ) -> IO (Sealed (FL (PrimOf p) wZ)))
-> Sealed (FL (PrimOf p) wZ) -> IO (Sealed (FL (PrimOf p) wZ))
forall a b. (a -> b) -> a -> b
$ FL (PrimOf p) wZ wX -> Sealed (FL (PrimOf p) wZ)
forall (a :: * -> *) wX. a wX -> Sealed a
seal FL (PrimOf p) wZ wX
standard_resolved_p
            (YesExternalMerge _, True) ->
                String -> IO (Sealed (FL (PrimOf p) wZ))
forall a. HasCallStack => String -> a
error "external resolution for unsuspend not implemented yet"

    let effect_to_apply :: FL (PrimOf p) wR wX
effect_to_apply = FL (FL (PrimOf p)) wR wZ -> FL (PrimOf p) wR wZ
forall (a :: * -> * -> *) wX wZ. FL (FL a) wX wZ -> FL a wX wZ
concatFL ((forall wW wY. WDDNamed p wW wY -> FL (PrimOf p) wW wY)
-> FL (WDDNamed p) wR wZ -> FL (FL (PrimOf p)) wR wZ
forall (a :: * -> * -> *) (b :: * -> * -> *) wX wZ.
(forall wW wY. a wW wY -> b wW wY) -> FL a wX wZ -> FL b wX wZ
mapFL_FL forall wW wY. WDDNamed p wW wY -> FL (PrimOf p) wW wY
forall (p :: * -> * -> *) wX wY.
Effect p =>
p wX wY -> FL (PrimOf p) wX wY
effect FL (WDDNamed p) wR wZ
ps_to_unsuspend) FL (PrimOf p) wR wZ -> FL (PrimOf p) wZ wX -> FL (PrimOf p) wR wX
forall (a :: * -> * -> *) wX wY wZ.
FL a wX wY -> FL a wY wZ -> FL a wX wZ
+>+ FL (PrimOf p) wZ wX
resolved_p
    Repository ('RepoType 'IsRebase) p wR wU wR -> IO ()
forall t. t -> IO ()
invalidateIndex Repository ('RepoType 'IsRebase) p wR wU wR
repository
    Repository ('RepoType 'IsRebase) p wR wU wR
repository' <- Repository ('RepoType 'IsRebase) p wR wU wR
-> Compression
-> UpdateWorking
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wR wR
-> IO (Repository ('RepoType 'IsRebase) p wR wU wR)
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT wX.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wT
-> Compression
-> UpdateWorking
-> FL (PatchInfoAnd rt p) wX wT
-> IO (Repository rt p wR wU wX)
tentativelyRemovePatches Repository ('RepoType 'IsRebase) p wR wU wR
repository (PrimDarcsOption Compression
compress PrimDarcsOption Compression -> [DarcsFlag] -> Compression
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) UpdateWorking
YesUpdateWorking (PatchInfoAnd ('RepoType 'IsRebase) p wR wR
rOld PatchInfoAnd ('RepoType 'IsRebase) p wR wR
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wR wR
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wR wR
forall (a :: * -> * -> *) wX wY wZ.
a wX wY -> FL a wY wZ -> FL a wX wZ
:>: FL (PatchInfoAnd ('RepoType 'IsRebase) p) wR wR
forall (a :: * -> * -> *) wX. FL a wX wX
NilFL)
    -- TODO should catch logfiles (fst value from updatePatchHeader) and clean them up as in AmendRecord
    Repository ('RepoType 'IsRebase) p wR wU wR
-> UpdateWorking -> FL (PrimOf p) wR wX -> IO ()
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT wX wY.
RepoPatch p =>
Repository rt p wR wU wT
-> UpdateWorking -> FL (PrimOf p) wX wY -> IO ()
tentativelyAddToPending Repository ('RepoType 'IsRebase) p wR wU wR
repository' UpdateWorking
YesUpdateWorking FL (PrimOf p) wR wX
effect_to_apply
    -- we can just let hijack attempts through here because we already asked about them on suspend time
    (repository'' :: Repository ('RepoType 'IsRebase) p wR wU wZ
repository'', renames :: FL (RebaseName p) wZ wZ
renames) <- HijackOptions
-> HijackT
     IO
     (Repository ('RepoType 'IsRebase) p wR wU wZ,
      FL (RebaseName p) wZ wZ)
-> IO
     (Repository ('RepoType 'IsRebase) p wR wU wZ,
      FL (RebaseName p) wZ wZ)
forall (m :: * -> *) a.
Monad m =>
HijackOptions -> HijackT m a -> m a
runHijackT HijackOptions
IgnoreHijack (HijackT
   IO
   (Repository ('RepoType 'IsRebase) p wR wU wZ,
    FL (RebaseName p) wZ wZ)
 -> IO
      (Repository ('RepoType 'IsRebase) p wR wU wZ,
       FL (RebaseName p) wZ wZ))
-> HijackT
     IO
     (Repository ('RepoType 'IsRebase) p wR wU wZ,
      FL (RebaseName p) wZ wZ)
-> IO
     (Repository ('RepoType 'IsRebase) p wR wU wZ,
      FL (RebaseName p) wZ wZ)
forall a b. (a -> b) -> a -> b
$ Repository ('RepoType 'IsRebase) p wR wU wR
-> FL (WDDNamed p) wR wZ
-> HijackT
     IO
     (Repository ('RepoType 'IsRebase) p wR wU wZ,
      FL (RebaseName p) wZ wZ)
forall (p :: * -> * -> *) wR wU wT wT2.
(RepoPatch p, ApplyState p ~ Tree) =>
Repository ('RepoType 'IsRebase) p wR wU wT
-> FL (WDDNamed p) wT wT2
-> HijackT
     IO
     (Repository ('RepoType 'IsRebase) p wR wU wT2,
      FL (RebaseName p) wT2 wT2)
doAdd Repository ('RepoType 'IsRebase) p wR wU wR
repository' FL (WDDNamed p) wR wZ
ps_to_unsuspend
    WrappedNamed ('RepoType 'IsRebase) p wZ wZ
rNew <- (forall wX.
 FL (RebaseItem p) wZ wX
 -> IO (WrappedNamed ('RepoType 'IsRebase) p wZ wZ))
-> Sealed (FL (RebaseItem p) wZ)
-> IO (WrappedNamed ('RepoType 'IsRebase) p wZ wZ)
forall (a :: * -> *) b. (forall wX. a wX -> b) -> Sealed a -> b
unseal (Suspended p wZ wZ
-> IO (WrappedNamed ('RepoType 'IsRebase) p wZ wZ)
forall (p :: * -> * -> *) wX.
(PrimPatchBase p, FromPrim p, Effect p) =>
Suspended p wX wX
-> IO (WrappedNamed ('RepoType 'IsRebase) p wX wX)
mkRebase (Suspended p wZ wZ
 -> IO (WrappedNamed ('RepoType 'IsRebase) p wZ wZ))
-> (FL (RebaseItem p) wZ wX -> Suspended p wZ wZ)
-> FL (RebaseItem p) wZ wX
-> IO (WrappedNamed ('RepoType 'IsRebase) p wZ wZ)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FL (RebaseItem p) wZ wX -> Suspended p wZ wZ
forall (p :: * -> * -> *) wX wY.
FL (RebaseItem p) wX wY -> Suspended p wX wX
Items) (Sealed (FL (RebaseItem p) wZ)
 -> IO (WrappedNamed ('RepoType 'IsRebase) p wZ wZ))
-> (Sealed (FL (RebaseItem p) wZ) -> Sealed (FL (RebaseItem p) wZ))
-> Sealed (FL (RebaseItem p) wZ)
-> IO (WrappedNamed ('RepoType 'IsRebase) p wZ wZ)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall wX.
 FL (RebaseItem p) wZ wX -> Sealed (FL (RebaseItem p) wZ))
-> Sealed (FL (RebaseItem p) wZ) -> Sealed (FL (RebaseItem p) wZ)
forall (a :: * -> *) b. (forall wX. a wX -> b) -> Sealed a -> b
unseal (DiffAlgorithm
-> FL (RebaseFixup p) wZ wZ
-> FL (RebaseItem p) wZ wX
-> Sealed (FL (RebaseItem p) wZ)
forall (p :: * -> * -> *) wX wY wZ.
(PrimPatchBase p, Commute p, FromPrim p, Effect p) =>
DiffAlgorithm
-> FL (RebaseFixup p) wX wY
-> FL (RebaseItem p) wY wZ
-> Sealed (FL (RebaseItem p) wX)
simplifyPushes DiffAlgorithm
da ((forall wW wY. RebaseName p wW wY -> RebaseFixup p wW wY)
-> FL (RebaseName p) wZ wZ -> FL (RebaseFixup p) wZ wZ
forall (a :: * -> * -> *) (b :: * -> * -> *) wX wZ.
(forall wW wY. a wW wY -> b wW wY) -> FL a wX wZ -> FL b wX wZ
mapFL_FL forall wW wY. RebaseName p wW wY -> RebaseFixup p wW wY
forall (p :: * -> * -> *) wX wY.
RebaseName p wX wY -> RebaseFixup p wX wY
NameFixup FL (RebaseName p) wZ wZ
renames)) (Sealed (FL (RebaseItem p) wZ)
 -> IO (WrappedNamed ('RepoType 'IsRebase) p wZ wZ))
-> Sealed (FL (RebaseItem p) wZ)
-> IO (WrappedNamed ('RepoType 'IsRebase) p wZ wZ)
forall a b. (a -> b) -> a -> b
$ Sealed (FL (RebaseItem p) wZ)
ps_to_keep
    Repository ('RepoType 'IsRebase) p wR wU wZ
repository''' <- Repository ('RepoType 'IsRebase) p wR wU wZ
-> Compression
-> Verbosity
-> UpdateWorking
-> PatchInfoAnd ('RepoType 'IsRebase) p wZ wZ
-> IO (Repository ('RepoType 'IsRebase) p wR wU wZ)
forall (p :: * -> * -> *) (rt :: RepoType) wR wU wT wY.
(RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wT
-> Compression
-> Verbosity
-> UpdateWorking
-> PatchInfoAnd rt p wT wY
-> IO (Repository rt p wR wU wY)
tentativelyAddPatch Repository ('RepoType 'IsRebase) p wR wU wZ
repository'' (PrimDarcsOption Compression
compress PrimDarcsOption Compression -> [DarcsFlag] -> Compression
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) (PrimDarcsOption Verbosity
verbosity PrimDarcsOption Verbosity -> [DarcsFlag] -> Verbosity
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) UpdateWorking
YesUpdateWorking (WrappedNamed ('RepoType 'IsRebase) p wZ wZ
-> PatchInfoAnd ('RepoType 'IsRebase) p wZ wZ
forall (rt :: RepoType) (p :: * -> * -> *) wX wY.
WrappedNamed rt p wX wY -> PatchInfoAnd rt p wX wY
n2pia WrappedNamed ('RepoType 'IsRebase) p wZ wZ
rNew)
    Repository ('RepoType 'IsRebase) p wR wU wZ
-> UpdateWorking -> Compression -> IO ()
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wT -> UpdateWorking -> Compression -> IO ()
finalizeRepositoryChanges Repository ('RepoType 'IsRebase) p wR wU wZ
repository''' UpdateWorking
YesUpdateWorking (PrimDarcsOption Compression
compress PrimDarcsOption Compression -> [DarcsFlag] -> Compression
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts)
    Repository ('RepoType 'IsRebase) p wR wX wZ
_ <- Repository ('RepoType 'IsRebase) p wR wU wZ
-> Verbosity
-> FL (PrimOf p) wU wX
-> IO (Repository ('RepoType 'IsRebase) p wR wX wZ)
forall (p :: * -> * -> *) (rt :: RepoType) wR wU wT wY.
(ApplyState p ~ Tree, RepoPatch p) =>
Repository rt p wR wU wT
-> Verbosity
-> FL (PrimOf p) wU wY
-> IO (Repository rt p wR wY wT)
applyToWorking Repository ('RepoType 'IsRebase) p wR wU wZ
repository''' (PrimDarcsOption Verbosity
verbosity PrimDarcsOption Verbosity -> [DarcsFlag] -> Verbosity
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) FL (PrimOf p) wR wX
FL (PrimOf p) wU wX
effect_to_apply IO (Repository ('RepoType 'IsRebase) p wR wX wZ)
-> (IOException
    -> IO (Repository ('RepoType 'IsRebase) p wR wX wZ))
-> IO (Repository ('RepoType 'IsRebase) p wR wX wZ)
forall e a. Exception e => IO a -> (e -> IO a) -> IO a
`catch` \(IOException
e :: IOException) ->
        String -> IO (Repository ('RepoType 'IsRebase) p wR wX wZ)
forall (m :: * -> *) a. MonadFail m => String -> m a
fail ("couldn't apply patch in working dir.\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++ IOException -> String
forall a. Show a => a -> String
show IOException
e)
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
   ) :: IO ()
    where doAdd :: (RepoPatch p, ApplyState p ~ Tree)
                => Repository ('RepoType 'IsRebase) p wR wU wT
                -> FL (WDDNamed p) wT wT2
                -> HijackT IO (Repository ('RepoType 'IsRebase) p wR wU wT2, FL (RebaseName p) wT2 wT2)
          doAdd :: Repository ('RepoType 'IsRebase) p wR wU wT
-> FL (WDDNamed p) wT wT2
-> HijackT
     IO
     (Repository ('RepoType 'IsRebase) p wR wU wT2,
      FL (RebaseName p) wT2 wT2)
doAdd repo :: Repository ('RepoType 'IsRebase) p wR wU wT
repo NilFL = (Repository ('RepoType 'IsRebase) p wR wU wT,
 FL (RebaseName p) wT2 wT2)
-> StateT
     HijackOptions
     IO
     (Repository ('RepoType 'IsRebase) p wR wU wT,
      FL (RebaseName p) wT2 wT2)
forall (m :: * -> *) a. Monad m => a -> m a
return (Repository ('RepoType 'IsRebase) p wR wU wT
repo, FL (RebaseName p) wT2 wT2
forall (a :: * -> * -> *) wX. FL a wX wX
NilFL)
          doAdd repo :: Repository ('RepoType 'IsRebase) p wR wU wT
repo ((WDDNamed p wT wY
p :: WDDNamed p wT wU) :>:ps :: FL (WDDNamed p) wY wT2
ps) = do
              case WDDNamed p wT wY -> [PatchInfo]
forall (p :: * -> * -> *) wX wY.
WithDroppedDeps p wX wY -> [PatchInfo]
wddDependedOn WDDNamed p wT wY
p of
                  [] -> () -> HijackT IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
                  deps :: [PatchInfo]
deps -> IO () -> HijackT IO ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> HijackT IO ()) -> IO () -> HijackT IO ()
forall a b. (a -> b) -> a -> b
$ do
                      -- It might make sense to only print out this message once, but we might find
                      -- that the dropped dependencies are interspersed with other output,
                      -- e.g. if running with --ask-deps
                      String -> IO ()
putStr (String -> IO ()) -> String -> IO ()
forall a b. (a -> b) -> a -> b
$ "Warning: dropping the following explicit "
                                 String -> String -> String
forall a. [a] -> [a] -> [a]
++ Int -> Noun -> String -> String
forall n. Countable n => Int -> n -> String -> String
englishNum ([PatchInfo] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [PatchInfo]
deps) (String -> Noun
Noun "dependency") ":\n\n"
                      let printIndented :: Int -> PatchInfo -> IO ()
printIndented n :: Int
n =
                              (String -> IO ()) -> [String] -> IO ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ (String -> IO ()
putStrLn (String -> IO ()) -> (String -> String) -> String -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Int -> Char -> String
forall a. Int -> a -> [a]
replicate Int
n ' 'String -> String -> String
forall a. [a] -> [a] -> [a]
++)) ([String] -> IO ())
-> (PatchInfo -> [String]) -> PatchInfo -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> [String]
lines (String -> [String])
-> (PatchInfo -> String) -> PatchInfo -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
                              Doc -> String
renderString (Doc -> String) -> (PatchInfo -> Doc) -> PatchInfo -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PatchInfo -> Doc
displayPatchInfo
                      String -> IO ()
putStrLn (String -> IO ())
-> (Named p wT wY -> String) -> Named p wT wY -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc -> String
renderString (Doc -> String)
-> (Named p wT wY -> Doc) -> Named p wT wY -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PatchInfo -> Doc
displayPatchInfo (PatchInfo -> Doc)
-> (Named p wT wY -> PatchInfo) -> Named p wT wY -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
                              Named p wT wY -> PatchInfo
forall (p :: * -> * -> *) wX wY. Named p wX wY -> PatchInfo
patch2patchinfo (Named p wT wY -> IO ()) -> Named p wT wY -> IO ()
forall a b. (a -> b) -> a -> b
$ WDDNamed p wT wY -> Named p wT wY
forall (p :: * -> * -> *) wX wY. WithDroppedDeps p wX wY -> p wX wY
wddPatch WDDNamed p wT wY
p
                      String -> IO ()
putStr " depended on:\n"
                      (PatchInfo -> IO ()) -> [PatchInfo] -> IO ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ (Int -> PatchInfo -> IO ()
printIndented 2) [PatchInfo]
deps
                      String -> IO ()
putStr "\n"

              -- TODO should catch logfiles (fst value from updatePatchHeader) and clean them up as in AmendRecord
              PatchInfoAnd ('RepoType 'IsRebase) p wT wY
p' <- (Maybe String, PatchInfoAnd ('RepoType 'IsRebase) p wT wY)
-> PatchInfoAnd ('RepoType 'IsRebase) p wT wY
forall a b. (a, b) -> b
snd ((Maybe String, PatchInfoAnd ('RepoType 'IsRebase) p wT wY)
 -> PatchInfoAnd ('RepoType 'IsRebase) p wT wY)
-> StateT
     HijackOptions
     IO
     (Maybe String, PatchInfoAnd ('RepoType 'IsRebase) p wT wY)
-> StateT
     HijackOptions IO (PatchInfoAnd ('RepoType 'IsRebase) p wT wY)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String
-> AskAboutDeps ('RepoType 'IsRebase) p Any Any wT
-> PatchSelectionOptions
-> DiffAlgorithm
-> Bool
-> Bool
-> Maybe String
-> Maybe String
-> Maybe AskLongComment
-> PatchInfoAnd ('RepoType 'IsRebase) p wT wY
-> FL (PrimOf p) wY wY
-> StateT
     HijackOptions
     IO
     (Maybe String, PatchInfoAnd ('RepoType 'IsRebase) p wT wY)
forall (rt :: RepoType) (p :: * -> * -> *) wX wY wR wU wT.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
String
-> AskAboutDeps rt p wR wU wT
-> PatchSelectionOptions
-> DiffAlgorithm
-> Bool
-> Bool
-> Maybe String
-> Maybe String
-> Maybe AskLongComment
-> PatchInfoAnd rt p wT wX
-> FL (PrimOf p) wX wY
-> HijackT IO (Maybe String, PatchInfoAnd rt p wT wY)
updatePatchHeader "unsuspend"
                      AskAboutDeps ('RepoType 'IsRebase) p Any Any wT
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
AskAboutDeps rt p wR wU wT
NoAskAboutDeps
                      (Bool -> [DarcsFlag] -> PatchSelectionOptions
patchSelOpts Bool
True [DarcsFlag]
opts)
                      (PrimDarcsOption DiffAlgorithm
diffAlgorithm PrimDarcsOption DiffAlgorithm -> [DarcsFlag] -> DiffAlgorithm
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts)
                      (PrimDarcsOption Bool -> [DarcsFlag] -> Bool
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
parseFlags PrimDarcsOption Bool
O.keepDate [DarcsFlag]
opts)
                      (PrimDarcsOption Bool -> [DarcsFlag] -> Bool
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
parseFlags PrimDarcsOption Bool
O.selectAuthor [DarcsFlag]
opts)
                      (PrimDarcsOption (Maybe String) -> [DarcsFlag] -> Maybe String
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
parseFlags PrimDarcsOption (Maybe String)
O.author [DarcsFlag]
opts)
                      (PrimDarcsOption (Maybe String) -> [DarcsFlag] -> Maybe String
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
parseFlags PrimDarcsOption (Maybe String)
O.patchname [DarcsFlag]
opts)
                      ((forall a.
 PrimOptSpec DarcsOptDescr DarcsFlag a (Maybe AskLongComment))
-> [DarcsFlag] -> Maybe AskLongComment
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
parseFlags forall a.
PrimOptSpec DarcsOptDescr DarcsFlag a (Maybe AskLongComment)
O.askLongComment [DarcsFlag]
opts)
                      (WrappedNamed ('RepoType 'IsRebase) p wT wY
-> PatchInfoAnd ('RepoType 'IsRebase) p wT wY
forall (rt :: RepoType) (p :: * -> * -> *) wX wY.
WrappedNamed rt p wX wY -> PatchInfoAnd rt p wX wY
n2pia (Named p wT wY -> WrappedNamed ('RepoType 'IsRebase) p wT wY
forall (p :: * -> * -> *) wX wY.
Named p wX wY -> WrappedNamed ('RepoType 'IsRebase) p wX wY
toRebasing (WDDNamed p wT wY -> Named p wT wY
forall (p :: * -> * -> *) wX wY. WithDroppedDeps p wX wY -> p wX wY
wddPatch WDDNamed p wT wY
p))) FL (PrimOf p) wY wY
forall (a :: * -> * -> *) wX. FL a wX wX
NilFL
              Repository ('RepoType 'IsRebase) p wR wU wY
repo' <- IO (Repository ('RepoType 'IsRebase) p wR wU wY)
-> StateT
     HijackOptions IO (Repository ('RepoType 'IsRebase) p wR wU wY)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Repository ('RepoType 'IsRebase) p wR wU wY)
 -> StateT
      HijackOptions IO (Repository ('RepoType 'IsRebase) p wR wU wY))
-> IO (Repository ('RepoType 'IsRebase) p wR wU wY)
-> StateT
     HijackOptions IO (Repository ('RepoType 'IsRebase) p wR wU wY)
forall a b. (a -> b) -> a -> b
$ Repository ('RepoType 'IsRebase) p wR wU wT
-> Compression
-> Verbosity
-> UpdateWorking
-> PatchInfoAnd ('RepoType 'IsRebase) p wT wY
-> IO (Repository ('RepoType 'IsRebase) p wR wU wY)
forall (p :: * -> * -> *) (rt :: RepoType) wR wU wT wY.
(RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wT
-> Compression
-> Verbosity
-> UpdateWorking
-> PatchInfoAnd rt p wT wY
-> IO (Repository rt p wR wU wY)
tentativelyAddPatch Repository ('RepoType 'IsRebase) p wR wU wT
repo (PrimDarcsOption Compression
compress PrimDarcsOption Compression -> [DarcsFlag] -> Compression
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) (PrimDarcsOption Verbosity
verbosity PrimDarcsOption Verbosity -> [DarcsFlag] -> Verbosity
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) UpdateWorking
YesUpdateWorking PatchInfoAnd ('RepoType 'IsRebase) p wT wY
p'
              -- create a rename that undoes the change we just made, so the contexts match up
              let rename :: RebaseName p wU wU
                  rename :: RebaseName p wY wY
rename = PatchInfo -> PatchInfo -> RebaseName p wY wY
forall (p :: * -> * -> *) wX wY.
PatchInfo -> PatchInfo -> RebaseName p wX wY
Rename (PatchInfoAnd ('RepoType 'IsRebase) p wT wY -> PatchInfo
forall (rt :: RepoType) (p :: * -> * -> *) wA wB.
PatchInfoAnd rt p wA wB -> PatchInfo
info PatchInfoAnd ('RepoType 'IsRebase) p wT wY
p') (Named p wT wY -> PatchInfo
forall (p :: * -> * -> *) wX wY. Named p wX wY -> PatchInfo
patch2patchinfo (WDDNamed p wT wY -> Named p wT wY
forall (p :: * -> * -> *) wX wY. WithDroppedDeps p wX wY -> p wX wY
wddPatch WDDNamed p wT wY
p))
              -- push it through the remaining patches to fix them up
              Just (ps2 :: FL (WDDNamed p) wY wZ
ps2 :> (RebaseName p wZ wT2
rename2 :: RebaseName p wV wT2)) <- Maybe ((:>) (FL (WDDNamed p)) (RebaseName p) wY wT2)
-> StateT
     HijackOptions
     IO
     (Maybe ((:>) (FL (WDDNamed p)) (RebaseName p) wY wT2))
forall (m :: * -> *) a. Monad m => a -> m a
return (CommuteFn (RebaseName p) (WDDNamed p)
-> (:>) (RebaseName p) (FL (WDDNamed p)) wY wT2
-> Maybe ((:>) (FL (WDDNamed p)) (RebaseName p) wY wT2)
forall (p1 :: * -> * -> *) (p2 :: * -> * -> *).
CommuteFn p1 p2 -> CommuteFn p1 (FL p2)
commuterIdFL (CommuteFn (RebaseName p) (Named p)
-> CommuteFn (RebaseName p) (WDDNamed p)
forall (p :: * -> * -> *) (q :: * -> * -> *).
CommuteFn p q -> CommuteFn p (WithDroppedDeps q)
commuterIdWDD CommuteFn (RebaseName p) (Named p)
forall (p :: * -> * -> *).
Invert p =>
CommuteFn (RebaseName p) (Named p)
commuteNameNamed) (RebaseName p wY wY
rename RebaseName p wY wY
-> FL (WDDNamed p) wY wT2
-> (:>) (RebaseName p) (FL (WDDNamed p)) wY wT2
forall (a1 :: * -> * -> *) (a2 :: * -> * -> *) wX wY wZ.
a1 wX wZ -> a2 wZ wY -> (:>) a1 a2 wX wY
:> FL (WDDNamed p) wY wT2
ps))
              -- assert that the rename still has a null effect on the context after commuting
              EqCheck wZ wT2
IsEq <- EqCheck wZ wT2 -> StateT HijackOptions IO (EqCheck wZ wT2)
forall (m :: * -> *) a. Monad m => a -> m a
return (EqCheck Any Any -> EqCheck wZ wT2
forall (a :: * -> * -> *) wX wY wB wC. a wX wY -> a wB wC
unsafeCoerceP EqCheck Any Any
forall wA. EqCheck wA wA
IsEq :: EqCheck wV wT2)
              (repo'' :: Repository ('RepoType 'IsRebase) p wR wU wZ
repo'', renames :: FL (RebaseName p) wZ wZ
renames) <- Repository ('RepoType 'IsRebase) p wR wU wY
-> FL (WDDNamed p) wY wZ
-> HijackT
     IO
     (Repository ('RepoType 'IsRebase) p wR wU wZ,
      FL (RebaseName p) wZ wZ)
forall (p :: * -> * -> *) wR wU wT wT2.
(RepoPatch p, ApplyState p ~ Tree) =>
Repository ('RepoType 'IsRebase) p wR wU wT
-> FL (WDDNamed p) wT wT2
-> HijackT
     IO
     (Repository ('RepoType 'IsRebase) p wR wU wT2,
      FL (RebaseName p) wT2 wT2)
doAdd Repository ('RepoType 'IsRebase) p wR wU wY
repo' FL (WDDNamed p) wY wZ
ps2
              -- return the renames so that the suspended patch can be fixed up
              (Repository ('RepoType 'IsRebase) p wR wU wZ,
 FL (RebaseName p) wZ wZ)
-> HijackT
     IO
     (Repository ('RepoType 'IsRebase) p wR wU wZ,
      FL (RebaseName p) wZ wZ)
forall (m :: * -> *) a. Monad m => a -> m a
return (Repository ('RepoType 'IsRebase) p wR wU wZ
repo'', RebaseName p wZ wT2
rename2 RebaseName p wZ wT2
-> FL (RebaseName p) wT2 wZ -> FL (RebaseName p) wZ wZ
forall (a :: * -> * -> *) wX wY wZ.
a wX wY -> FL a wY wZ -> FL a wX wZ
:>: FL (RebaseName p) wT2 wZ
FL (RebaseName p) wZ wZ
renames)


inject :: DarcsCommand [DarcsFlag]
inject :: DarcsCommand [DarcsFlag]
inject = DarcsCommand :: forall parsedFlags.
String
-> String
-> String
-> String
-> Int
-> [String]
-> ((AbsolutePath, AbsolutePath)
    -> parsedFlags -> [String] -> IO ())
-> ([DarcsFlag] -> IO (Either String ()))
-> ((AbsolutePath, AbsolutePath)
    -> [DarcsFlag] -> [String] -> IO [String])
-> ([DarcsFlag] -> AbsolutePath -> [String] -> IO [String])
-> [DarcsOptDescr DarcsFlag]
-> [DarcsOptDescr DarcsFlag]
-> [DarcsFlag]
-> ([DarcsFlag] -> [String])
-> ([DarcsFlag] -> parsedFlags)
-> DarcsCommand parsedFlags
DarcsCommand
    { commandProgramName :: String
commandProgramName = "darcs"
    , commandName :: String
commandName = "inject"
    , commandHelp :: String
commandHelp = "Merge a change from the fixups of a patch into the patch itself.\n"
    , commandDescription :: String
commandDescription = "Merge a change from the fixups of a patch into the patch itself."
    , commandPrereq :: [DarcsFlag] -> IO (Either String ())
commandPrereq = [DarcsFlag] -> IO (Either String ())
amInHashedRepository
    , commandExtraArgs :: Int
commandExtraArgs = 0
    , commandExtraArgHelp :: [String]
commandExtraArgHelp = []
    , commandCommand :: (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
commandCommand = (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
injectCmd
    , commandCompleteArgs :: (AbsolutePath, AbsolutePath)
-> [DarcsFlag] -> [String] -> IO [String]
commandCompleteArgs = (AbsolutePath, AbsolutePath)
-> [DarcsFlag] -> [String] -> IO [String]
noArgs
    , commandArgdefaults :: [DarcsFlag] -> AbsolutePath -> [String] -> IO [String]
commandArgdefaults = [DarcsFlag] -> AbsolutePath -> [String] -> IO [String]
nodefaults
    , commandAdvancedOptions :: [DarcsOptDescr DarcsFlag]
commandAdvancedOptions = []
    , commandBasicOptions :: [DarcsOptDescr DarcsFlag]
commandBasicOptions = OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  (Bool -> Maybe String -> DiffAlgorithm -> Any)
-> [DarcsOptDescr DarcsFlag]
forall (d :: * -> *) f a b. OptSpec d f a b -> [d f]
odesc OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  (Bool -> Maybe String -> DiffAlgorithm -> Any)
forall a.
OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  (Bool -> Maybe String -> DiffAlgorithm -> a)
injectBasicOpts
    , commandDefaults :: [DarcsFlag]
commandDefaults = OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  (Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> [DarcsFlag])
-> [DarcsFlag]
forall (d :: * -> *) f b. OptSpec d f [f] b -> [f]
defaultFlags OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  (Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> [DarcsFlag])
forall a.
DarcsOption
  a
  (Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> a)
injectOpts
    , commandCheckOptions :: [DarcsFlag] -> [String]
commandCheckOptions = OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  (Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> Any)
-> [DarcsFlag] -> [String]
forall (d :: * -> *) f a b. OptSpec d f a b -> [f] -> [String]
ocheck OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  (Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> Any)
forall a.
DarcsOption
  a
  (Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> a)
injectOpts
    , commandParseOptions :: [DarcsFlag] -> [DarcsFlag]
commandParseOptions = OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  (Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> [DarcsFlag])
-> [DarcsFlag] -> [DarcsFlag]
forall (d :: * -> *) f b. OptSpec d f [f] b -> [f] -> [f]
onormalise OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  (Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> [DarcsFlag])
forall a.
DarcsOption
  a
  (Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> a)
injectOpts
    }
  where
    injectBasicOpts :: OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  (Bool -> Maybe String -> DiffAlgorithm -> a)
injectBasicOpts = PrimOptSpec
  DarcsOptDescr DarcsFlag (Maybe String -> DiffAlgorithm -> a) Bool
PrimDarcsOption Bool
O.keepDate PrimOptSpec
  DarcsOptDescr DarcsFlag (Maybe String -> DiffAlgorithm -> a) Bool
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (DiffAlgorithm -> a)
     (Maybe String -> DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (DiffAlgorithm -> a)
     (Bool -> Maybe String -> DiffAlgorithm -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (DiffAlgorithm -> a)
  (Maybe String -> DiffAlgorithm -> a)
PrimDarcsOption (Maybe String)
O.author OptSpec
  DarcsOptDescr
  DarcsFlag
  (DiffAlgorithm -> a)
  (Bool -> Maybe String -> DiffAlgorithm -> a)
-> OptSpec DarcsOptDescr DarcsFlag a (DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     a
     (Bool -> Maybe String -> DiffAlgorithm -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec DarcsOptDescr DarcsFlag a (DiffAlgorithm -> a)
PrimDarcsOption DiffAlgorithm
O.diffAlgorithm
    injectOpts :: DarcsOption
  a
  (Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> a)
injectOpts = OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> a)
  (Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> a)
forall a.
OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  (Bool -> Maybe String -> DiffAlgorithm -> a)
injectBasicOpts OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> a)
  (Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> a)
-> DarcsOption
     (UseCache -> HooksConfig -> a) (UseCache -> HooksConfig -> a)
-> DarcsOption
     a
     (Bool
      -> Maybe String
      -> DiffAlgorithm
      -> Maybe StdCmdAction
      -> Bool
      -> Bool
      -> Verbosity
      -> Bool
      -> UseCache
      -> HooksConfig
      -> a)
forall b c a.
DarcsOption
  (Maybe StdCmdAction -> Bool -> Bool -> Verbosity -> Bool -> b) c
-> DarcsOption (UseCache -> HooksConfig -> a) b -> DarcsOption a c
`withStdOpts` DarcsOption
  (UseCache -> HooksConfig -> a) (UseCache -> HooksConfig -> a)
forall (d :: * -> *) f a. OptSpec d f a a
oid

injectCmd :: (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
injectCmd :: (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
injectCmd _ opts :: [DarcsFlag]
opts _args :: [String]
_args =
    DryRun -> UseCache -> UpdateWorking -> UMask -> RepoJob () -> IO ()
forall a.
DryRun -> UseCache -> UpdateWorking -> UMask -> RepoJob a -> IO a
withRepoLock (PrimDarcsOption DryRun
dryRun PrimDarcsOption DryRun -> [DarcsFlag] -> DryRun
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) (PrimDarcsOption UseCache
useCache PrimDarcsOption UseCache -> [DarcsFlag] -> UseCache
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) UpdateWorking
YesUpdateWorking (PrimDarcsOption UMask
umask PrimDarcsOption UMask -> [DarcsFlag] -> UMask
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) (RepoJob () -> IO ()) -> RepoJob () -> IO ()
forall a b. (a -> b) -> a -> b
$
    RebaseJobFlags
-> (forall (p :: * -> * -> *) wR wU.
    (RepoPatch p, ApplyState p ~ Tree) =>
    Repository ('RepoType 'IsRebase) p wR wU wR -> IO ())
-> RepoJob ()
forall a.
RebaseJobFlags
-> (forall (p :: * -> * -> *) wR wU.
    (RepoPatch p, ApplyState p ~ Tree) =>
    Repository ('RepoType 'IsRebase) p wR wU wR -> IO a)
-> RepoJob a
RebaseJob (Compression -> Verbosity -> UpdateWorking -> RebaseJobFlags
RebaseJobFlags (PrimDarcsOption Compression
compress PrimDarcsOption Compression -> [DarcsFlag] -> Compression
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) (PrimDarcsOption Verbosity
verbosity PrimDarcsOption Verbosity -> [DarcsFlag] -> Verbosity
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) UpdateWorking
YesUpdateWorking) ((forall (p :: * -> * -> *) wR wU.
  (RepoPatch p, ApplyState p ~ Tree) =>
  Repository ('RepoType 'IsRebase) p wR wU wR -> IO ())
 -> RepoJob ())
-> (forall (p :: * -> * -> *) wR wU.
    (RepoPatch p, ApplyState p ~ Tree) =>
    Repository ('RepoType 'IsRebase) p wR wU wR -> IO ())
-> RepoJob ()
forall a b. (a -> b) -> a -> b
$
    \(Repository ('RepoType 'IsRebase) p wR wU wR
repository :: Repository ('RepoType 'IsRebase) p wR wU wR) -> do
    PatchSet ('RepoType 'IsRebase) p Origin wR
patches <- Repository ('RepoType 'IsRebase) p wR wU wR
-> IO (PatchSet ('RepoType 'IsRebase) p Origin wR)
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
(IsRepoType rt, RepoPatch p) =>
Repository rt p wR wU wT -> IO (PatchSet rt p Origin wR)
readRepo Repository ('RepoType 'IsRebase) p wR wU wR
repository

    (rOld :: PatchInfoAnd ('RepoType 'IsRebase) p wR wR
rOld, Items ps :: FL (RebaseItem p) wR wY
ps, _) <- (PatchInfoAnd ('RepoType 'IsRebase) p wR wR, Suspended p wR wR,
 PatchSet ('RepoType 'IsRebase) p Origin wR)
-> IO
     (PatchInfoAnd ('RepoType 'IsRebase) p wR wR, Suspended p wR wR,
      PatchSet ('RepoType 'IsRebase) p Origin wR)
forall (m :: * -> *) a. Monad m => a -> m a
return ((PatchInfoAnd ('RepoType 'IsRebase) p wR wR, Suspended p wR wR,
  PatchSet ('RepoType 'IsRebase) p Origin wR)
 -> IO
      (PatchInfoAnd ('RepoType 'IsRebase) p wR wR, Suspended p wR wR,
       PatchSet ('RepoType 'IsRebase) p Origin wR))
-> (PatchInfoAnd ('RepoType 'IsRebase) p wR wR, Suspended p wR wR,
    PatchSet ('RepoType 'IsRebase) p Origin wR)
-> IO
     (PatchInfoAnd ('RepoType 'IsRebase) p wR wR, Suspended p wR wR,
      PatchSet ('RepoType 'IsRebase) p Origin wR)
forall a b. (a -> b) -> a -> b
$ PatchSet ('RepoType 'IsRebase) p Origin wR
-> (PatchInfoAnd ('RepoType 'IsRebase) p wR wR, Suspended p wR wR,
    PatchSet ('RepoType 'IsRebase) p Origin wR)
forall (p :: * -> * -> *) wA wB.
PatchSet ('RepoType 'IsRebase) p wA wB
-> (PatchInfoAnd ('RepoType 'IsRebase) p wB wB, Suspended p wB wB,
    PatchSet ('RepoType 'IsRebase) p wA wB)
takeHeadRebase PatchSet ('RepoType 'IsRebase) p Origin wR
patches

    let selects :: FL (RebaseSelect p) wR wY
selects = FL (RebaseItem p) wR wY -> FL (RebaseSelect p) wR wY
forall (p :: * -> * -> *) wX wY.
PrimPatchBase p =>
FL (RebaseItem p) wX wY -> FL (RebaseSelect p) wX wY
toRebaseSelect FL (RebaseItem p) wR wY
ps

    -- TODO this selection doesn't need to respect dependencies
    -- TODO we only want to select one patch: generalise withSelectedPatchFromRepo
    let patches_context :: PatchSelectionContext (RebaseSelect p)
patches_context = (forall wX wY.
 RebaseSelect p wX wY
 -> Sealed2 (PatchInfoAnd ('RepoType 'NoRebase) p))
-> WhichChanges
-> String
-> PatchSelectionOptions
-> Maybe [String]
-> PatchSelectionContext (RebaseSelect p)
forall (rt :: RepoType) (p :: * -> * -> *) (q :: * -> * -> *).
(IsRepoType rt, RepoPatch p, Invert q) =>
(forall wX wY. q wX wY -> Sealed2 (PatchInfoAnd rt p))
-> WhichChanges
-> String
-> PatchSelectionOptions
-> Maybe [String]
-> PatchSelectionContext q
selectionContextGeneric forall wX wY.
RebaseSelect p wX wY
-> Sealed2 (PatchInfoAnd ('RepoType 'NoRebase) p)
forall (p :: * -> * -> *) wX wY.
RebaseSelect p wX wY
-> Sealed2 (PatchInfoAnd ('RepoType 'NoRebase) p)
rsToPia WhichChanges
First "inject into" (Bool -> [DarcsFlag] -> PatchSelectionOptions
patchSelOpts Bool
True [DarcsFlag]
opts) Maybe [String]
forall a. Maybe a
Nothing
    (chosens :: FL (RebaseSelect p) wR wZ
chosens :> rest_selects :: FL (RebaseSelect p) wZ wY
rest_selects) <- FL (RebaseSelect p) wR wY
-> PatchSelectionContext (RebaseSelect p)
-> IO ((:>) (FL (RebaseSelect p)) (FL (RebaseSelect p)) wR wY)
forall (p :: * -> * -> *) wX wY.
(Invert p, Commute p, Apply p, PatchInspect p, ShowPatch p,
 ShowContextPatch p, ApplyState p ~ Tree) =>
FL p wX wY
-> PatchSelectionContext p -> IO ((:>) (FL p) (FL p) wX wY)
runSelection FL (RebaseSelect p) wR wY
selects PatchSelectionContext (RebaseSelect p)
patches_context

    let extractSingle :: FL (RebaseSelect p) wX wY -> (FL (RebaseFixup p) :> Named p) wX wY
        extractSingle :: FL (RebaseSelect p) wX wY
-> (:>) (FL (RebaseFixup p)) (Named p) wX wY
extractSingle (RSFwd fixups :: FL (RebaseFixup p) wX wY
fixups toedit :: Named p wY wY
toedit :>: NilFL) = FL (RebaseFixup p) wX wY
fixups FL (RebaseFixup p) wX wY
-> Named p wY wY -> (:>) (FL (RebaseFixup p)) (Named p) wX wY
forall (a1 :: * -> * -> *) (a2 :: * -> * -> *) wX wY wZ.
a1 wX wZ -> a2 wZ wY -> (:>) a1 a2 wX wY
:> Named p wY wY
toedit
        extractSingle (_ :>: NilFL) = (:>) (FL (RebaseFixup p)) (Named p) wX wY
forall a. a
impossible
        extractSingle _ = String -> (:>) (FL (RebaseFixup p)) (Named p) wX wY
forall a. HasCallStack => String -> a
error "You must select precisely one patch!"

    fixups :: FL (RebaseFixup p) wR wZ
fixups :> toedit :: Named p wZ wZ
toedit <- (:>) (FL (RebaseFixup p)) (Named p) wR wZ
-> IO ((:>) (FL (RebaseFixup p)) (Named p) wR wZ)
forall (m :: * -> *) a. Monad m => a -> m a
return ((:>) (FL (RebaseFixup p)) (Named p) wR wZ
 -> IO ((:>) (FL (RebaseFixup p)) (Named p) wR wZ))
-> (:>) (FL (RebaseFixup p)) (Named p) wR wZ
-> IO ((:>) (FL (RebaseFixup p)) (Named p) wR wZ)
forall a b. (a -> b) -> a -> b
$ FL (RebaseSelect p) wR wZ
-> (:>) (FL (RebaseFixup p)) (Named p) wR wZ
forall wX wY.
FL (RebaseSelect p) wX wY
-> (:>) (FL (RebaseFixup p)) (Named p) wX wY
extractSingle FL (RebaseSelect p) wR wZ
chosens

    name_fixups :: FL (RebaseName p) wR wZ
name_fixups :> prim_fixups :: FL (PrimOf p) wZ wZ
prim_fixups <- (:>) (FL (RebaseName p)) (FL (PrimOf p)) wR wZ
-> IO ((:>) (FL (RebaseName p)) (FL (PrimOf p)) wR wZ)
forall (m :: * -> *) a. Monad m => a -> m a
return ((:>) (FL (RebaseName p)) (FL (PrimOf p)) wR wZ
 -> IO ((:>) (FL (RebaseName p)) (FL (PrimOf p)) wR wZ))
-> (:>) (FL (RebaseName p)) (FL (PrimOf p)) wR wZ
-> IO ((:>) (FL (RebaseName p)) (FL (PrimOf p)) wR wZ)
forall a b. (a -> b) -> a -> b
$ FL (RebaseFixup p) wR wZ
-> (:>) (FL (RebaseName p)) (FL (PrimOf p)) wR wZ
forall (p :: * -> * -> *) wX wY.
PrimPatchBase p =>
FL (RebaseFixup p) wX wY
-> (:>) (FL (RebaseName p)) (FL (PrimOf p)) wX wY
flToNamesPrims FL (RebaseFixup p) wR wZ
fixups

    let changes_context :: PatchSelectionContext (PrimOf p)
changes_context = WhichChanges
-> String
-> PatchSelectionOptions
-> Maybe (Splitter (PrimOf p))
-> Maybe [String]
-> Maybe (Tree IO)
-> PatchSelectionContext (PrimOf p)
forall (prim :: * -> * -> *).
WhichChanges
-> String
-> PatchSelectionOptions
-> Maybe (Splitter prim)
-> Maybe [String]
-> Maybe (Tree IO)
-> PatchSelectionContext prim
selectionContextPrim WhichChanges
Last "inject" (Bool -> [DarcsFlag] -> PatchSelectionOptions
patchSelOpts Bool
True [DarcsFlag]
opts) (Splitter (PrimOf p) -> Maybe (Splitter (PrimOf p))
forall a. a -> Maybe a
Just (DiffAlgorithm -> Splitter (PrimOf p)
forall (p :: * -> * -> *).
PrimPatch p =>
DiffAlgorithm -> Splitter p
primSplitter (PrimDarcsOption DiffAlgorithm
diffAlgorithm PrimDarcsOption DiffAlgorithm -> [DarcsFlag] -> DiffAlgorithm
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts))) Maybe [String]
forall a. Maybe a
Nothing Maybe (Tree IO)
forall a. Maybe a
Nothing
    (rest_fixups :: FL (PrimOf p) wZ wZ
rest_fixups :> injects :: FL (PrimOf p) wZ wZ
injects) <- FL (PrimOf p) wZ wZ
-> PatchSelectionContext (PrimOf p)
-> IO ((:>) (FL (PrimOf p)) (FL (PrimOf p)) wZ wZ)
forall (p :: * -> * -> *) wX wY.
(Invert p, Commute p, Apply p, PatchInspect p, ShowPatch p,
 ShowContextPatch p, ApplyState p ~ Tree) =>
FL p wX wY
-> PatchSelectionContext p -> IO ((:>) (FL p) (FL p) wX wY)
runSelection FL (PrimOf p) wZ wZ
prim_fixups PatchSelectionContext (PrimOf p)
changes_context

    Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (FL (PrimOf p) wZ wZ -> Bool
forall (a :: * -> * -> *) wX wZ. FL a wX wZ -> Bool
nullFL FL (PrimOf p) wZ wZ
injects) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ do
        String -> IO ()
putStrLn "No changes selected!"
        IO ()
forall a. IO a
exitSuccess

    -- Don't bother to update patch header since unsuspend will do that later
    let da :: DiffAlgorithm
da = PrimDarcsOption DiffAlgorithm
diffAlgorithm PrimDarcsOption DiffAlgorithm -> [DarcsFlag] -> DiffAlgorithm
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts
        toeditNew :: Named p wZ wZ
toeditNew = (FL p wZ wZ -> FL p wZ wZ) -> Named p wZ wZ -> Named p wZ wZ
forall (p :: * -> * -> *) wA wB (q :: * -> * -> *) wC wD.
(FL p wA wB -> FL q wC wD) -> Named p wA wB -> Named q wC wD
fmapFL_Named ((forall wW wY. PrimOf p wW wY -> p wW wY)
-> FL (PrimOf p) wZ wZ -> FL p wZ wZ
forall (a :: * -> * -> *) (b :: * -> * -> *) wX wZ.
(forall wW wY. a wW wY -> b wW wY) -> FL a wX wZ -> FL b wX wZ
mapFL_FL forall wW wY. PrimOf p wW wY -> p wW wY
forall (p :: * -> * -> *) wX wY.
FromPrim p =>
PrimOf p wX wY -> p wX wY
fromPrim (FL (PrimOf p) wZ wZ -> FL p wZ wZ)
-> (FL p wZ wZ -> FL (PrimOf p) wZ wZ) -> FL p wZ wZ -> FL p wZ wZ
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DiffAlgorithm -> FL (PrimOf p) wZ wZ -> FL (PrimOf p) wZ wZ
forall (prim :: * -> * -> *) wX wY.
PrimCanonize prim =>
DiffAlgorithm -> FL prim wX wY -> FL prim wX wY
canonizeFL DiffAlgorithm
da (FL (PrimOf p) wZ wZ -> FL (PrimOf p) wZ wZ)
-> (FL p wZ wZ -> FL (PrimOf p) wZ wZ)
-> FL p wZ wZ
-> FL (PrimOf p) wZ wZ
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (FL (PrimOf p) wZ wZ
injects FL (PrimOf p) wZ wZ -> FL (PrimOf p) wZ wZ -> FL (PrimOf p) wZ wZ
forall (a :: * -> * -> *) wX wY wZ.
FL a wX wY -> FL a wY wZ -> FL a wX wZ
+>+) (FL (PrimOf p) wZ wZ -> FL (PrimOf p) wZ wZ)
-> (FL p wZ wZ -> FL (PrimOf p) wZ wZ)
-> FL p wZ wZ
-> FL (PrimOf p) wZ wZ
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FL p wZ wZ -> FL (PrimOf p) wZ wZ
forall (p :: * -> * -> *) wX wY.
Effect p =>
p wX wY -> FL (PrimOf p) wX wY
effect) Named p wZ wZ
toedit
    WrappedNamed ('RepoType 'IsRebase) p wR wR
rNew <- (forall wX.
 FL (RebaseItem p) wR wX
 -> IO (WrappedNamed ('RepoType 'IsRebase) p wR wR))
-> Sealed (FL (RebaseItem p) wR)
-> IO (WrappedNamed ('RepoType 'IsRebase) p wR wR)
forall (a :: * -> *) b. (forall wX. a wX -> b) -> Sealed a -> b
unseal (Suspended p wR wR
-> IO (WrappedNamed ('RepoType 'IsRebase) p wR wR)
forall (p :: * -> * -> *) wX.
(PrimPatchBase p, FromPrim p, Effect p) =>
Suspended p wX wX
-> IO (WrappedNamed ('RepoType 'IsRebase) p wX wX)
mkRebase (Suspended p wR wR
 -> IO (WrappedNamed ('RepoType 'IsRebase) p wR wR))
-> (FL (RebaseItem p) wR wX -> Suspended p wR wR)
-> FL (RebaseItem p) wR wX
-> IO (WrappedNamed ('RepoType 'IsRebase) p wR wR)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FL (RebaseItem p) wR wX -> Suspended p wR wR
forall (p :: * -> * -> *) wX wY.
FL (RebaseItem p) wX wY -> Suspended p wX wX
Items)
                               (Sealed (FL (RebaseItem p) wR)
 -> IO (WrappedNamed ('RepoType 'IsRebase) p wR wR))
-> Sealed (FL (RebaseItem p) wR)
-> IO (WrappedNamed ('RepoType 'IsRebase) p wR wR)
forall a b. (a -> b) -> a -> b
$ (forall wX.
 FL (RebaseItem p) wZ wX -> Sealed (FL (RebaseItem p) wR))
-> Sealed (FL (RebaseItem p) wZ) -> Sealed (FL (RebaseItem p) wR)
forall (a :: * -> *) b. (forall wX. a wX -> b) -> Sealed a -> b
unseal (DiffAlgorithm
-> FL (RebaseFixup p) wR wZ
-> FL (RebaseItem p) wZ wX
-> Sealed (FL (RebaseItem p) wR)
forall (p :: * -> * -> *) wX wY wZ.
(PrimPatchBase p, Commute p, FromPrim p, Effect p) =>
DiffAlgorithm
-> FL (RebaseFixup p) wX wY
-> FL (RebaseItem p) wY wZ
-> Sealed (FL (RebaseItem p) wX)
simplifyPushes DiffAlgorithm
da ((forall wW wY. RebaseName p wW wY -> RebaseFixup p wW wY)
-> FL (RebaseName p) wR wZ -> FL (RebaseFixup p) wR wZ
forall (a :: * -> * -> *) (b :: * -> * -> *) wX wZ.
(forall wW wY. a wW wY -> b wW wY) -> FL a wX wZ -> FL b wX wZ
mapFL_FL forall wW wY. RebaseName p wW wY -> RebaseFixup p wW wY
forall (p :: * -> * -> *) wX wY.
RebaseName p wX wY -> RebaseFixup p wX wY
NameFixup FL (RebaseName p) wR wZ
name_fixups))
                               (Sealed (FL (RebaseItem p) wZ) -> Sealed (FL (RebaseItem p) wR))
-> Sealed (FL (RebaseItem p) wZ) -> Sealed (FL (RebaseItem p) wR)
forall a b. (a -> b) -> a -> b
$ DiffAlgorithm
-> FL (RebaseFixup p) wZ wZ
-> FL (RebaseItem p) wZ wY
-> Sealed (FL (RebaseItem p) wZ)
forall (p :: * -> * -> *) wX wY wZ.
(PrimPatchBase p, Commute p, FromPrim p, Effect p) =>
DiffAlgorithm
-> FL (RebaseFixup p) wX wY
-> FL (RebaseItem p) wY wZ
-> Sealed (FL (RebaseItem p) wX)
simplifyPushes DiffAlgorithm
da ((forall wW wY. PrimOf p wW wY -> RebaseFixup p wW wY)
-> FL (PrimOf p) wZ wZ -> FL (RebaseFixup p) wZ wZ
forall (a :: * -> * -> *) (b :: * -> * -> *) wX wZ.
(forall wW wY. a wW wY -> b wW wY) -> FL a wX wZ -> FL b wX wZ
mapFL_FL forall wW wY. PrimOf p wW wY -> RebaseFixup p wW wY
forall (p :: * -> * -> *) wX wY.
PrimPatch (PrimOf p) =>
PrimOf p wX wY -> RebaseFixup p wX wY
PrimFixup FL (PrimOf p) wZ wZ
rest_fixups)
                               (FL (RebaseItem p) wZ wY -> Sealed (FL (RebaseItem p) wZ))
-> FL (RebaseItem p) wZ wY -> Sealed (FL (RebaseItem p) wZ)
forall a b. (a -> b) -> a -> b
$ Named p wZ wZ -> RebaseItem p wZ wZ
forall (p :: * -> * -> *) wX wY.
Named p wX wY -> RebaseItem p wX wY
ToEdit Named p wZ wZ
toeditNew RebaseItem p wZ wZ
-> FL (RebaseItem p) wZ wY -> FL (RebaseItem p) wZ wY
forall (a :: * -> * -> *) wX wY wZ.
a wX wY -> FL a wY wZ -> FL a wX wZ
:>: FL (RebaseSelect p) wZ wY -> FL (RebaseItem p) wZ wY
forall (p :: * -> * -> *) wX wY.
FL (RebaseSelect p) wX wY -> FL (RebaseItem p) wX wY
fromRebaseSelect FL (RebaseSelect p) wZ wY
rest_selects

    Repository ('RepoType 'IsRebase) p wR wU wR
repository' <- Repository ('RepoType 'IsRebase) p wR wU wR
-> Compression
-> UpdateWorking
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wR wR
-> IO (Repository ('RepoType 'IsRebase) p wR wU wR)
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT wX.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wT
-> Compression
-> UpdateWorking
-> FL (PatchInfoAnd rt p) wX wT
-> IO (Repository rt p wR wU wX)
tentativelyRemovePatches Repository ('RepoType 'IsRebase) p wR wU wR
repository (PrimDarcsOption Compression
compress PrimDarcsOption Compression -> [DarcsFlag] -> Compression
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) UpdateWorking
YesUpdateWorking (PatchInfoAnd ('RepoType 'IsRebase) p wR wR
rOld PatchInfoAnd ('RepoType 'IsRebase) p wR wR
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wR wR
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wR wR
forall (a :: * -> * -> *) wX wY wZ.
a wX wY -> FL a wY wZ -> FL a wX wZ
:>: FL (PatchInfoAnd ('RepoType 'IsRebase) p) wR wR
forall (a :: * -> * -> *) wX. FL a wX wX
NilFL)
    Repository ('RepoType 'IsRebase) p wR wU wR
repository'' <- Repository ('RepoType 'IsRebase) p wR wU wR
-> Compression
-> Verbosity
-> UpdateWorking
-> PatchInfoAnd ('RepoType 'IsRebase) p wR wR
-> IO (Repository ('RepoType 'IsRebase) p wR wU wR)
forall (p :: * -> * -> *) (rt :: RepoType) wR wU wT wY.
(RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wT
-> Compression
-> Verbosity
-> UpdateWorking
-> PatchInfoAnd rt p wT wY
-> IO (Repository rt p wR wU wY)
tentativelyAddPatch Repository ('RepoType 'IsRebase) p wR wU wR
repository' (PrimDarcsOption Compression
compress PrimDarcsOption Compression -> [DarcsFlag] -> Compression
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) (PrimDarcsOption Verbosity
verbosity PrimDarcsOption Verbosity -> [DarcsFlag] -> Verbosity
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) UpdateWorking
YesUpdateWorking (WrappedNamed ('RepoType 'IsRebase) p wR wR
-> PatchInfoAnd ('RepoType 'IsRebase) p wR wR
forall (rt :: RepoType) (p :: * -> * -> *) wX wY.
WrappedNamed rt p wX wY -> PatchInfoAnd rt p wX wY
n2pia WrappedNamed ('RepoType 'IsRebase) p wR wR
rNew)
    Repository ('RepoType 'IsRebase) p wR wU wR
-> UpdateWorking -> Compression -> IO ()
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wT -> UpdateWorking -> Compression -> IO ()
finalizeRepositoryChanges Repository ('RepoType 'IsRebase) p wR wU wR
repository'' UpdateWorking
YesUpdateWorking (PrimDarcsOption Compression
compress PrimDarcsOption Compression -> [DarcsFlag] -> Compression
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts)
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

obliterate :: DarcsCommand [DarcsFlag]
obliterate :: DarcsCommand [DarcsFlag]
obliterate = DarcsCommand :: forall parsedFlags.
String
-> String
-> String
-> String
-> Int
-> [String]
-> ((AbsolutePath, AbsolutePath)
    -> parsedFlags -> [String] -> IO ())
-> ([DarcsFlag] -> IO (Either String ()))
-> ((AbsolutePath, AbsolutePath)
    -> [DarcsFlag] -> [String] -> IO [String])
-> ([DarcsFlag] -> AbsolutePath -> [String] -> IO [String])
-> [DarcsOptDescr DarcsFlag]
-> [DarcsOptDescr DarcsFlag]
-> [DarcsFlag]
-> ([DarcsFlag] -> [String])
-> ([DarcsFlag] -> parsedFlags)
-> DarcsCommand parsedFlags
DarcsCommand
    { commandProgramName :: String
commandProgramName = "darcs"
    , commandName :: String
commandName = "obliterate"
    , commandHelp :: String
commandHelp = "Obliterate a patch that is currently suspended.\n"
    , commandDescription :: String
commandDescription = "Obliterate a patch that is currently suspended.\n"
    , commandPrereq :: [DarcsFlag] -> IO (Either String ())
commandPrereq = [DarcsFlag] -> IO (Either String ())
amInHashedRepository
    , commandExtraArgs :: Int
commandExtraArgs = 0
    , commandExtraArgHelp :: [String]
commandExtraArgHelp = []
    , commandCommand :: (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
commandCommand = (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
obliterateCmd
    , commandCompleteArgs :: (AbsolutePath, AbsolutePath)
-> [DarcsFlag] -> [String] -> IO [String]
commandCompleteArgs = (AbsolutePath, AbsolutePath)
-> [DarcsFlag] -> [String] -> IO [String]
noArgs
    , commandArgdefaults :: [DarcsFlag] -> AbsolutePath -> [String] -> IO [String]
commandArgdefaults = [DarcsFlag] -> AbsolutePath -> [String] -> IO [String]
nodefaults
    , commandAdvancedOptions :: [DarcsOptDescr DarcsFlag]
commandAdvancedOptions = []
    , commandBasicOptions :: [DarcsOptDescr DarcsFlag]
commandBasicOptions = OptSpec DarcsOptDescr DarcsFlag Any (DiffAlgorithm -> Any)
-> [DarcsOptDescr DarcsFlag]
forall (d :: * -> *) f a b. OptSpec d f a b -> [d f]
odesc OptSpec DarcsOptDescr DarcsFlag Any (DiffAlgorithm -> Any)
PrimDarcsOption DiffAlgorithm
obliterateBasicOpts
    , commandDefaults :: [DarcsFlag]
commandDefaults = OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  (DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> [DarcsFlag])
-> [DarcsFlag]
forall (d :: * -> *) f b. OptSpec d f [f] b -> [f]
defaultFlags OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  (DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> [DarcsFlag])
forall a.
DarcsOption
  a
  (DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> a)
obliterateOpts
    , commandCheckOptions :: [DarcsFlag] -> [String]
commandCheckOptions = OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  (DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> Any)
-> [DarcsFlag] -> [String]
forall (d :: * -> *) f a b. OptSpec d f a b -> [f] -> [String]
ocheck OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  (DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> Any)
forall a.
DarcsOption
  a
  (DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> a)
obliterateOpts
    , commandParseOptions :: [DarcsFlag] -> [DarcsFlag]
commandParseOptions = OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  (DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> [DarcsFlag])
-> [DarcsFlag] -> [DarcsFlag]
forall (d :: * -> *) f b. OptSpec d f [f] b -> [f] -> [f]
onormalise OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  (DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> [DarcsFlag])
forall a.
DarcsOption
  a
  (DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> a)
obliterateOpts
    }
  where
    obliterateBasicOpts :: PrimOptSpec DarcsOptDescr DarcsFlag a DiffAlgorithm
obliterateBasicOpts = PrimOptSpec DarcsOptDescr DarcsFlag a DiffAlgorithm
PrimDarcsOption DiffAlgorithm
O.diffAlgorithm
    obliterateOpts :: DarcsOption
  a
  (DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> a)
obliterateOpts = PrimOptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> a)
  DiffAlgorithm
PrimDarcsOption DiffAlgorithm
obliterateBasicOpts PrimOptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> a)
  DiffAlgorithm
-> DarcsOption
     (UseCache -> HooksConfig -> a) (UseCache -> HooksConfig -> a)
-> DarcsOption
     a
     (DiffAlgorithm
      -> Maybe StdCmdAction
      -> Bool
      -> Bool
      -> Verbosity
      -> Bool
      -> UseCache
      -> HooksConfig
      -> a)
forall b c a.
DarcsOption
  (Maybe StdCmdAction -> Bool -> Bool -> Verbosity -> Bool -> b) c
-> DarcsOption (UseCache -> HooksConfig -> a) b -> DarcsOption a c
`withStdOpts` DarcsOption
  (UseCache -> HooksConfig -> a) (UseCache -> HooksConfig -> a)
forall (d :: * -> *) f a. OptSpec d f a a
oid

obliterateCmd :: (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
obliterateCmd :: (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
obliterateCmd _ opts :: [DarcsFlag]
opts _args :: [String]
_args =
    DryRun -> UseCache -> UpdateWorking -> UMask -> RepoJob () -> IO ()
forall a.
DryRun -> UseCache -> UpdateWorking -> UMask -> RepoJob a -> IO a
withRepoLock (PrimDarcsOption DryRun
dryRun PrimDarcsOption DryRun -> [DarcsFlag] -> DryRun
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) (PrimDarcsOption UseCache
useCache PrimDarcsOption UseCache -> [DarcsFlag] -> UseCache
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) UpdateWorking
YesUpdateWorking (PrimDarcsOption UMask
umask PrimDarcsOption UMask -> [DarcsFlag] -> UMask
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) (RepoJob () -> IO ()) -> RepoJob () -> IO ()
forall a b. (a -> b) -> a -> b
$
    RebaseJobFlags
-> (forall (p :: * -> * -> *) wR wU.
    (RepoPatch p, ApplyState p ~ Tree) =>
    Repository ('RepoType 'IsRebase) p wR wU wR -> IO ())
-> RepoJob ()
forall a.
RebaseJobFlags
-> (forall (p :: * -> * -> *) wR wU.
    (RepoPatch p, ApplyState p ~ Tree) =>
    Repository ('RepoType 'IsRebase) p wR wU wR -> IO a)
-> RepoJob a
RebaseJob (Compression -> Verbosity -> UpdateWorking -> RebaseJobFlags
RebaseJobFlags (PrimDarcsOption Compression
compress PrimDarcsOption Compression -> [DarcsFlag] -> Compression
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) (PrimDarcsOption Verbosity
verbosity PrimDarcsOption Verbosity -> [DarcsFlag] -> Verbosity
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) UpdateWorking
YesUpdateWorking) ((forall (p :: * -> * -> *) wR wU.
  (RepoPatch p, ApplyState p ~ Tree) =>
  Repository ('RepoType 'IsRebase) p wR wU wR -> IO ())
 -> RepoJob ())
-> (forall (p :: * -> * -> *) wR wU.
    (RepoPatch p, ApplyState p ~ Tree) =>
    Repository ('RepoType 'IsRebase) p wR wU wR -> IO ())
-> RepoJob ()
forall a b. (a -> b) -> a -> b
$
    \(Repository ('RepoType 'IsRebase) p wR wU wR
repository :: Repository ('RepoType 'IsRebase) p wR wU wR) -> (do
    PatchSet ('RepoType 'IsRebase) p Origin wR
patches <- Repository ('RepoType 'IsRebase) p wR wU wR
-> IO (PatchSet ('RepoType 'IsRebase) p Origin wR)
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
(IsRepoType rt, RepoPatch p) =>
Repository rt p wR wU wT -> IO (PatchSet rt p Origin wR)
readRepo Repository ('RepoType 'IsRebase) p wR wU wR
repository

    (rOld :: PatchInfoAnd ('RepoType 'IsRebase) p wR wR
rOld, Items ps :: FL (RebaseItem p) wR wY
ps, _) <- (PatchInfoAnd ('RepoType 'IsRebase) p wR wR, Suspended p wR wR,
 PatchSet ('RepoType 'IsRebase) p Origin wR)
-> IO
     (PatchInfoAnd ('RepoType 'IsRebase) p wR wR, Suspended p wR wR,
      PatchSet ('RepoType 'IsRebase) p Origin wR)
forall (m :: * -> *) a. Monad m => a -> m a
return ((PatchInfoAnd ('RepoType 'IsRebase) p wR wR, Suspended p wR wR,
  PatchSet ('RepoType 'IsRebase) p Origin wR)
 -> IO
      (PatchInfoAnd ('RepoType 'IsRebase) p wR wR, Suspended p wR wR,
       PatchSet ('RepoType 'IsRebase) p Origin wR))
-> (PatchInfoAnd ('RepoType 'IsRebase) p wR wR, Suspended p wR wR,
    PatchSet ('RepoType 'IsRebase) p Origin wR)
-> IO
     (PatchInfoAnd ('RepoType 'IsRebase) p wR wR, Suspended p wR wR,
      PatchSet ('RepoType 'IsRebase) p Origin wR)
forall a b. (a -> b) -> a -> b
$ PatchSet ('RepoType 'IsRebase) p Origin wR
-> (PatchInfoAnd ('RepoType 'IsRebase) p wR wR, Suspended p wR wR,
    PatchSet ('RepoType 'IsRebase) p Origin wR)
forall (p :: * -> * -> *) wA wB.
PatchSet ('RepoType 'IsRebase) p wA wB
-> (PatchInfoAnd ('RepoType 'IsRebase) p wB wB, Suspended p wB wB,
    PatchSet ('RepoType 'IsRebase) p wA wB)
takeHeadRebase PatchSet ('RepoType 'IsRebase) p Origin wR
patches

    let selects :: FL (RebaseSelect p) wR wY
selects = FL (RebaseItem p) wR wY -> FL (RebaseSelect p) wR wY
forall (p :: * -> * -> *) wX wY.
PrimPatchBase p =>
FL (RebaseItem p) wX wY -> FL (RebaseSelect p) wX wY
toRebaseSelect FL (RebaseItem p) wR wY
ps

    -- TODO this selection doesn't need to respect dependencies
    let patches_context :: PatchSelectionContext (RebaseSelect p)
patches_context = (forall wX wY.
 RebaseSelect p wX wY
 -> Sealed2 (PatchInfoAnd ('RepoType 'NoRebase) p))
-> WhichChanges
-> String
-> PatchSelectionOptions
-> Maybe [String]
-> PatchSelectionContext (RebaseSelect p)
forall (rt :: RepoType) (p :: * -> * -> *) (q :: * -> * -> *).
(IsRepoType rt, RepoPatch p, Invert q) =>
(forall wX wY. q wX wY -> Sealed2 (PatchInfoAnd rt p))
-> WhichChanges
-> String
-> PatchSelectionOptions
-> Maybe [String]
-> PatchSelectionContext q
selectionContextGeneric forall wX wY.
RebaseSelect p wX wY
-> Sealed2 (PatchInfoAnd ('RepoType 'NoRebase) p)
forall (p :: * -> * -> *) wX wY.
RebaseSelect p wX wY
-> Sealed2 (PatchInfoAnd ('RepoType 'NoRebase) p)
rsToPia WhichChanges
First "obliterate" ([DarcsFlag] -> PatchSelectionOptions
obliteratePatchSelOpts [DarcsFlag]
opts) Maybe [String]
forall a. Maybe a
Nothing
    (chosen :: FL (RebaseSelect p) wR wZ
chosen :> keep :: FL (RebaseSelect p) wZ wY
keep) <- FL (RebaseSelect p) wR wY
-> PatchSelectionContext (RebaseSelect p)
-> IO ((:>) (FL (RebaseSelect p)) (FL (RebaseSelect p)) wR wY)
forall (p :: * -> * -> *) wX wY.
(Invert p, Commute p, Apply p, PatchInspect p, ShowPatch p,
 ShowContextPatch p, ApplyState p ~ Tree) =>
FL p wX wY
-> PatchSelectionContext p -> IO ((:>) (FL p) (FL p) wX wY)
runSelection FL (RebaseSelect p) wR wY
selects PatchSelectionContext (RebaseSelect p)
patches_context
    Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (FL (RebaseSelect p) wR wZ -> Bool
forall (a :: * -> * -> *) wX wZ. FL a wX wZ -> Bool
nullFL FL (RebaseSelect p) wR wZ
chosen) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ do String -> IO ()
putStrLn "No patches selected!"
                              IO ()
forall a. IO a
exitSuccess

    let da :: DiffAlgorithm
da = PrimDarcsOption DiffAlgorithm
diffAlgorithm PrimDarcsOption DiffAlgorithm -> [DarcsFlag] -> DiffAlgorithm
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts
        do_obliterate :: FL (RebaseItem p) wX wY -> FL (RebaseItem p) wY wZ -> Sealed (FL (RebaseItem p) wX)
        do_obliterate :: FL (RebaseItem p) wX wY
-> FL (RebaseItem p) wY wZ -> Sealed (FL (RebaseItem p) wX)
do_obliterate NilFL = FL (RebaseItem p) wY wZ -> Sealed (FL (RebaseItem p) wX)
forall (a :: * -> *) wX. a wX -> Sealed a
Sealed
        do_obliterate (Fixup f :: RebaseFixup p wX wY
f :>: qs :: FL (RebaseItem p) wY wY
qs) = (forall wX.
 FL (RebaseItem p) wY wX -> Sealed (FL (RebaseItem p) wX))
-> Sealed (FL (RebaseItem p) wY) -> Sealed (FL (RebaseItem p) wX)
forall (a :: * -> *) b. (forall wX. a wX -> b) -> Sealed a -> b
unseal (DiffAlgorithm
-> RebaseFixup p wX wY
-> FL (RebaseItem p) wY wX
-> Sealed (FL (RebaseItem p) wX)
forall (p :: * -> * -> *) wX wY wZ.
(PrimPatchBase p, Commute p, FromPrim p, Effect p) =>
DiffAlgorithm
-> RebaseFixup p wX wY
-> FL (RebaseItem p) wY wZ
-> Sealed (FL (RebaseItem p) wX)
simplifyPush DiffAlgorithm
da RebaseFixup p wX wY
f) (Sealed (FL (RebaseItem p) wY) -> Sealed (FL (RebaseItem p) wX))
-> (FL (RebaseItem p) wY wZ -> Sealed (FL (RebaseItem p) wY))
-> FL (RebaseItem p) wY wZ
-> Sealed (FL (RebaseItem p) wX)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FL (RebaseItem p) wY wY
-> FL (RebaseItem p) wY wZ -> Sealed (FL (RebaseItem p) wY)
forall wX wY wZ.
FL (RebaseItem p) wX wY
-> FL (RebaseItem p) wY wZ -> Sealed (FL (RebaseItem p) wX)
do_obliterate FL (RebaseItem p) wY wY
qs
        do_obliterate (ToEdit e :: Named p wX wY
e :>: qs :: FL (RebaseItem p) wY wY
qs) = -- since Named doesn't have any witness context for the
                                          -- patch names, the AddName here will be inferred to be wX wX
                                          (forall wX.
 FL (RebaseItem p) wX wX -> Sealed (FL (RebaseItem p) wX))
-> Sealed (FL (RebaseItem p) wX) -> Sealed (FL (RebaseItem p) wX)
forall (a :: * -> *) b. (forall wX. a wX -> b) -> Sealed a -> b
unseal (DiffAlgorithm
-> RebaseFixup p wX wX
-> FL (RebaseItem p) wX wX
-> Sealed (FL (RebaseItem p) wX)
forall (p :: * -> * -> *) wX wY wZ.
(PrimPatchBase p, Commute p, FromPrim p, Effect p) =>
DiffAlgorithm
-> RebaseFixup p wX wY
-> FL (RebaseItem p) wY wZ
-> Sealed (FL (RebaseItem p) wX)
simplifyPush DiffAlgorithm
da (RebaseName p wX wX -> RebaseFixup p wX wX
forall (p :: * -> * -> *) wX wY.
RebaseName p wX wY -> RebaseFixup p wX wY
NameFixup (PatchInfo -> RebaseName p wX wX
forall (p :: * -> * -> *) wX wY. PatchInfo -> RebaseName p wX wY
AddName (Named p wX wY -> PatchInfo
forall (p :: * -> * -> *) wX wY. Named p wX wY -> PatchInfo
patch2patchinfo Named p wX wY
e)))) (Sealed (FL (RebaseItem p) wX) -> Sealed (FL (RebaseItem p) wX))
-> (FL (RebaseItem p) wY wZ -> Sealed (FL (RebaseItem p) wX))
-> FL (RebaseItem p) wY wZ
-> Sealed (FL (RebaseItem p) wX)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
                                          (forall wX.
 FL (RebaseItem p) wY wX -> Sealed (FL (RebaseItem p) wX))
-> Sealed (FL (RebaseItem p) wY) -> Sealed (FL (RebaseItem p) wX)
forall (a :: * -> *) b. (forall wX. a wX -> b) -> Sealed a -> b
unseal (DiffAlgorithm
-> FL (RebaseFixup p) wX wY
-> FL (RebaseItem p) wY wX
-> Sealed (FL (RebaseItem p) wX)
forall (p :: * -> * -> *) wX wY wZ.
(PrimPatchBase p, Commute p, FromPrim p, Effect p) =>
DiffAlgorithm
-> FL (RebaseFixup p) wX wY
-> FL (RebaseItem p) wY wZ
-> Sealed (FL (RebaseItem p) wX)
simplifyPushes DiffAlgorithm
da ((forall wW wY. PrimOf p wW wY -> RebaseFixup p wW wY)
-> FL (PrimOf p) wX wY -> FL (RebaseFixup p) wX wY
forall (a :: * -> * -> *) (b :: * -> * -> *) wX wZ.
(forall wW wY. a wW wY -> b wW wY) -> FL a wX wZ -> FL b wX wZ
mapFL_FL forall wW wY. PrimOf p wW wY -> RebaseFixup p wW wY
forall (p :: * -> * -> *) wX wY.
PrimPatch (PrimOf p) =>
PrimOf p wX wY -> RebaseFixup p wX wY
PrimFixup (FL p wX wY -> FL (PrimOf (FL p)) wX wY
forall (p :: * -> * -> *) wX wY.
Effect p =>
p wX wY -> FL (PrimOf p) wX wY
effect (Named p wX wY -> FL p wX wY
forall (p :: * -> * -> *) wX wY. Named p wX wY -> FL p wX wY
patchcontents Named p wX wY
e)))) (Sealed (FL (RebaseItem p) wY) -> Sealed (FL (RebaseItem p) wX))
-> (FL (RebaseItem p) wY wZ -> Sealed (FL (RebaseItem p) wY))
-> FL (RebaseItem p) wY wZ
-> Sealed (FL (RebaseItem p) wX)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
                                          FL (RebaseItem p) wY wY
-> FL (RebaseItem p) wY wZ -> Sealed (FL (RebaseItem p) wY)
forall wX wY wZ.
FL (RebaseItem p) wX wY
-> FL (RebaseItem p) wY wZ -> Sealed (FL (RebaseItem p) wX)
do_obliterate FL (RebaseItem p) wY wY
qs

    let ps_to_keep :: Sealed (FL (RebaseItem p) wR)
ps_to_keep = FL (RebaseItem p) wR wZ
-> FL (RebaseItem p) wZ wY -> Sealed (FL (RebaseItem p) wR)
forall wX wY wZ.
FL (RebaseItem p) wX wY
-> FL (RebaseItem p) wY wZ -> Sealed (FL (RebaseItem p) wX)
do_obliterate (FL (RebaseSelect p) wR wZ -> FL (RebaseItem p) wR wZ
forall (p :: * -> * -> *) wX wY.
FL (RebaseSelect p) wX wY -> FL (RebaseItem p) wX wY
fromRebaseSelect FL (RebaseSelect p) wR wZ
chosen) (FL (RebaseSelect p) wZ wY -> FL (RebaseItem p) wZ wY
forall (p :: * -> * -> *) wX wY.
FL (RebaseSelect p) wX wY -> FL (RebaseItem p) wX wY
fromRebaseSelect FL (RebaseSelect p) wZ wY
keep)
    WrappedNamed ('RepoType 'IsRebase) p wR wR
rNew <- (forall wX.
 FL (RebaseItem p) wR wX
 -> IO (WrappedNamed ('RepoType 'IsRebase) p wR wR))
-> Sealed (FL (RebaseItem p) wR)
-> IO (WrappedNamed ('RepoType 'IsRebase) p wR wR)
forall (a :: * -> *) b. (forall wX. a wX -> b) -> Sealed a -> b
unseal (Suspended p wR wR
-> IO (WrappedNamed ('RepoType 'IsRebase) p wR wR)
forall (p :: * -> * -> *) wX.
(PrimPatchBase p, FromPrim p, Effect p) =>
Suspended p wX wX
-> IO (WrappedNamed ('RepoType 'IsRebase) p wX wX)
mkRebase (Suspended p wR wR
 -> IO (WrappedNamed ('RepoType 'IsRebase) p wR wR))
-> (FL (RebaseItem p) wR wX -> Suspended p wR wR)
-> FL (RebaseItem p) wR wX
-> IO (WrappedNamed ('RepoType 'IsRebase) p wR wR)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FL (RebaseItem p) wR wX -> Suspended p wR wR
forall (p :: * -> * -> *) wX wY.
FL (RebaseItem p) wX wY -> Suspended p wX wX
Items) Sealed (FL (RebaseItem p) wR)
ps_to_keep

    Repository ('RepoType 'IsRebase) p wR wU wR
repository' <- Repository ('RepoType 'IsRebase) p wR wU wR
-> Compression
-> UpdateWorking
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wR wR
-> IO (Repository ('RepoType 'IsRebase) p wR wU wR)
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT wX.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wT
-> Compression
-> UpdateWorking
-> FL (PatchInfoAnd rt p) wX wT
-> IO (Repository rt p wR wU wX)
tentativelyRemovePatches Repository ('RepoType 'IsRebase) p wR wU wR
repository (PrimDarcsOption Compression
compress PrimDarcsOption Compression -> [DarcsFlag] -> Compression
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) UpdateWorking
YesUpdateWorking (PatchInfoAnd ('RepoType 'IsRebase) p wR wR
rOld PatchInfoAnd ('RepoType 'IsRebase) p wR wR
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wR wR
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wR wR
forall (a :: * -> * -> *) wX wY wZ.
a wX wY -> FL a wY wZ -> FL a wX wZ
:>: FL (PatchInfoAnd ('RepoType 'IsRebase) p) wR wR
forall (a :: * -> * -> *) wX. FL a wX wX
NilFL)
    Repository ('RepoType 'IsRebase) p wR wU wR
repository'' <- Repository ('RepoType 'IsRebase) p wR wU wR
-> Compression
-> Verbosity
-> UpdateWorking
-> PatchInfoAnd ('RepoType 'IsRebase) p wR wR
-> IO (Repository ('RepoType 'IsRebase) p wR wU wR)
forall (p :: * -> * -> *) (rt :: RepoType) wR wU wT wY.
(RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wT
-> Compression
-> Verbosity
-> UpdateWorking
-> PatchInfoAnd rt p wT wY
-> IO (Repository rt p wR wU wY)
tentativelyAddPatch Repository ('RepoType 'IsRebase) p wR wU wR
repository' (PrimDarcsOption Compression
compress PrimDarcsOption Compression -> [DarcsFlag] -> Compression
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) (PrimDarcsOption Verbosity
verbosity PrimDarcsOption Verbosity -> [DarcsFlag] -> Verbosity
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) UpdateWorking
YesUpdateWorking (WrappedNamed ('RepoType 'IsRebase) p wR wR
-> PatchInfoAnd ('RepoType 'IsRebase) p wR wR
forall (rt :: RepoType) (p :: * -> * -> *) wX wY.
WrappedNamed rt p wX wY -> PatchInfoAnd rt p wX wY
n2pia WrappedNamed ('RepoType 'IsRebase) p wR wR
rNew)
    Repository ('RepoType 'IsRebase) p wR wU wR
-> UpdateWorking -> Compression -> IO ()
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wT -> UpdateWorking -> Compression -> IO ()
finalizeRepositoryChanges Repository ('RepoType 'IsRebase) p wR wU wR
repository'' UpdateWorking
YesUpdateWorking (PrimDarcsOption Compression
compress PrimDarcsOption Compression -> [DarcsFlag] -> Compression
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts)
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
   ) :: IO ()


pullDescription :: String
pullDescription :: String
pullDescription =
 "Copy and apply patches from another repository, suspending any local patches that conflict."

pullHelp :: String
pullHelp :: String
pullHelp =
 "Copy and apply patches from another repository, suspending any local patches that conflict."

pull :: DarcsCommand [DarcsFlag]
pull :: DarcsCommand [DarcsFlag]
pull = DarcsCommand :: forall parsedFlags.
String
-> String
-> String
-> String
-> Int
-> [String]
-> ((AbsolutePath, AbsolutePath)
    -> parsedFlags -> [String] -> IO ())
-> ([DarcsFlag] -> IO (Either String ()))
-> ((AbsolutePath, AbsolutePath)
    -> [DarcsFlag] -> [String] -> IO [String])
-> ([DarcsFlag] -> AbsolutePath -> [String] -> IO [String])
-> [DarcsOptDescr DarcsFlag]
-> [DarcsOptDescr DarcsFlag]
-> [DarcsFlag]
-> ([DarcsFlag] -> [String])
-> ([DarcsFlag] -> parsedFlags)
-> DarcsCommand parsedFlags
DarcsCommand
    { commandProgramName :: String
commandProgramName = "darcs"
    , commandName :: String
commandName = "pull"
    , commandHelp :: String
commandHelp = String
pullHelp
    , commandDescription :: String
commandDescription = String
pullDescription
    , commandExtraArgs :: Int
commandExtraArgs = -1
    , commandExtraArgHelp :: [String]
commandExtraArgHelp = ["[REPOSITORY]..."]
    , commandCommand :: (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
commandCommand = RebasePatchApplier
-> (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
forall pa.
PatchApplier pa =>
pa
-> (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
pullCmd RebasePatchApplier
RebasePatchApplier
    , commandPrereq :: [DarcsFlag] -> IO (Either String ())
commandPrereq = [DarcsFlag] -> IO (Either String ())
amInHashedRepository
    , commandCompleteArgs :: (AbsolutePath, AbsolutePath)
-> [DarcsFlag] -> [String] -> IO [String]
commandCompleteArgs = String
-> (AbsolutePath, AbsolutePath)
-> [DarcsFlag]
-> [String]
-> IO [String]
prefArgs "repos"
    , commandArgdefaults :: [DarcsFlag] -> AbsolutePath -> [String] -> IO [String]
commandArgdefaults = [DarcsFlag] -> AbsolutePath -> [String] -> IO [String]
defaultRepo
    , commandAdvancedOptions :: [DarcsOptDescr DarcsFlag]
commandAdvancedOptions = OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  (RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> Any)
-> [DarcsOptDescr DarcsFlag]
forall (d :: * -> *) f a b. OptSpec d f a b -> [d f]
odesc OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  (RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> Any)
forall a.
OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  (RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> a)
pullAdvancedOpts
    , commandBasicOptions :: [DarcsOptDescr DarcsFlag]
commandBasicOptions = OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> Any)
-> [DarcsOptDescr DarcsFlag]
forall (d :: * -> *) f a b. OptSpec d f a b -> [d f]
odesc OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> Any)
forall a.
OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
pullBasicOpts
    , commandDefaults :: [DarcsFlag]
commandDefaults = OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> UseCache
   -> HooksConfig
   -> [DarcsFlag])
-> [DarcsFlag]
forall (d :: * -> *) f b. OptSpec d f [f] b -> [f]
defaultFlags OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> UseCache
   -> HooksConfig
   -> [DarcsFlag])
forall a.
DarcsOption
  a
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> UseCache
   -> HooksConfig
   -> a)
pullOpts
    , commandCheckOptions :: [DarcsFlag] -> [String]
commandCheckOptions = OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> UseCache
   -> HooksConfig
   -> Any)
-> [DarcsFlag] -> [String]
forall (d :: * -> *) f a b. OptSpec d f a b -> [f] -> [String]
ocheck OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> UseCache
   -> HooksConfig
   -> Any)
forall a.
DarcsOption
  a
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> UseCache
   -> HooksConfig
   -> a)
pullOpts
    , commandParseOptions :: [DarcsFlag] -> [DarcsFlag]
commandParseOptions = OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> UseCache
   -> HooksConfig
   -> [DarcsFlag])
-> [DarcsFlag] -> [DarcsFlag]
forall (d :: * -> *) f b. OptSpec d f [f] b -> [f] -> [f]
onormalise OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> UseCache
   -> HooksConfig
   -> [DarcsFlag])
forall a.
DarcsOption
  a
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> UseCache
   -> HooksConfig
   -> a)
pullOpts
    }
  where
    pullBasicOpts :: OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
pullBasicOpts
      = PrimOptSpec
  DarcsOptDescr
  DarcsFlag
  (Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
  [MatchFlag]
MatchOption
O.matchSeveral
      PrimOptSpec
  DarcsOptDescr
  DarcsFlag
  (Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
  [MatchFlag]
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Maybe Bool
      -> Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> Summary
      -> SelectDeps
      -> Maybe Bool
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
     (Reorder
      -> Maybe Bool
      -> Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> Summary
      -> SelectDeps
      -> Maybe Bool
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Maybe Bool
      -> Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> Summary
      -> SelectDeps
      -> Maybe Bool
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
     ([MatchFlag]
      -> Reorder
      -> Maybe Bool
      -> Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> Summary
      -> SelectDeps
      -> Maybe Bool
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
  (Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
PrimDarcsOption Reorder
O.reorder
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> Summary
      -> SelectDeps
      -> Maybe Bool
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
     (Maybe Bool
      -> Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> Summary
      -> SelectDeps
      -> Maybe Bool
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> Summary
      -> SelectDeps
      -> Maybe Bool
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
     ([MatchFlag]
      -> Reorder
      -> Maybe Bool
      -> Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> Summary
      -> SelectDeps
      -> Maybe Bool
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
  (Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
PrimDarcsOption (Maybe Bool)
O.interactive
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> Summary
      -> SelectDeps
      -> Maybe Bool
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
     (Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> Summary
      -> SelectDeps
      -> Maybe Bool
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> Summary
      -> SelectDeps
      -> Maybe Bool
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
     ([MatchFlag]
      -> Reorder
      -> Maybe Bool
      -> Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> Summary
      -> SelectDeps
      -> Maybe Bool
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
  (Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
PrimDarcsOption (Maybe AllowConflicts)
O.conflictsYes
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (RunTest
      -> DryRun
      -> XmlOutput
      -> Summary
      -> SelectDeps
      -> Maybe Bool
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
     (ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> Summary
      -> SelectDeps
      -> Maybe Bool
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (RunTest
      -> DryRun
      -> XmlOutput
      -> Summary
      -> SelectDeps
      -> Maybe Bool
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
     ([MatchFlag]
      -> Reorder
      -> Maybe Bool
      -> Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> Summary
      -> SelectDeps
      -> Maybe Bool
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
  (ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
PrimDarcsOption ExternalMerge
O.externalMerge
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (DryRun
      -> XmlOutput
      -> Summary
      -> SelectDeps
      -> Maybe Bool
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
     (RunTest
      -> DryRun
      -> XmlOutput
      -> Summary
      -> SelectDeps
      -> Maybe Bool
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (DryRun
      -> XmlOutput
      -> Summary
      -> SelectDeps
      -> Maybe Bool
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
     ([MatchFlag]
      -> Reorder
      -> Maybe Bool
      -> Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> Summary
      -> SelectDeps
      -> Maybe Bool
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
  (RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
PrimDarcsOption RunTest
O.runTest
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Summary
      -> SelectDeps
      -> Maybe Bool
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
     (DryRun
      -> XmlOutput
      -> Summary
      -> SelectDeps
      -> Maybe Bool
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Summary
      -> SelectDeps
      -> Maybe Bool
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
     ([MatchFlag]
      -> Reorder
      -> Maybe Bool
      -> Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> Summary
      -> SelectDeps
      -> Maybe Bool
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
  (DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
forall a. DarcsOption a (DryRun -> XmlOutput -> a)
O.dryRunXml
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (SelectDeps
      -> Maybe Bool -> Maybe String -> Bool -> DiffAlgorithm -> a)
     (Summary
      -> SelectDeps
      -> Maybe Bool
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (SelectDeps
      -> Maybe Bool -> Maybe String -> Bool -> DiffAlgorithm -> a)
     ([MatchFlag]
      -> Reorder
      -> Maybe Bool
      -> Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> Summary
      -> SelectDeps
      -> Maybe Bool
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (SelectDeps
   -> Maybe Bool -> Maybe String -> Bool -> DiffAlgorithm -> a)
  (Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
PrimDarcsOption Summary
O.summary
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (SelectDeps
   -> Maybe Bool -> Maybe String -> Bool -> DiffAlgorithm -> a)
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Maybe Bool -> Maybe String -> Bool -> DiffAlgorithm -> a)
     (SelectDeps
      -> Maybe Bool -> Maybe String -> Bool -> DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Maybe Bool -> Maybe String -> Bool -> DiffAlgorithm -> a)
     ([MatchFlag]
      -> Reorder
      -> Maybe Bool
      -> Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> Summary
      -> SelectDeps
      -> Maybe Bool
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe Bool -> Maybe String -> Bool -> DiffAlgorithm -> a)
  (SelectDeps
   -> Maybe Bool -> Maybe String -> Bool -> DiffAlgorithm -> a)
PrimDarcsOption SelectDeps
O.selectDeps
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe Bool -> Maybe String -> Bool -> DiffAlgorithm -> a)
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Maybe String -> Bool -> DiffAlgorithm -> a)
     (Maybe Bool -> Maybe String -> Bool -> DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Maybe String -> Bool -> DiffAlgorithm -> a)
     ([MatchFlag]
      -> Reorder
      -> Maybe Bool
      -> Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> Summary
      -> SelectDeps
      -> Maybe Bool
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe String -> Bool -> DiffAlgorithm -> a)
  (Maybe Bool -> Maybe String -> Bool -> DiffAlgorithm -> a)
PrimDarcsOption (Maybe Bool)
O.setDefault
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe String -> Bool -> DiffAlgorithm -> a)
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Bool -> DiffAlgorithm -> a)
     (Maybe String -> Bool -> DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Bool -> DiffAlgorithm -> a)
     ([MatchFlag]
      -> Reorder
      -> Maybe Bool
      -> Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> Summary
      -> SelectDeps
      -> Maybe Bool
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (Bool -> DiffAlgorithm -> a)
  (Maybe String -> Bool -> DiffAlgorithm -> a)
PrimDarcsOption (Maybe String)
O.repoDir
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (Bool -> DiffAlgorithm -> a)
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (DiffAlgorithm -> a)
     (Bool -> DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (DiffAlgorithm -> a)
     ([MatchFlag]
      -> Reorder
      -> Maybe Bool
      -> Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> Summary
      -> SelectDeps
      -> Maybe Bool
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (DiffAlgorithm -> a)
  (Bool -> DiffAlgorithm -> a)
PrimDarcsOption Bool
O.allowUnrelatedRepos
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (DiffAlgorithm -> a)
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
-> OptSpec DarcsOptDescr DarcsFlag a (DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     a
     ([MatchFlag]
      -> Reorder
      -> Maybe Bool
      -> Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> Summary
      -> SelectDeps
      -> Maybe Bool
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec DarcsOptDescr DarcsFlag a (DiffAlgorithm -> a)
PrimDarcsOption DiffAlgorithm
O.diffAlgorithm
    pullAdvancedOpts :: OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  (RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> a)
pullAdvancedOpts
      = PrimOptSpec
  DarcsOptDescr
  DarcsFlag
  (Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> a)
  RepoCombinator
PrimDarcsOption RepoCombinator
O.repoCombinator
      PrimOptSpec
  DarcsOptDescr
  DarcsFlag
  (Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> a)
  RepoCombinator
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (UseIndex
      -> RemoteRepos
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> NetworkOptions
      -> a)
     (Compression
      -> UseIndex
      -> RemoteRepos
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> NetworkOptions
      -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (UseIndex
      -> RemoteRepos
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> NetworkOptions
      -> a)
     (RepoCombinator
      -> Compression
      -> UseIndex
      -> RemoteRepos
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> NetworkOptions
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> a)
  (Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> a)
PrimDarcsOption Compression
O.compress
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> a)
  (RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (RemoteRepos
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> NetworkOptions
      -> a)
     (UseIndex
      -> RemoteRepos
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> NetworkOptions
      -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (RemoteRepos
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> NetworkOptions
      -> a)
     (RepoCombinator
      -> Compression
      -> UseIndex
      -> RemoteRepos
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> NetworkOptions
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> a)
  (UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> a)
PrimDarcsOption UseIndex
O.useIndex
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> a)
  (RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (SetScriptsExecutable
      -> UMask -> Bool -> Bool -> NetworkOptions -> a)
     (RemoteRepos
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> NetworkOptions
      -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (SetScriptsExecutable
      -> UMask -> Bool -> Bool -> NetworkOptions -> a)
     (RepoCombinator
      -> Compression
      -> UseIndex
      -> RemoteRepos
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> NetworkOptions
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (SetScriptsExecutable
   -> UMask -> Bool -> Bool -> NetworkOptions -> a)
  (RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> a)
PrimDarcsOption RemoteRepos
O.remoteRepos
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (SetScriptsExecutable
   -> UMask -> Bool -> Bool -> NetworkOptions -> a)
  (RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (UMask -> Bool -> Bool -> NetworkOptions -> a)
     (SetScriptsExecutable
      -> UMask -> Bool -> Bool -> NetworkOptions -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (UMask -> Bool -> Bool -> NetworkOptions -> a)
     (RepoCombinator
      -> Compression
      -> UseIndex
      -> RemoteRepos
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> NetworkOptions
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (UMask -> Bool -> Bool -> NetworkOptions -> a)
  (SetScriptsExecutable
   -> UMask -> Bool -> Bool -> NetworkOptions -> a)
PrimDarcsOption SetScriptsExecutable
O.setScriptsExecutable
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (UMask -> Bool -> Bool -> NetworkOptions -> a)
  (RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Bool -> Bool -> NetworkOptions -> a)
     (UMask -> Bool -> Bool -> NetworkOptions -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Bool -> Bool -> NetworkOptions -> a)
     (RepoCombinator
      -> Compression
      -> UseIndex
      -> RemoteRepos
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> NetworkOptions
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (Bool -> Bool -> NetworkOptions -> a)
  (UMask -> Bool -> Bool -> NetworkOptions -> a)
PrimDarcsOption UMask
O.umask
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (Bool -> Bool -> NetworkOptions -> a)
  (RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Bool -> NetworkOptions -> a)
     (Bool -> Bool -> NetworkOptions -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Bool -> NetworkOptions -> a)
     (RepoCombinator
      -> Compression
      -> UseIndex
      -> RemoteRepos
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> NetworkOptions
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (Bool -> NetworkOptions -> a)
  (Bool -> Bool -> NetworkOptions -> a)
PrimDarcsOption Bool
O.restrictPaths
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (Bool -> NetworkOptions -> a)
  (RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (NetworkOptions -> a)
     (Bool -> NetworkOptions -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (NetworkOptions -> a)
     (RepoCombinator
      -> Compression
      -> UseIndex
      -> RemoteRepos
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> NetworkOptions
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (NetworkOptions -> a)
  (Bool -> NetworkOptions -> a)
PrimDarcsOption Bool
O.changesReverse
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (NetworkOptions -> a)
  (RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> a)
-> OptSpec DarcsOptDescr DarcsFlag a (NetworkOptions -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     a
     (RepoCombinator
      -> Compression
      -> UseIndex
      -> RemoteRepos
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> NetworkOptions
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec DarcsOptDescr DarcsFlag a (NetworkOptions -> a)
PrimDarcsOption NetworkOptions
O.network
    pullOpts :: DarcsOption
  a
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> UseCache
   -> HooksConfig
   -> a)
pullOpts = OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> UseCache
   -> HooksConfig
   -> a)
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> UseCache
   -> HooksConfig
   -> a)
forall a.
OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
pullBasicOpts OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> UseCache
   -> HooksConfig
   -> a)
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> Summary
   -> SelectDeps
   -> Maybe Bool
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> UseCache
   -> HooksConfig
   -> a)
-> DarcsOption
     (UseCache -> HooksConfig -> a)
     (RepoCombinator
      -> Compression
      -> UseIndex
      -> RemoteRepos
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> NetworkOptions
      -> UseCache
      -> HooksConfig
      -> a)
-> DarcsOption
     a
     ([MatchFlag]
      -> Reorder
      -> Maybe Bool
      -> Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> Summary
      -> SelectDeps
      -> Maybe Bool
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> Maybe StdCmdAction
      -> Bool
      -> Bool
      -> Verbosity
      -> Bool
      -> RepoCombinator
      -> Compression
      -> UseIndex
      -> RemoteRepos
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> NetworkOptions
      -> UseCache
      -> HooksConfig
      -> a)
forall b c a.
DarcsOption
  (Maybe StdCmdAction -> Bool -> Bool -> Verbosity -> Bool -> b) c
-> DarcsOption (UseCache -> HooksConfig -> a) b -> DarcsOption a c
`withStdOpts` DarcsOption
  (UseCache -> HooksConfig -> a)
  (RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> UseCache
   -> HooksConfig
   -> a)
forall a.
OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  (RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> NetworkOptions
   -> a)
pullAdvancedOpts

applyDescription :: String
applyDescription :: String
applyDescription = "Apply a patch bundle, suspending any local patches that conflict."

applyHelp :: String
applyHelp :: String
applyHelp = "Apply a patch bundle, suspending any local patches that conflict."

stdindefault :: a -> [String] -> IO [String]
stdindefault :: a -> [String] -> IO [String]
stdindefault _ [] = [String] -> IO [String]
forall (m :: * -> *) a. Monad m => a -> m a
return ["-"]
stdindefault _ x :: [String]
x = [String] -> IO [String]
forall (m :: * -> *) a. Monad m => a -> m a
return [String]
x

apply :: DarcsCommand [DarcsFlag]
apply :: DarcsCommand [DarcsFlag]
apply = DarcsCommand :: forall parsedFlags.
String
-> String
-> String
-> String
-> Int
-> [String]
-> ((AbsolutePath, AbsolutePath)
    -> parsedFlags -> [String] -> IO ())
-> ([DarcsFlag] -> IO (Either String ()))
-> ((AbsolutePath, AbsolutePath)
    -> [DarcsFlag] -> [String] -> IO [String])
-> ([DarcsFlag] -> AbsolutePath -> [String] -> IO [String])
-> [DarcsOptDescr DarcsFlag]
-> [DarcsOptDescr DarcsFlag]
-> [DarcsFlag]
-> ([DarcsFlag] -> [String])
-> ([DarcsFlag] -> parsedFlags)
-> DarcsCommand parsedFlags
DarcsCommand
    { commandProgramName :: String
commandProgramName = "darcs"
    , commandName :: String
commandName = "apply"
    , commandHelp :: String
commandHelp = String
applyHelp
    , commandDescription :: String
commandDescription = String
applyDescription
    , commandExtraArgs :: Int
commandExtraArgs = 1
    , commandExtraArgHelp :: [String]
commandExtraArgHelp = ["<PATCHFILE>"]
    , commandCommand :: (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
commandCommand = RebasePatchApplier
-> (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
forall pa.
PatchApplier pa =>
pa
-> (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
applyCmd RebasePatchApplier
RebasePatchApplier
    , commandPrereq :: [DarcsFlag] -> IO (Either String ())
commandPrereq = [DarcsFlag] -> IO (Either String ())
amInHashedRepository
    , commandCompleteArgs :: (AbsolutePath, AbsolutePath)
-> [DarcsFlag] -> [String] -> IO [String]
commandCompleteArgs = (AbsolutePath, AbsolutePath)
-> [DarcsFlag] -> [String] -> IO [String]
fileArgs
    , commandArgdefaults :: [DarcsFlag] -> AbsolutePath -> [String] -> IO [String]
commandArgdefaults = (AbsolutePath -> [String] -> IO [String])
-> [DarcsFlag] -> AbsolutePath -> [String] -> IO [String]
forall a b. a -> b -> a
const AbsolutePath -> [String] -> IO [String]
forall a. a -> [String] -> IO [String]
stdindefault
    , commandAdvancedOptions :: [DarcsOptDescr DarcsFlag]
commandAdvancedOptions = OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  (Maybe String
   -> Maybe String
   -> Bool
   -> (Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> Any)
-> [DarcsOptDescr DarcsFlag]
forall (d :: * -> *) f a b. OptSpec d f a b -> [d f]
odesc OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  (Maybe String
   -> Maybe String
   -> Bool
   -> (Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> Any)
forall a.
OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  (Maybe String
   -> Maybe String
   -> Bool
   -> (Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> a)
applyAdvancedOpts
    , commandBasicOptions :: [DarcsOptDescr DarcsFlag]
commandBasicOptions = OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  (Verify
   -> Reorder
   -> Maybe Bool
   -> DryRun
   -> XmlOutput
   -> [MatchFlag]
   -> Maybe String
   -> DiffAlgorithm
   -> Any)
-> [DarcsOptDescr DarcsFlag]
forall (d :: * -> *) f a b. OptSpec d f a b -> [d f]
odesc OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  (Verify
   -> Reorder
   -> Maybe Bool
   -> DryRun
   -> XmlOutput
   -> [MatchFlag]
   -> Maybe String
   -> DiffAlgorithm
   -> Any)
forall a.
OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  (Verify
   -> Reorder
   -> Maybe Bool
   -> DryRun
   -> XmlOutput
   -> [MatchFlag]
   -> Maybe String
   -> DiffAlgorithm
   -> a)
applyBasicOpts
    , commandDefaults :: [DarcsFlag]
commandDefaults = OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  (Verify
   -> Reorder
   -> Maybe Bool
   -> DryRun
   -> XmlOutput
   -> [MatchFlag]
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> Maybe String
   -> Maybe String
   -> Bool
   -> (Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> UseCache
   -> HooksConfig
   -> [DarcsFlag])
-> [DarcsFlag]
forall (d :: * -> *) f b. OptSpec d f [f] b -> [f]
defaultFlags OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  (Verify
   -> Reorder
   -> Maybe Bool
   -> DryRun
   -> XmlOutput
   -> [MatchFlag]
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> Maybe String
   -> Maybe String
   -> Bool
   -> (Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> UseCache
   -> HooksConfig
   -> [DarcsFlag])
forall a.
DarcsOption
  a
  (Verify
   -> Reorder
   -> Maybe Bool
   -> DryRun
   -> XmlOutput
   -> [MatchFlag]
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> Maybe String
   -> Maybe String
   -> Bool
   -> (Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> UseCache
   -> HooksConfig
   -> a)
applyOpts
    , commandCheckOptions :: [DarcsFlag] -> [String]
commandCheckOptions = OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  (Verify
   -> Reorder
   -> Maybe Bool
   -> DryRun
   -> XmlOutput
   -> [MatchFlag]
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> Maybe String
   -> Maybe String
   -> Bool
   -> (Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> UseCache
   -> HooksConfig
   -> Any)
-> [DarcsFlag] -> [String]
forall (d :: * -> *) f a b. OptSpec d f a b -> [f] -> [String]
ocheck OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  (Verify
   -> Reorder
   -> Maybe Bool
   -> DryRun
   -> XmlOutput
   -> [MatchFlag]
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> Maybe String
   -> Maybe String
   -> Bool
   -> (Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> UseCache
   -> HooksConfig
   -> Any)
forall a.
DarcsOption
  a
  (Verify
   -> Reorder
   -> Maybe Bool
   -> DryRun
   -> XmlOutput
   -> [MatchFlag]
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> Maybe String
   -> Maybe String
   -> Bool
   -> (Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> UseCache
   -> HooksConfig
   -> a)
applyOpts
    , commandParseOptions :: [DarcsFlag] -> [DarcsFlag]
commandParseOptions = OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  (Verify
   -> Reorder
   -> Maybe Bool
   -> DryRun
   -> XmlOutput
   -> [MatchFlag]
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> Maybe String
   -> Maybe String
   -> Bool
   -> (Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> UseCache
   -> HooksConfig
   -> [DarcsFlag])
-> [DarcsFlag] -> [DarcsFlag]
forall (d :: * -> *) f b. OptSpec d f [f] b -> [f] -> [f]
onormalise OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  (Verify
   -> Reorder
   -> Maybe Bool
   -> DryRun
   -> XmlOutput
   -> [MatchFlag]
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> Maybe String
   -> Maybe String
   -> Bool
   -> (Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> UseCache
   -> HooksConfig
   -> [DarcsFlag])
forall a.
DarcsOption
  a
  (Verify
   -> Reorder
   -> Maybe Bool
   -> DryRun
   -> XmlOutput
   -> [MatchFlag]
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> Maybe String
   -> Maybe String
   -> Bool
   -> (Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> UseCache
   -> HooksConfig
   -> a)
applyOpts
    }
  where
    applyBasicOpts :: OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  (Verify
   -> Reorder
   -> Maybe Bool
   -> DryRun
   -> XmlOutput
   -> [MatchFlag]
   -> Maybe String
   -> DiffAlgorithm
   -> a)
applyBasicOpts
      = PrimOptSpec
  DarcsOptDescr
  DarcsFlag
  (Reorder
   -> Maybe Bool
   -> DryRun
   -> XmlOutput
   -> [MatchFlag]
   -> Maybe String
   -> DiffAlgorithm
   -> a)
  Verify
PrimDarcsOption Verify
O.verify
      PrimOptSpec
  DarcsOptDescr
  DarcsFlag
  (Reorder
   -> Maybe Bool
   -> DryRun
   -> XmlOutput
   -> [MatchFlag]
   -> Maybe String
   -> DiffAlgorithm
   -> a)
  Verify
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Maybe Bool
      -> DryRun
      -> XmlOutput
      -> [MatchFlag]
      -> Maybe String
      -> DiffAlgorithm
      -> a)
     (Reorder
      -> Maybe Bool
      -> DryRun
      -> XmlOutput
      -> [MatchFlag]
      -> Maybe String
      -> DiffAlgorithm
      -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Maybe Bool
      -> DryRun
      -> XmlOutput
      -> [MatchFlag]
      -> Maybe String
      -> DiffAlgorithm
      -> a)
     (Verify
      -> Reorder
      -> Maybe Bool
      -> DryRun
      -> XmlOutput
      -> [MatchFlag]
      -> Maybe String
      -> DiffAlgorithm
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe Bool
   -> DryRun
   -> XmlOutput
   -> [MatchFlag]
   -> Maybe String
   -> DiffAlgorithm
   -> a)
  (Reorder
   -> Maybe Bool
   -> DryRun
   -> XmlOutput
   -> [MatchFlag]
   -> Maybe String
   -> DiffAlgorithm
   -> a)
PrimDarcsOption Reorder
O.reorder
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe Bool
   -> DryRun
   -> XmlOutput
   -> [MatchFlag]
   -> Maybe String
   -> DiffAlgorithm
   -> a)
  (Verify
   -> Reorder
   -> Maybe Bool
   -> DryRun
   -> XmlOutput
   -> [MatchFlag]
   -> Maybe String
   -> DiffAlgorithm
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (DryRun
      -> XmlOutput -> [MatchFlag] -> Maybe String -> DiffAlgorithm -> a)
     (Maybe Bool
      -> DryRun
      -> XmlOutput
      -> [MatchFlag]
      -> Maybe String
      -> DiffAlgorithm
      -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (DryRun
      -> XmlOutput -> [MatchFlag] -> Maybe String -> DiffAlgorithm -> a)
     (Verify
      -> Reorder
      -> Maybe Bool
      -> DryRun
      -> XmlOutput
      -> [MatchFlag]
      -> Maybe String
      -> DiffAlgorithm
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (DryRun
   -> XmlOutput -> [MatchFlag] -> Maybe String -> DiffAlgorithm -> a)
  (Maybe Bool
   -> DryRun
   -> XmlOutput
   -> [MatchFlag]
   -> Maybe String
   -> DiffAlgorithm
   -> a)
PrimDarcsOption (Maybe Bool)
O.interactive
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (DryRun
   -> XmlOutput -> [MatchFlag] -> Maybe String -> DiffAlgorithm -> a)
  (Verify
   -> Reorder
   -> Maybe Bool
   -> DryRun
   -> XmlOutput
   -> [MatchFlag]
   -> Maybe String
   -> DiffAlgorithm
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     ([MatchFlag] -> Maybe String -> DiffAlgorithm -> a)
     (DryRun
      -> XmlOutput -> [MatchFlag] -> Maybe String -> DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     ([MatchFlag] -> Maybe String -> DiffAlgorithm -> a)
     (Verify
      -> Reorder
      -> Maybe Bool
      -> DryRun
      -> XmlOutput
      -> [MatchFlag]
      -> Maybe String
      -> DiffAlgorithm
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  ([MatchFlag] -> Maybe String -> DiffAlgorithm -> a)
  (DryRun
   -> XmlOutput -> [MatchFlag] -> Maybe String -> DiffAlgorithm -> a)
forall a. DarcsOption a (DryRun -> XmlOutput -> a)
O.dryRunXml
      OptSpec
  DarcsOptDescr
  DarcsFlag
  ([MatchFlag] -> Maybe String -> DiffAlgorithm -> a)
  (Verify
   -> Reorder
   -> Maybe Bool
   -> DryRun
   -> XmlOutput
   -> [MatchFlag]
   -> Maybe String
   -> DiffAlgorithm
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Maybe String -> DiffAlgorithm -> a)
     ([MatchFlag] -> Maybe String -> DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Maybe String -> DiffAlgorithm -> a)
     (Verify
      -> Reorder
      -> Maybe Bool
      -> DryRun
      -> XmlOutput
      -> [MatchFlag]
      -> Maybe String
      -> DiffAlgorithm
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe String -> DiffAlgorithm -> a)
  ([MatchFlag] -> Maybe String -> DiffAlgorithm -> a)
MatchOption
O.matchSeveral
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe String -> DiffAlgorithm -> a)
  (Verify
   -> Reorder
   -> Maybe Bool
   -> DryRun
   -> XmlOutput
   -> [MatchFlag]
   -> Maybe String
   -> DiffAlgorithm
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (DiffAlgorithm -> a)
     (Maybe String -> DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (DiffAlgorithm -> a)
     (Verify
      -> Reorder
      -> Maybe Bool
      -> DryRun
      -> XmlOutput
      -> [MatchFlag]
      -> Maybe String
      -> DiffAlgorithm
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (DiffAlgorithm -> a)
  (Maybe String -> DiffAlgorithm -> a)
PrimDarcsOption (Maybe String)
O.repoDir
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (DiffAlgorithm -> a)
  (Verify
   -> Reorder
   -> Maybe Bool
   -> DryRun
   -> XmlOutput
   -> [MatchFlag]
   -> Maybe String
   -> DiffAlgorithm
   -> a)
-> OptSpec DarcsOptDescr DarcsFlag a (DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     a
     (Verify
      -> Reorder
      -> Maybe Bool
      -> DryRun
      -> XmlOutput
      -> [MatchFlag]
      -> Maybe String
      -> DiffAlgorithm
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec DarcsOptDescr DarcsFlag a (DiffAlgorithm -> a)
PrimDarcsOption DiffAlgorithm
O.diffAlgorithm
    applyAdvancedOpts :: OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  (Maybe String
   -> Maybe String
   -> Bool
   -> (Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> a)
applyAdvancedOpts
      = PrimOptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe String
   -> Bool
   -> (Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> a)
  (Maybe String)
PrimDarcsOption (Maybe String)
O.reply
      PrimOptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe String
   -> Bool
   -> (Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> a)
  (Maybe String)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Bool
      -> (Bool, Maybe String)
      -> UseIndex
      -> Compression
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> WantGuiPause
      -> a)
     (Maybe String
      -> Bool
      -> (Bool, Maybe String)
      -> UseIndex
      -> Compression
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> WantGuiPause
      -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Bool
      -> (Bool, Maybe String)
      -> UseIndex
      -> Compression
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> WantGuiPause
      -> a)
     (Maybe String
      -> Maybe String
      -> Bool
      -> (Bool, Maybe String)
      -> UseIndex
      -> Compression
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> WantGuiPause
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (Bool
   -> (Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> a)
  (Maybe String
   -> Bool
   -> (Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> a)
PrimDarcsOption (Maybe String)
O.ccApply
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (Bool
   -> (Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> a)
  (Maybe String
   -> Maybe String
   -> Bool
   -> (Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     ((Bool, Maybe String)
      -> UseIndex
      -> Compression
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> WantGuiPause
      -> a)
     (Bool
      -> (Bool, Maybe String)
      -> UseIndex
      -> Compression
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> WantGuiPause
      -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     ((Bool, Maybe String)
      -> UseIndex
      -> Compression
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> WantGuiPause
      -> a)
     (Maybe String
      -> Maybe String
      -> Bool
      -> (Bool, Maybe String)
      -> UseIndex
      -> Compression
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> WantGuiPause
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  ((Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> a)
  (Bool
   -> (Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> a)
PrimDarcsOption Bool
O.happyForwarding
      OptSpec
  DarcsOptDescr
  DarcsFlag
  ((Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> a)
  (Maybe String
   -> Maybe String
   -> Bool
   -> (Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (UseIndex
      -> Compression
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> WantGuiPause
      -> a)
     ((Bool, Maybe String)
      -> UseIndex
      -> Compression
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> WantGuiPause
      -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (UseIndex
      -> Compression
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> WantGuiPause
      -> a)
     (Maybe String
      -> Maybe String
      -> Bool
      -> (Bool, Maybe String)
      -> UseIndex
      -> Compression
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> WantGuiPause
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> a)
  ((Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> a)
PrimDarcsOption (Bool, Maybe String)
O.sendmail
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> a)
  (Maybe String
   -> Maybe String
   -> Bool
   -> (Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Compression
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> WantGuiPause
      -> a)
     (UseIndex
      -> Compression
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> WantGuiPause
      -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Compression
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> WantGuiPause
      -> a)
     (Maybe String
      -> Maybe String
      -> Bool
      -> (Bool, Maybe String)
      -> UseIndex
      -> Compression
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> WantGuiPause
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> a)
  (UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> a)
PrimDarcsOption UseIndex
O.useIndex
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> a)
  (Maybe String
   -> Maybe String
   -> Bool
   -> (Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (SetScriptsExecutable
      -> UMask -> Bool -> Bool -> WantGuiPause -> a)
     (Compression
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> WantGuiPause
      -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (SetScriptsExecutable
      -> UMask -> Bool -> Bool -> WantGuiPause -> a)
     (Maybe String
      -> Maybe String
      -> Bool
      -> (Bool, Maybe String)
      -> UseIndex
      -> Compression
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> WantGuiPause
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (SetScriptsExecutable
   -> UMask -> Bool -> Bool -> WantGuiPause -> a)
  (Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> a)
PrimDarcsOption Compression
O.compress
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (SetScriptsExecutable
   -> UMask -> Bool -> Bool -> WantGuiPause -> a)
  (Maybe String
   -> Maybe String
   -> Bool
   -> (Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (UMask -> Bool -> Bool -> WantGuiPause -> a)
     (SetScriptsExecutable
      -> UMask -> Bool -> Bool -> WantGuiPause -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (UMask -> Bool -> Bool -> WantGuiPause -> a)
     (Maybe String
      -> Maybe String
      -> Bool
      -> (Bool, Maybe String)
      -> UseIndex
      -> Compression
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> WantGuiPause
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (UMask -> Bool -> Bool -> WantGuiPause -> a)
  (SetScriptsExecutable
   -> UMask -> Bool -> Bool -> WantGuiPause -> a)
PrimDarcsOption SetScriptsExecutable
O.setScriptsExecutable
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (UMask -> Bool -> Bool -> WantGuiPause -> a)
  (Maybe String
   -> Maybe String
   -> Bool
   -> (Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Bool -> Bool -> WantGuiPause -> a)
     (UMask -> Bool -> Bool -> WantGuiPause -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Bool -> Bool -> WantGuiPause -> a)
     (Maybe String
      -> Maybe String
      -> Bool
      -> (Bool, Maybe String)
      -> UseIndex
      -> Compression
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> WantGuiPause
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (Bool -> Bool -> WantGuiPause -> a)
  (UMask -> Bool -> Bool -> WantGuiPause -> a)
PrimDarcsOption UMask
O.umask
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (Bool -> Bool -> WantGuiPause -> a)
  (Maybe String
   -> Maybe String
   -> Bool
   -> (Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Bool -> WantGuiPause -> a)
     (Bool -> Bool -> WantGuiPause -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Bool -> WantGuiPause -> a)
     (Maybe String
      -> Maybe String
      -> Bool
      -> (Bool, Maybe String)
      -> UseIndex
      -> Compression
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> WantGuiPause
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (Bool -> WantGuiPause -> a)
  (Bool -> Bool -> WantGuiPause -> a)
PrimDarcsOption Bool
O.restrictPaths
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (Bool -> WantGuiPause -> a)
  (Maybe String
   -> Maybe String
   -> Bool
   -> (Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (WantGuiPause -> a)
     (Bool -> WantGuiPause -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (WantGuiPause -> a)
     (Maybe String
      -> Maybe String
      -> Bool
      -> (Bool, Maybe String)
      -> UseIndex
      -> Compression
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> WantGuiPause
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
  DarcsOptDescr
  DarcsFlag
  (WantGuiPause -> a)
  (Bool -> WantGuiPause -> a)
PrimDarcsOption Bool
O.changesReverse
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (WantGuiPause -> a)
  (Maybe String
   -> Maybe String
   -> Bool
   -> (Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> a)
-> OptSpec DarcsOptDescr DarcsFlag a (WantGuiPause -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     a
     (Maybe String
      -> Maybe String
      -> Bool
      -> (Bool, Maybe String)
      -> UseIndex
      -> Compression
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> WantGuiPause
      -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec DarcsOptDescr DarcsFlag a (WantGuiPause -> a)
PrimDarcsOption WantGuiPause
O.pauseForGui
    applyOpts :: DarcsOption
  a
  (Verify
   -> Reorder
   -> Maybe Bool
   -> DryRun
   -> XmlOutput
   -> [MatchFlag]
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> Maybe String
   -> Maybe String
   -> Bool
   -> (Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> UseCache
   -> HooksConfig
   -> a)
applyOpts = OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> Maybe String
   -> Maybe String
   -> Bool
   -> (Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> UseCache
   -> HooksConfig
   -> a)
  (Verify
   -> Reorder
   -> Maybe Bool
   -> DryRun
   -> XmlOutput
   -> [MatchFlag]
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> Maybe String
   -> Maybe String
   -> Bool
   -> (Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> UseCache
   -> HooksConfig
   -> a)
forall a.
OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  (Verify
   -> Reorder
   -> Maybe Bool
   -> DryRun
   -> XmlOutput
   -> [MatchFlag]
   -> Maybe String
   -> DiffAlgorithm
   -> a)
applyBasicOpts OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> Maybe String
   -> Maybe String
   -> Bool
   -> (Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> UseCache
   -> HooksConfig
   -> a)
  (Verify
   -> Reorder
   -> Maybe Bool
   -> DryRun
   -> XmlOutput
   -> [MatchFlag]
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> Maybe String
   -> Maybe String
   -> Bool
   -> (Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> UseCache
   -> HooksConfig
   -> a)
-> DarcsOption
     (UseCache -> HooksConfig -> a)
     (Maybe String
      -> Maybe String
      -> Bool
      -> (Bool, Maybe String)
      -> UseIndex
      -> Compression
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> WantGuiPause
      -> UseCache
      -> HooksConfig
      -> a)
-> DarcsOption
     a
     (Verify
      -> Reorder
      -> Maybe Bool
      -> DryRun
      -> XmlOutput
      -> [MatchFlag]
      -> Maybe String
      -> DiffAlgorithm
      -> Maybe StdCmdAction
      -> Bool
      -> Bool
      -> Verbosity
      -> Bool
      -> Maybe String
      -> Maybe String
      -> Bool
      -> (Bool, Maybe String)
      -> UseIndex
      -> Compression
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> Bool
      -> WantGuiPause
      -> UseCache
      -> HooksConfig
      -> a)
forall b c a.
DarcsOption
  (Maybe StdCmdAction -> Bool -> Bool -> Verbosity -> Bool -> b) c
-> DarcsOption (UseCache -> HooksConfig -> a) b -> DarcsOption a c
`withStdOpts` DarcsOption
  (UseCache -> HooksConfig -> a)
  (Maybe String
   -> Maybe String
   -> Bool
   -> (Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> UseCache
   -> HooksConfig
   -> a)
forall a.
OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  (Maybe String
   -> Maybe String
   -> Bool
   -> (Bool, Maybe String)
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> Bool
   -> WantGuiPause
   -> a)
applyAdvancedOpts

data RebasePatchApplier = RebasePatchApplier

instance PatchApplier RebasePatchApplier where
    type ApplierRepoTypeConstraint RebasePatchApplier rt = rt ~ 'RepoType 'IsRebase

    repoJob :: RebasePatchApplier
-> [DarcsFlag]
-> (forall (rt :: RepoType) (p :: * -> * -> *) wR wU.
    (IsRepoType rt, ApplierRepoTypeConstraint RebasePatchApplier rt,
     RepoPatch p, ApplyState p ~ Tree) =>
    PatchProxy p -> Repository rt p wR wU wR -> IO ())
-> RepoJob ()
repoJob RebasePatchApplier opts :: [DarcsFlag]
opts f :: forall (rt :: RepoType) (p :: * -> * -> *) wR wU.
(IsRepoType rt, ApplierRepoTypeConstraint RebasePatchApplier rt,
 RepoPatch p, ApplyState p ~ Tree) =>
PatchProxy p -> Repository rt p wR wU wR -> IO ()
f =
        RebaseJobFlags
-> (forall (p :: * -> * -> *) wR wU.
    (RepoPatch p, ApplyState p ~ Tree) =>
    Repository ('RepoType 'IsRebase) p wR wU wR -> IO ())
-> RepoJob ()
forall a.
RebaseJobFlags
-> (forall (p :: * -> * -> *) wR wU.
    (RepoPatch p, ApplyState p ~ Tree) =>
    Repository ('RepoType 'IsRebase) p wR wU wR -> IO a)
-> RepoJob a
StartRebaseJob
          (Compression -> Verbosity -> UpdateWorking -> RebaseJobFlags
RebaseJobFlags (PrimDarcsOption Compression
compress PrimDarcsOption Compression -> [DarcsFlag] -> Compression
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) (PrimDarcsOption Verbosity
verbosity PrimDarcsOption Verbosity -> [DarcsFlag] -> Verbosity
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) UpdateWorking
YesUpdateWorking)
          (PatchProxy p
-> Repository ('RepoType 'IsRebase) p wR wU wR -> IO ()
forall (rt :: RepoType) (p :: * -> * -> *) wR wU.
(IsRepoType rt, ApplierRepoTypeConstraint RebasePatchApplier rt,
 RepoPatch p, ApplyState p ~ Tree) =>
PatchProxy p -> Repository rt p wR wU wR -> IO ()
f PatchProxy p
forall (p :: * -> * -> *). PatchProxy p
PatchProxy)
    applyPatches :: RebasePatchApplier
-> PatchProxy p
-> String
-> [DarcsFlag]
-> String
-> Repository rt p wR wU wT
-> FL (PatchInfoAnd rt p) wX wT
-> FL (PatchInfoAnd rt p) wX wZ
-> IO ()
applyPatches RebasePatchApplier PatchProxy = String
-> [DarcsFlag]
-> String
-> Repository rt p wR wU wT
-> FL (PatchInfoAnd rt p) wX wT
-> FL (PatchInfoAnd rt p) wX wZ
-> IO ()
forall (p :: * -> * -> *) wR wU wX wT wZ.
(RepoPatch p, ApplyState p ~ Tree) =>
String
-> [DarcsFlag]
-> String
-> Repository ('RepoType 'IsRebase) p wR wU wT
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wT
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wZ
-> IO ()
applyPatchesForRebaseCmd

applyPatchesForRebaseCmd
    :: forall p wR wU wX wT wZ
     . ( RepoPatch p, ApplyState p ~ Tree )
    => String
    -> [DarcsFlag]
    -> String
    -> Repository ('RepoType 'IsRebase) p wR wU wT
    -> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wT
    -> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wZ
    -> IO ()
applyPatchesForRebaseCmd :: String
-> [DarcsFlag]
-> String
-> Repository ('RepoType 'IsRebase) p wR wU wT
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wT
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wZ
-> IO ()
applyPatchesForRebaseCmd cmdName :: String
cmdName opts :: [DarcsFlag]
opts _from_whom :: String
_from_whom repository :: Repository ('RepoType 'IsRebase) p wR wU wT
repository us' :: FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wT
us' to_be_applied :: FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wZ
to_be_applied = do
    String
-> Verbosity
-> Summary
-> DryRun
-> XmlOutput
-> Bool
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wZ
-> IO ()
forall (p :: * -> * -> *) (rt :: RepoType) wX wY.
(RepoPatch p, ApplyState p ~ Tree) =>
String
-> Verbosity
-> Summary
-> DryRun
-> XmlOutput
-> Bool
-> FL (PatchInfoAnd rt p) wX wY
-> IO ()
printDryRunMessageAndExit String
cmdName
        (PrimDarcsOption Verbosity
verbosity PrimDarcsOption Verbosity -> [DarcsFlag] -> Verbosity
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts)
        (PrimDarcsOption Summary
O.summary PrimDarcsOption Summary -> [DarcsFlag] -> Summary
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts)
        (PrimDarcsOption DryRun
dryRun PrimDarcsOption DryRun -> [DarcsFlag] -> DryRun
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts)
        (PrimDarcsOption XmlOutput
xmlOutput PrimDarcsOption XmlOutput -> [DarcsFlag] -> XmlOutput
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts)
        (Bool -> [DarcsFlag] -> Bool
isInteractive Bool
True [DarcsFlag]
opts)
        FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wZ
to_be_applied
    FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wZ -> IO ()
forall (p :: * -> * -> *) (rt :: RepoType) wX wY.
(RepoPatch p, ApplyState p ~ Tree) =>
FL (PatchInfoAnd rt p) wX wY -> IO ()
setEnvDarcsPatches FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wZ
to_be_applied
    Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wZ -> Bool
forall (a :: * -> * -> *) wX wZ. FL a wX wZ -> Bool
nullFL FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wZ
to_be_applied) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ do
        String -> IO ()
putStrLn (String -> IO ()) -> String -> IO ()
forall a b. (a -> b) -> a -> b
$ "You don't want to " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
cmdName String -> String -> String
forall a. [a] -> [a] -> [a]
++ " any patches, and that's fine with me!"
        IO ()
forall a. IO a
exitSuccess
    [DarcsFlag]
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wZ -> IO ()
forall (p :: * -> * -> *) wX wY.
PatchInspect p =>
[DarcsFlag] -> FL p wX wY -> IO ()
checkPaths [DarcsFlag]
opts FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wZ
to_be_applied
    [DarcsFlag] -> Doc -> IO ()
putVerbose [DarcsFlag]
opts (Doc -> IO ()) -> Doc -> IO ()
forall a b. (a -> b) -> a -> b
$ String -> Doc
text (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ "Will " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
cmdName String -> String -> String
forall a. [a] -> [a] -> [a]
++ " the following patches:"
    [DarcsFlag] -> Doc -> IO ()
putVerbose [DarcsFlag]
opts (Doc -> IO ()) -> Doc -> IO ()
forall a b. (a -> b) -> a -> b
$ [Doc] -> Doc
vcat ([Doc] -> Doc) -> [Doc] -> Doc
forall a b. (a -> b) -> a -> b
$ (forall wW wZ. PatchInfoAnd ('RepoType 'IsRebase) p wW wZ -> Doc)
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wZ -> [Doc]
forall (a :: * -> * -> *) b wX wY.
(forall wW wZ. a wW wZ -> b) -> FL a wX wY -> [b]
mapFL forall wW wZ. PatchInfoAnd ('RepoType 'IsRebase) p wW wZ -> Doc
forall (p :: * -> * -> *) wX wY. ShowPatch p => p wX wY -> Doc
description FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wZ
to_be_applied
    usOk :: FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wZ
usOk :> usConflicted :: FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wT
usConflicted <- (:>)
  (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
  (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
  wX
  wT
-> IO
     ((:>)
        (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
        (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
        wX
        wT)
forall (m :: * -> *) a. Monad m => a -> m a
return ((:>)
   (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
   (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
   wX
   wT
 -> IO
      ((:>)
         (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
         (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
         wX
         wT))
-> (:>)
     (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
     (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
     wX
     wT
-> IO
     ((:>)
        (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
        (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
        wX
        wT)
forall a b. (a -> b) -> a -> b
$ CommuteFn
  (PatchInfoAnd ('RepoType 'IsRebase) p)
  (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wT
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wZ
-> (:>)
     (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
     (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
     wX
     wT
forall (p1 :: * -> * -> *) (p2 :: * -> * -> *) wX wY wZ.
(Commute p1, Invert p1) =>
CommuteFn p1 p2
-> FL p1 wX wY -> p2 wX wZ -> (:>) (FL p1) (FL p1) wX wY
partitionConflictingFL (CommuteFn
  (PatchInfoAnd ('RepoType 'IsRebase) p)
  (PatchInfoAnd ('RepoType 'IsRebase) p)
-> CommuteFn
     (PatchInfoAnd ('RepoType 'IsRebase) p)
     (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
forall (p1 :: * -> * -> *) (p2 :: * -> * -> *).
CommuteFn p1 p2 -> CommuteFn p1 (FL p2)
commuterIdFL CommuteFn
  (PatchInfoAnd ('RepoType 'IsRebase) p)
  (PatchInfoAnd ('RepoType 'IsRebase) p)
forall (p :: * -> * -> *) wX wY.
Commute p =>
(:>) p p wX wY -> Maybe ((:>) p p wX wY)
selfCommuter) FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wT
us' FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wZ
to_be_applied

    Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wT -> Int
forall (a :: * -> * -> *) wX wZ. FL a wX wZ -> Int
lengthFL FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wT
usConflicted Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> 0) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
        [DarcsFlag] -> Doc -> IO ()
putInfo [DarcsFlag]
opts (Doc -> IO ()) -> Doc -> IO ()
forall a b. (a -> b) -> a -> b
$ String -> Doc
text "The following local patches are in conflict:"

    -- TODO: we assume the options apply only to the main
    -- command, review if there are any we should keep
    let patches_context :: PatchSelectionContext (PatchInfoAnd ('RepoType 'IsRebase) p)
patches_context = WhichChanges
-> String
-> PatchSelectionOptions
-> Maybe (Splitter (PatchInfoAnd ('RepoType 'IsRebase) p))
-> Maybe [String]
-> PatchSelectionContext (PatchInfoAnd ('RepoType 'IsRebase) p)
forall (rt :: RepoType) (p :: * -> * -> *).
(IsRepoType rt, RepoPatch p) =>
WhichChanges
-> String
-> PatchSelectionOptions
-> Maybe (Splitter (PatchInfoAnd rt p))
-> Maybe [String]
-> PatchSelectionContext (PatchInfoAnd rt p)
selectionContext WhichChanges
LastReversed "suspend" PatchSelectionOptions
applyPatchSelOpts Maybe (Splitter (PatchInfoAnd ('RepoType 'IsRebase) p))
forall a. Maybe a
Nothing Maybe [String]
forall a. Maybe a
Nothing

    (usKeep :: FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wZ
usKeep :> usToSuspend :: FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wT
usToSuspend) <- FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wT
-> PatchSelectionContext (PatchInfoAnd ('RepoType 'IsRebase) p)
-> IO
     ((:>)
        (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
        (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
        wZ
        wT)
forall (p :: * -> * -> *) wX wY.
(Invert p, Commute p, Apply p, PatchInspect p, ShowPatch p,
 ShowContextPatch p, ApplyState p ~ Tree) =>
FL p wX wY
-> PatchSelectionContext p -> IO ((:>) (FL p) (FL p) wX wY)
runSelection FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wT
usConflicted PatchSelectionContext (PatchInfoAnd ('RepoType 'IsRebase) p)
patches_context

    -- test all patches for hijacking and abort if rejected
    HijackOptions -> HijackT IO () -> IO ()
forall (m :: * -> *) a.
Monad m =>
HijackOptions -> HijackT m a -> m a
runHijackT HijackOptions
RequestHijackPermission
        (HijackT IO () -> IO ()) -> HijackT IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ (PatchInfo -> StateT HijackOptions IO String)
-> [PatchInfo] -> HijackT IO ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ (String
-> Bool
-> Maybe String
-> PatchInfo
-> StateT HijackOptions IO String
getAuthor "suspend" Bool
False Maybe String
forall a. Maybe a
Nothing)
        ([PatchInfo] -> HijackT IO ()) -> [PatchInfo] -> HijackT IO ()
forall a b. (a -> b) -> a -> b
$ (forall wW wZ.
 PatchInfoAnd ('RepoType 'IsRebase) p wW wZ -> PatchInfo)
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wT -> [PatchInfo]
forall (a :: * -> * -> *) b wX wY.
(forall wW wZ. a wW wZ -> b) -> FL a wX wY -> [b]
mapFL forall wW wZ.
PatchInfoAnd ('RepoType 'IsRebase) p wW wZ -> PatchInfo
forall (rt :: RepoType) (p :: * -> * -> *) wA wB.
PatchInfoAnd rt p wA wB -> PatchInfo
info FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wT
usToSuspend

    (rOld :: PatchInfoAnd ('RepoType 'IsRebase) p wT wT
rOld, suspended :: Suspended p wT wT
suspended, _) <- (PatchInfoAnd ('RepoType 'IsRebase) p wT wT, Suspended p wT wT,
 FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wT)
-> IO
     (PatchInfoAnd ('RepoType 'IsRebase) p wT wT, Suspended p wT wT,
      FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wT)
forall (m :: * -> *) a. Monad m => a -> m a
return ((PatchInfoAnd ('RepoType 'IsRebase) p wT wT, Suspended p wT wT,
  FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wT)
 -> IO
      (PatchInfoAnd ('RepoType 'IsRebase) p wT wT, Suspended p wT wT,
       FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wT))
-> (PatchInfoAnd ('RepoType 'IsRebase) p wT wT, Suspended p wT wT,
    FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wT)
-> IO
     (PatchInfoAnd ('RepoType 'IsRebase) p wT wT, Suspended p wT wT,
      FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wT)
forall a b. (a -> b) -> a -> b
$ FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wT
-> (PatchInfoAnd ('RepoType 'IsRebase) p wT wT, Suspended p wT wT,
    FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wT)
forall (p :: * -> * -> *) wA wB.
FL (PatchInfoAnd ('RepoType 'IsRebase) p) wA wB
-> (PatchInfoAnd ('RepoType 'IsRebase) p wB wB, Suspended p wB wB,
    FL (PatchInfoAnd ('RepoType 'IsRebase) p) wA wB)
takeHeadRebaseFL FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wT
us'
    Repository ('RepoType 'IsRebase) p wR wU wZ
repository' <- [DarcsFlag]
-> Repository ('RepoType 'IsRebase) p wR wU wT
-> Suspended p wT wT
-> PatchInfoAnd ('RepoType 'IsRebase) p wT wT
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wT
-> IO (Repository ('RepoType 'IsRebase) p wR wU wZ)
forall (p :: * -> * -> *) wR wU wT wX.
(RepoPatch p, ApplyState p ~ Tree) =>
[DarcsFlag]
-> Repository ('RepoType 'IsRebase) p wR wU wT
-> Suspended p wT wT
-> PatchInfoAnd ('RepoType 'IsRebase) p wT wT
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wT
-> IO (Repository ('RepoType 'IsRebase) p wR wU wX)
doSuspend [DarcsFlag]
opts Repository ('RepoType 'IsRebase) p wR wU wT
repository Suspended p wT wT
suspended PatchInfoAnd ('RepoType 'IsRebase) p wT wT
rOld FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wT
usToSuspend
    -- the new rebase patch containing the suspended patches is now in the repo
    -- and the suspended patches have been removed

    -- TODO This is a nasty hack, caused by the fact that readUnrecorded
    -- claims to read the tentative state but actual reads the committed state
    -- as a result we have to commit here so that tentativelyMergePatches does
    -- the right thing.
    Repository ('RepoType 'IsRebase) p wR wU wZ
-> UpdateWorking -> Compression -> IO ()
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wT -> UpdateWorking -> Compression -> IO ()
finalizeRepositoryChanges Repository ('RepoType 'IsRebase) p wR wU wZ
repository' UpdateWorking
YesUpdateWorking (PrimDarcsOption Compression
compress PrimDarcsOption Compression -> [DarcsFlag] -> Compression
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts)
        IO () -> IO () -> IO ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Repository ('RepoType 'IsRebase) p wR wU wZ
-> UpdateWorking -> IO ()
forall (p :: * -> * -> *) (rt :: RepoType) wR wU wT.
RepoPatch p =>
Repository rt p wR wU wT -> UpdateWorking -> IO ()
revertRepositoryChanges Repository ('RepoType 'IsRebase) p wR wU wZ
repository' UpdateWorking
YesUpdateWorking

    Sealed pw :: FL (PrimOf p) wU wX
pw <-
        Repository ('RepoType 'IsRebase) p wR wU wZ
-> String
-> AllowConflicts
-> UpdateWorking
-> ExternalMerge
-> WantGuiPause
-> Compression
-> Verbosity
-> Reorder
-> (UseIndex, ScanKnown, DiffAlgorithm)
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wZ
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wZ
-> IO (Sealed (FL (PrimOf p) wU))
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT wX wY.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wT
-> String
-> AllowConflicts
-> UpdateWorking
-> ExternalMerge
-> WantGuiPause
-> Compression
-> Verbosity
-> Reorder
-> (UseIndex, ScanKnown, DiffAlgorithm)
-> FL (PatchInfoAnd rt p) wX wT
-> FL (PatchInfoAnd rt p) wX wY
-> IO (Sealed (FL (PrimOf p) wU))
tentativelyMergePatches
            Repository ('RepoType 'IsRebase) p wR wU wZ
repository' String
cmdName
            ([DarcsFlag] -> AllowConflicts
allowConflicts [DarcsFlag]
opts) UpdateWorking
YesUpdateWorking
            (PrimDarcsOption ExternalMerge
externalMerge PrimDarcsOption ExternalMerge -> [DarcsFlag] -> ExternalMerge
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts)
            ([DarcsFlag] -> WantGuiPause
wantGuiPause [DarcsFlag]
opts) (PrimDarcsOption Compression
compress PrimDarcsOption Compression -> [DarcsFlag] -> Compression
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) (PrimDarcsOption Verbosity
verbosity PrimDarcsOption Verbosity -> [DarcsFlag] -> Verbosity
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts)
            (PrimDarcsOption Reorder
reorder PrimDarcsOption Reorder -> [DarcsFlag] -> Reorder
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) ([DarcsFlag] -> (UseIndex, ScanKnown, DiffAlgorithm)
diffingOpts [DarcsFlag]
opts)
            (FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wZ
usOk FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wZ
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wZ
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wZ
forall (a :: * -> * -> *) wX wY wZ.
FL a wX wY -> FL a wY wZ -> FL a wX wZ
+>+ FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wZ
usKeep) FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wZ
to_be_applied

    Repository ('RepoType 'IsRebase) p wR wU wT -> IO ()
forall t. t -> IO ()
invalidateIndex Repository ('RepoType 'IsRebase) p wR wU wT
repository
    Repository ('RepoType 'IsRebase) p wR wU wZ
-> UpdateWorking -> Compression -> IO ()
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wT -> UpdateWorking -> Compression -> IO ()
finalizeRepositoryChanges Repository ('RepoType 'IsRebase) p wR wU wZ
repository' UpdateWorking
YesUpdateWorking (PrimDarcsOption Compression
compress PrimDarcsOption Compression -> [DarcsFlag] -> Compression
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts)
    Repository ('RepoType 'IsRebase) p wR wX wZ
_ <- IO (Repository ('RepoType 'IsRebase) p wR wX wZ)
-> IO (Repository ('RepoType 'IsRebase) p wR wX wZ)
forall a. IO a -> IO a
revertable (IO (Repository ('RepoType 'IsRebase) p wR wX wZ)
 -> IO (Repository ('RepoType 'IsRebase) p wR wX wZ))
-> IO (Repository ('RepoType 'IsRebase) p wR wX wZ)
-> IO (Repository ('RepoType 'IsRebase) p wR wX wZ)
forall a b. (a -> b) -> a -> b
$ Repository ('RepoType 'IsRebase) p wR wU wZ
-> Verbosity
-> FL (PrimOf p) wU wX
-> IO (Repository ('RepoType 'IsRebase) p wR wX wZ)
forall (p :: * -> * -> *) (rt :: RepoType) wR wU wT wY.
(ApplyState p ~ Tree, RepoPatch p) =>
Repository rt p wR wU wT
-> Verbosity
-> FL (PrimOf p) wU wY
-> IO (Repository rt p wR wY wT)
applyToWorking Repository ('RepoType 'IsRebase) p wR wU wZ
repository' (PrimDarcsOption Verbosity
verbosity PrimDarcsOption Verbosity -> [DarcsFlag] -> Verbosity
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) FL (PrimOf p) wU wX
pw
    Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (PrimDarcsOption SetScriptsExecutable
O.setScriptsExecutable PrimDarcsOption SetScriptsExecutable
-> [DarcsFlag] -> SetScriptsExecutable
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts SetScriptsExecutable -> SetScriptsExecutable -> Bool
forall a. Eq a => a -> a -> Bool
== SetScriptsExecutable
O.YesSetScriptsExecutable) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
      FL (PrimOf p) wU wX -> IO ()
forall (p :: * -> * -> *) wX wY. PatchInspect p => p wX wY -> IO ()
setScriptsExecutablePatches FL (PrimOf p) wU wX
pw
    [DarcsFlag] -> Doc -> IO ()
putInfo [DarcsFlag]
opts (Doc -> IO ()) -> Doc -> IO ()
forall a b. (a -> b) -> a -> b
$ String -> Doc
text (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ "Finished " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
cmdName String -> String -> String
forall a. [a] -> [a] -> [a]
++ "ing."

-- TODO I doubt this is right, e.g. withContext should be inherited
applyPatchSelOpts :: S.PatchSelectionOptions
applyPatchSelOpts :: PatchSelectionOptions
applyPatchSelOpts = PatchSelectionOptions :: Verbosity
-> [MatchFlag]
-> Bool
-> SelectDeps
-> Summary
-> WithContext
-> PatchSelectionOptions
S.PatchSelectionOptions
    { verbosity :: Verbosity
S.verbosity = Verbosity
O.NormalVerbosity
    , matchFlags :: [MatchFlag]
S.matchFlags = []
    , interactive :: Bool
S.interactive = Bool
True
    , selectDeps :: SelectDeps
S.selectDeps = SelectDeps
O.PromptDeps -- option not supported, use default
    , summary :: Summary
S.summary = Summary
O.NoSummary
    , withContext :: WithContext
S.withContext = WithContext
O.NoContext
    }

obliteratePatchSelOpts :: [DarcsFlag] -> S.PatchSelectionOptions
obliteratePatchSelOpts :: [DarcsFlag] -> PatchSelectionOptions
obliteratePatchSelOpts opts :: [DarcsFlag]
opts = (Bool -> [DarcsFlag] -> PatchSelectionOptions
patchSelOpts Bool
True [DarcsFlag]
opts)
    { selectDeps :: SelectDeps
S.selectDeps = SelectDeps
O.NoDeps
    }

patchSelOpts :: Bool -> [DarcsFlag] -> S.PatchSelectionOptions
patchSelOpts :: Bool -> [DarcsFlag] -> PatchSelectionOptions
patchSelOpts defInteractive :: Bool
defInteractive flags :: [DarcsFlag]
flags = PatchSelectionOptions :: Verbosity
-> [MatchFlag]
-> Bool
-> SelectDeps
-> Summary
-> WithContext
-> PatchSelectionOptions
S.PatchSelectionOptions
    { verbosity :: Verbosity
S.verbosity = PrimDarcsOption Verbosity
verbosity PrimDarcsOption Verbosity -> [DarcsFlag] -> Verbosity
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
flags
    , matchFlags :: [MatchFlag]
S.matchFlags = MatchOption -> [DarcsFlag] -> [MatchFlag]
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
parseFlags MatchOption
O.matchSeveralOrLast [DarcsFlag]
flags
    , interactive :: Bool
S.interactive = Bool -> [DarcsFlag] -> Bool
isInteractive Bool
defInteractive [DarcsFlag]
flags
    , selectDeps :: SelectDeps
S.selectDeps = PrimDarcsOption SelectDeps
selectDeps PrimDarcsOption SelectDeps -> [DarcsFlag] -> SelectDeps
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
flags
    , summary :: Summary
S.summary = PrimDarcsOption Summary
O.summary PrimDarcsOption Summary -> [DarcsFlag] -> Summary
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
flags
    , withContext :: WithContext
S.withContext = WithContext
O.NoContext
    }

log :: DarcsCommand [DarcsFlag]
log :: DarcsCommand [DarcsFlag]
log = DarcsCommand :: forall parsedFlags.
String
-> String
-> String
-> String
-> Int
-> [String]
-> ((AbsolutePath, AbsolutePath)
    -> parsedFlags -> [String] -> IO ())
-> ([DarcsFlag] -> IO (Either String ()))
-> ((AbsolutePath, AbsolutePath)
    -> [DarcsFlag] -> [String] -> IO [String])
-> ([DarcsFlag] -> AbsolutePath -> [String] -> IO [String])
-> [DarcsOptDescr DarcsFlag]
-> [DarcsOptDescr DarcsFlag]
-> [DarcsFlag]
-> ([DarcsFlag] -> [String])
-> ([DarcsFlag] -> parsedFlags)
-> DarcsCommand parsedFlags
DarcsCommand
    { commandProgramName :: String
commandProgramName = "darcs"
    , commandName :: String
commandName = "log"
    , commandHelp :: String
commandHelp = "List the currently suspended changes.\n"
    , commandDescription :: String
commandDescription = "List the currently suspended changes"
    , commandPrereq :: [DarcsFlag] -> IO (Either String ())
commandPrereq = [DarcsFlag] -> IO (Either String ())
amInHashedRepository
    , commandExtraArgs :: Int
commandExtraArgs = 0
    , commandExtraArgHelp :: [String]
commandExtraArgHelp = []
    , commandCommand :: (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
commandCommand = (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
logCmd
    , commandCompleteArgs :: (AbsolutePath, AbsolutePath)
-> [DarcsFlag] -> [String] -> IO [String]
commandCompleteArgs = (AbsolutePath, AbsolutePath)
-> [DarcsFlag] -> [String] -> IO [String]
noArgs
    , commandArgdefaults :: [DarcsFlag] -> AbsolutePath -> [String] -> IO [String]
commandArgdefaults = [DarcsFlag] -> AbsolutePath -> [String] -> IO [String]
nodefaults
    , commandAdvancedOptions :: [DarcsOptDescr DarcsFlag]
commandAdvancedOptions = OptSpec DarcsOptDescr DarcsFlag Any Any
-> [DarcsOptDescr DarcsFlag]
forall (d :: * -> *) f a b. OptSpec d f a b -> [d f]
odesc OptSpec DarcsOptDescr DarcsFlag Any Any
forall (d :: * -> *) f a. OptSpec d f a a
logAdvancedOpts
    , commandBasicOptions :: [DarcsOptDescr DarcsFlag]
commandBasicOptions = OptSpec DarcsOptDescr DarcsFlag Any (Summary -> Maybe Bool -> Any)
-> [DarcsOptDescr DarcsFlag]
forall (d :: * -> *) f a b. OptSpec d f a b -> [d f]
odesc OptSpec DarcsOptDescr DarcsFlag Any (Summary -> Maybe Bool -> Any)
forall a.
OptSpec DarcsOptDescr DarcsFlag a (Summary -> Maybe Bool -> a)
logBasicOpts
    , commandDefaults :: [DarcsFlag]
commandDefaults = OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  (Summary
   -> Maybe Bool
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> [DarcsFlag])
-> [DarcsFlag]
forall (d :: * -> *) f b. OptSpec d f [f] b -> [f]
defaultFlags OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  (Summary
   -> Maybe Bool
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> [DarcsFlag])
forall a.
DarcsOption
  a
  (Summary
   -> Maybe Bool
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> a)
logOpts
    , commandCheckOptions :: [DarcsFlag] -> [String]
commandCheckOptions = OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  (Summary
   -> Maybe Bool
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> Any)
-> [DarcsFlag] -> [String]
forall (d :: * -> *) f a b. OptSpec d f a b -> [f] -> [String]
ocheck OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  (Summary
   -> Maybe Bool
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> Any)
forall a.
DarcsOption
  a
  (Summary
   -> Maybe Bool
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> a)
logOpts
    , commandParseOptions :: [DarcsFlag] -> [DarcsFlag]
commandParseOptions = OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  (Summary
   -> Maybe Bool
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> [DarcsFlag])
-> [DarcsFlag] -> [DarcsFlag]
forall (d :: * -> *) f b. OptSpec d f [f] b -> [f] -> [f]
onormalise OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  (Summary
   -> Maybe Bool
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> [DarcsFlag])
forall a.
DarcsOption
  a
  (Summary
   -> Maybe Bool
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> a)
logOpts
    }
  where
    logBasicOpts :: OptSpec DarcsOptDescr DarcsFlag a (Summary -> Maybe Bool -> a)
logBasicOpts = PrimOptSpec DarcsOptDescr DarcsFlag (Maybe Bool -> a) Summary
PrimDarcsOption Summary
O.summary PrimOptSpec DarcsOptDescr DarcsFlag (Maybe Bool -> a) Summary
-> OptSpec DarcsOptDescr DarcsFlag a (Maybe Bool -> a)
-> OptSpec DarcsOptDescr DarcsFlag a (Summary -> Maybe Bool -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec DarcsOptDescr DarcsFlag a (Maybe Bool -> a)
PrimDarcsOption (Maybe Bool)
O.interactive -- False
    logAdvancedOpts :: OptSpec d f a a
logAdvancedOpts = OptSpec d f a a
forall (d :: * -> *) f a. OptSpec d f a a
oid
    logOpts :: DarcsOption
  a
  (Summary
   -> Maybe Bool
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> a)
logOpts = OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> a)
  (Summary
   -> Maybe Bool
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> a)
forall a.
OptSpec DarcsOptDescr DarcsFlag a (Summary -> Maybe Bool -> a)
logBasicOpts OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> a)
  (Summary
   -> Maybe Bool
   -> Maybe StdCmdAction
   -> Bool
   -> Bool
   -> Verbosity
   -> Bool
   -> UseCache
   -> HooksConfig
   -> a)
-> DarcsOption
     (UseCache -> HooksConfig -> a) (UseCache -> HooksConfig -> a)
-> DarcsOption
     a
     (Summary
      -> Maybe Bool
      -> Maybe StdCmdAction
      -> Bool
      -> Bool
      -> Verbosity
      -> Bool
      -> UseCache
      -> HooksConfig
      -> a)
forall b c a.
DarcsOption
  (Maybe StdCmdAction -> Bool -> Bool -> Verbosity -> Bool -> b) c
-> DarcsOption (UseCache -> HooksConfig -> a) b -> DarcsOption a c
`withStdOpts` DarcsOption
  (UseCache -> HooksConfig -> a) (UseCache -> HooksConfig -> a)
forall (d :: * -> *) f a. OptSpec d f a a
logAdvancedOpts

logCmd :: (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
logCmd :: (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
logCmd _ opts :: [DarcsFlag]
opts _files :: [String]
_files =
    UseCache -> RepoJob () -> IO ()
forall a. UseCache -> RepoJob a -> IO a
withRepository (PrimDarcsOption UseCache
useCache PrimDarcsOption UseCache -> [DarcsFlag] -> UseCache
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) (RepoJob () -> IO ()) -> RepoJob () -> IO ()
forall a b. (a -> b) -> a -> b
$
    RebaseJobFlags
-> (forall (p :: * -> * -> *) wR wU.
    (RepoPatch p, ApplyState p ~ Tree) =>
    Repository ('RepoType 'IsRebase) p wR wU wR -> IO ())
-> RepoJob ()
forall a.
RebaseJobFlags
-> (forall (p :: * -> * -> *) wR wU.
    (RepoPatch p, ApplyState p ~ Tree) =>
    Repository ('RepoType 'IsRebase) p wR wU wR -> IO a)
-> RepoJob a
RebaseJob (Compression -> Verbosity -> UpdateWorking -> RebaseJobFlags
RebaseJobFlags (PrimDarcsOption Compression
compress PrimDarcsOption Compression -> [DarcsFlag] -> Compression
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) (PrimDarcsOption Verbosity
verbosity PrimDarcsOption Verbosity -> [DarcsFlag] -> Verbosity
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) UpdateWorking
YesUpdateWorking) ((forall (p :: * -> * -> *) wR wU.
  (RepoPatch p, ApplyState p ~ Tree) =>
  Repository ('RepoType 'IsRebase) p wR wU wR -> IO ())
 -> RepoJob ())
-> (forall (p :: * -> * -> *) wR wU.
    (RepoPatch p, ApplyState p ~ Tree) =>
    Repository ('RepoType 'IsRebase) p wR wU wR -> IO ())
-> RepoJob ()
forall a b. (a -> b) -> a -> b
$ \repository :: Repository ('RepoType 'IsRebase) p wR wU wR
repository -> do
        PatchSet ('RepoType 'IsRebase) p Origin wR
patches <- Repository ('RepoType 'IsRebase) p wR wU wR
-> IO (PatchSet ('RepoType 'IsRebase) p Origin wR)
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
(IsRepoType rt, RepoPatch p) =>
Repository rt p wR wU wT -> IO (PatchSet rt p Origin wR)
readRepo Repository ('RepoType 'IsRebase) p wR wU wR
repository
        (_, Items ps :: FL (RebaseItem p) wR wY
ps, _) <- (PatchInfoAnd ('RepoType 'IsRebase) p wR wR, Suspended p wR wR,
 PatchSet ('RepoType 'IsRebase) p Origin wR)
-> IO
     (PatchInfoAnd ('RepoType 'IsRebase) p wR wR, Suspended p wR wR,
      PatchSet ('RepoType 'IsRebase) p Origin wR)
forall (m :: * -> *) a. Monad m => a -> m a
return ((PatchInfoAnd ('RepoType 'IsRebase) p wR wR, Suspended p wR wR,
  PatchSet ('RepoType 'IsRebase) p Origin wR)
 -> IO
      (PatchInfoAnd ('RepoType 'IsRebase) p wR wR, Suspended p wR wR,
       PatchSet ('RepoType 'IsRebase) p Origin wR))
-> (PatchInfoAnd ('RepoType 'IsRebase) p wR wR, Suspended p wR wR,
    PatchSet ('RepoType 'IsRebase) p Origin wR)
-> IO
     (PatchInfoAnd ('RepoType 'IsRebase) p wR wR, Suspended p wR wR,
      PatchSet ('RepoType 'IsRebase) p Origin wR)
forall a b. (a -> b) -> a -> b
$ PatchSet ('RepoType 'IsRebase) p Origin wR
-> (PatchInfoAnd ('RepoType 'IsRebase) p wR wR, Suspended p wR wR,
    PatchSet ('RepoType 'IsRebase) p Origin wR)
forall (p :: * -> * -> *) wA wB.
PatchSet ('RepoType 'IsRebase) p wA wB
-> (PatchInfoAnd ('RepoType 'IsRebase) p wB wB, Suspended p wB wB,
    PatchSet ('RepoType 'IsRebase) p wA wB)
takeHeadRebase PatchSet ('RepoType 'IsRebase) p Origin wR
patches
        let psToShow :: FL (PatchInfoAnd ('RepoType 'IsRebase) (RebaseChange p)) wR wY
psToShow = FL (RebaseItem p) wR wY
-> FL (PatchInfoAnd ('RepoType 'IsRebase) (RebaseChange p)) wR wY
forall (p :: * -> * -> *) wX wY.
PrimPatchBase p =>
FL (RebaseItem p) wX wY
-> FL (PatchInfoAnd ('RepoType 'IsRebase) (RebaseChange p)) wX wY
toRebaseChanges FL (RebaseItem p) wR wY
ps
        if Bool -> [DarcsFlag] -> Bool
isInteractive Bool
False [DarcsFlag]
opts
            then PatchSelectionOptions
-> [Sealed2 (PatchInfoAnd ('RepoType 'IsRebase) (RebaseChange p))]
-> IO ()
forall (p :: * -> * -> *).
(ShowPatch p, ShowContextPatch p, ApplyState p ~ Tree) =>
PatchSelectionOptions -> [Sealed2 p] -> IO ()
viewChanges (Bool -> [DarcsFlag] -> PatchSelectionOptions
patchSelOpts Bool
False [DarcsFlag]
opts) ((forall wW wZ.
 PatchInfoAnd ('RepoType 'IsRebase) (RebaseChange p) wW wZ
 -> Sealed2 (PatchInfoAnd ('RepoType 'IsRebase) (RebaseChange p)))
-> FL (PatchInfoAnd ('RepoType 'IsRebase) (RebaseChange p)) wR wY
-> [Sealed2 (PatchInfoAnd ('RepoType 'IsRebase) (RebaseChange p))]
forall (a :: * -> * -> *) b wX wY.
(forall wW wZ. a wW wZ -> b) -> FL a wX wY -> [b]
mapFL forall wW wZ.
PatchInfoAnd ('RepoType 'IsRebase) (RebaseChange p) wW wZ
-> Sealed2 (PatchInfoAnd ('RepoType 'IsRebase) (RebaseChange p))
forall (a :: * -> * -> *) wX wY. a wX wY -> Sealed2 a
Sealed2 FL (PatchInfoAnd ('RepoType 'IsRebase) (RebaseChange p)) wR wY
psToShow)
            else do
                String -> IO ()
debugMessage "About to print the changes..."
                let printers :: Printers
printers = if [DarcsFlag] -> Bool
hasXmlOutput [DarcsFlag]
opts then Printers
simplePrinters else Printers
fancyPrinters
                    emptyPatchSet :: PatchSet rt p wY wY
emptyPatchSet = RL (Tagged rt p) wY wY
-> RL (PatchInfoAnd rt p) wY wY -> PatchSet rt p wY wY
forall (rt :: RepoType) (p :: * -> * -> *) wStart wX wY.
RL (Tagged rt p) wStart wX
-> RL (PatchInfoAnd rt p) wX wY -> PatchSet rt p wStart wY
PatchSet RL (Tagged rt p) wY wY
forall (a :: * -> * -> *) wX. RL a wX wX
NilRL RL (PatchInfoAnd rt p) wY wY
forall (a :: * -> * -> *) wX. RL a wX wX
NilRL
                    patchSet :: PatchSet ('RepoType 'IsRebase) (RebaseChange p) wR wY
patchSet = PatchSet ('RepoType 'IsRebase) (RebaseChange p) wR wR
-> FL (PatchInfoAnd ('RepoType 'IsRebase) (RebaseChange p)) wR wY
-> PatchSet ('RepoType 'IsRebase) (RebaseChange p) wR wY
forall (rt :: RepoType) (p :: * -> * -> *) wStart wX wY.
PatchSet rt p wStart wX
-> FL (PatchInfoAnd rt p) wX wY -> PatchSet rt p wStart wY
appendPSFL PatchSet ('RepoType 'IsRebase) (RebaseChange p) wR wR
forall (rt :: RepoType) (p :: * -> * -> *) wY. PatchSet rt p wY wY
emptyPatchSet FL (PatchInfoAnd ('RepoType 'IsRebase) (RebaseChange p)) wR wY
psToShow
                ([(Sealed2 (PatchInfoAnd ('RepoType 'IsRebase) (RebaseChange p)),
   [String])],
 [(String, String)], Maybe Doc)
logInfo <-
                    Maybe Int
-> [MatchFlag]
-> Bool
-> Maybe [String]
-> PatchFilter ('RepoType 'IsRebase) (RebaseChange p)
-> PatchSet ('RepoType 'IsRebase) (RebaseChange p) wR wY
-> IO
     ([(Sealed2 (PatchInfoAnd ('RepoType 'IsRebase) (RebaseChange p)),
        [String])],
      [(String, String)], Maybe Doc)
forall (rt :: RepoType) (p :: * -> * -> *) wX wY.
(IsRepoType rt, Matchable p, ApplyState p ~ Tree) =>
Maybe Int
-> [MatchFlag]
-> Bool
-> Maybe [String]
-> PatchFilter rt p
-> PatchSet rt p wX wY
-> IO
     ([(Sealed2 (PatchInfoAnd rt p), [String])], [(String, String)],
      Maybe Doc)
getLogInfo
                         (PrimDarcsOption (Maybe Int)
maxCount PrimDarcsOption (Maybe Int) -> [DarcsFlag] -> Maybe Int
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts)
                         (MatchOption
matchAny MatchOption -> [DarcsFlag] -> [MatchFlag]
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts)
                         (PrimDarcsOption Bool
onlyToFiles PrimDarcsOption Bool -> [DarcsFlag] -> Bool
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts)
                         Maybe [String]
forall a. Maybe a
Nothing
                         (\_ qs :: [Sealed2 (PatchInfoAnd ('RepoType 'IsRebase) (RebaseChange p))]
qs -> [Sealed2 (PatchInfoAnd ('RepoType 'IsRebase) (RebaseChange p))]
-> IO
     [Sealed2 (PatchInfoAnd ('RepoType 'IsRebase) (RebaseChange p))]
forall (m :: * -> *) a. Monad m => a -> m a
return [Sealed2 (PatchInfoAnd ('RepoType 'IsRebase) (RebaseChange p))]
qs)
                         PatchSet ('RepoType 'IsRebase) (RebaseChange p) wR wY
patchSet
                let logDoc :: Doc
logDoc = [DarcsFlag]
-> PatchSet ('RepoType 'IsRebase) (RebaseChange p) wR wY
-> ([(Sealed2
        (PatchInfoAnd ('RepoType 'IsRebase) (RebaseChange p)),
      [String])],
    [(String, String)], Maybe Doc)
-> Doc
forall (rt :: RepoType) (p :: * -> * -> *) wStart wX.
(Apply p, ApplyState p ~ Tree, ShowPatch p, IsHunk p,
 PrimPatchBase p, PatchListFormat p, Conflict p,
 CommuteNoConflicts p) =>
[DarcsFlag]
-> PatchSet rt p wStart wX
-> ([(Sealed2 (PatchInfoAnd rt p), [String])], [(String, String)],
    Maybe Doc)
-> Doc
changelog [DarcsFlag]
opts PatchSet ('RepoType 'IsRebase) (RebaseChange p) wR wY
patchSet ([(Sealed2 (PatchInfoAnd ('RepoType 'IsRebase) (RebaseChange p)),
   [String])],
 [(String, String)], Maybe Doc)
logInfo
                Printers -> Doc -> IO ()
putDocLnWith Printers
printers Doc
logDoc

-- | changes is an alias for log
changes :: DarcsCommand [DarcsFlag]
changes :: DarcsCommand [DarcsFlag]
changes = String
-> Maybe (DarcsCommand [DarcsFlag])
-> DarcsCommand [DarcsFlag]
-> DarcsCommand [DarcsFlag]
forall pf.
String
-> Maybe (DarcsCommand pf) -> DarcsCommand pf -> DarcsCommand pf
commandAlias "changes" Maybe (DarcsCommand [DarcsFlag])
forall a. Maybe a
Nothing DarcsCommand [DarcsFlag]
log

{-
TODO:

 - amend-record shows the diff between the conflicted state and the resolution, which is unhelpful
 - testing
 - make aggregate commands
 - argument handling
 - what should happen to patch comment on unsuspend?
 - don't just drop explicit dependencies:
    - turn patchnames/explicit deps into patch type and use commutation
 - repo representation
 - seem to be able to get a messed up unrevert context
 - darcs pull/get can setup a rebase patch in a remote repo without the right format
    - rebase patches seem to parse as empty rather than failing??
 - warn about suspending conflicts
 - indication of expected conflicts on unsuspend
    - why isn't ! when you do x accurate?
 - rebase obliterate for more efficient removing of suspended patches
 - rebase pull needs more UI work
    - automatically answer yes re suspension
    - offer all patches (so they can be kept in order)
       - or perhaps rebase suspend --complement?
 - rebase changes for viewing suspended patch
 - matching options for rebase unsuspend (etc)
 - make unsuspend actually display the patch helpfully like normal selection
 - amended patches will often be in both the target repo and in the rebase context, detect?
 - can we be more intelligent about conflict resolutions?
 - --all option to unsuspend
 - review other conflict options for unsuspend
 - warning message on suspend about not being able to unsuspend with unrecorded changes
 - aborting during a rebase pull or rebase suspend causes it to leave the repo marked for rebase
 - rebase suspend needs --match
 - patch count: get English right in <n> suspended patch(es)
 - darcs check should check integrity of rebase patch
 - review existence of reify and inject commands - bit of an internals hack
 - need to move rebase to front before adding amend-record hint (and test this)
 - print something while moving rebase to front
-}