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

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

import Darcs.Prelude

import Darcs.UI.Commands
    ( DarcsCommand(..), withStdOpts
    , normalCommand, hiddenCommand
    , commandAlias
    , defaultRepo, nodefaults
    , putInfo, putVerbose
    , amInHashedRepository
    )
import Darcs.UI.Commands.Apply ( applyCmd )
import Darcs.UI.Commands.Log ( changelog, logInfoFL )
import Darcs.UI.Commands.Pull ( pullCmd )
import Darcs.UI.Commands.Util ( historyEditHelp, preselectPatches )
import Darcs.UI.Completion ( fileArgs, prefArgs, noArgs )
import Darcs.UI.Flags
    ( DarcsFlag
    , externalMerge, allowConflicts
    , compress, diffingOpts
    , dryRun, reorder, verbosity, verbose
    , useCache, wantGuiPause
    , umask, changesReverse
    , diffAlgorithm, isInteractive
    , selectDeps, hasXmlOutput
    )
import qualified Darcs.UI.Flags as Flags ( getAuthor )
import Darcs.UI.Options
    ( (^), oid, odesc, ocheck
    , defaultFlags, (?)
    )
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
    , tentativelyAddPatch, finalizeRepositoryChanges
    , invalidateIndex
    , tentativelyRemovePatches, readRepo
    , tentativelyAddToPending, unrecordedChanges, applyToWorking
    , revertRepositoryChanges
    )
import Darcs.Repository.Flags ( UpdatePending(..), ExternalMerge(..) )
import Darcs.Repository.Hashed ( upgradeOldStyleRebase )
import Darcs.Repository.Merge ( tentativelyMergePatches )
import Darcs.Repository.Rebase
    ( readRebase
    , readTentativeRebase
    , writeTentativeRebase
    )
import Darcs.Repository.Resolution
    ( StandardResolution(..)
    , standardResolution
    , announceConflicts
    )

import Darcs.Patch ( invert, effect, commute, RepoPatch, displayPatch )
import Darcs.Patch.Apply ( ApplyState )
import Darcs.Patch.CommuteFn ( commuterIdFL )
import Darcs.Patch.Info ( displayPatchInfo )
import Darcs.Patch.Match ( secondMatch, splitSecondFL )
import Darcs.Patch.Named ( Named, fmapFL_Named, patchcontents, patch2patchinfo )
import Darcs.Patch.PatchInfoAnd ( PatchInfoAnd, hopefully, info, n2pia )
import Darcs.Patch.Prim ( canonizeFL, PrimPatch )
import Darcs.Patch.Rebase.Change
    ( RebaseChange(RC), rcToPia
    , extractRebaseChange, reifyRebaseChange
    , partitionUnconflicted
    , WithDroppedDeps(..), WDDNamed, commuterIdWDD
    , toRebaseChanges
    , simplifyPush, simplifyPushes
    )
import Darcs.Patch.Rebase.Fixup ( RebaseFixup(..), flToNamesPrims )
import Darcs.Patch.Rebase.Name ( RebaseName(..), commuteNameNamed )
import Darcs.Patch.Rebase.Suspended ( Suspended(..), addToEditsToSuspended )
import Darcs.Patch.Permutations ( partitionConflictingFL )
import Darcs.Patch.Progress ( progressRL )
import Darcs.Patch.RepoType ( RepoType(..), RebaseType(..) )
import Darcs.Patch.Set ( PatchSet, Origin, patchSet2RL )
import Darcs.Patch.Split ( primSplitter )
import Darcs.UI.ApplyPatches
    ( PatchApplier(..)
    , PatchProxy(..)
    , applyPatchesStart
    , applyPatchesFinish
    )
import Darcs.UI.External ( viewDocWith )
import Darcs.UI.SelectChanges
    ( runSelection, runInvertibleSelection
    , selectionConfig, selectionConfigGeneric, selectionConfigPrim
    , 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, reverseFL
    , (:>)(..)
    , RL(..), reverseRL, mapRL_RL
    , Fork(..)
    )
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
    ( text, ($$), redText
    , simplePrinters
    , renderString
    , formatWords
    , formatText
    , ($+$)
    )
import Darcs.Util.Printer.Color ( fancyPrinters )
import Darcs.Util.Progress ( debugMessage )
import Darcs.Util.Path ( AbsolutePath )

import Darcs.Util.SignalHandler ( withSignalsBlocked )
import Darcs.Util.Tree ( Tree )
import Darcs.Util.Exception ( die )

import Control.Monad ( when, void )
import Control.Monad.Trans ( liftIO )
import System.Exit ( exitSuccess )

rebase :: DarcsCommand
rebase :: DarcsCommand
rebase = SuperCommand :: String
-> String
-> Doc
-> String
-> ([DarcsFlag] -> IO (Either String ()))
-> [CommandControl]
-> DarcsCommand
SuperCommand
    { commandProgramName :: String
commandProgramName = String
"darcs"
    , commandName :: String
commandName = String
"rebase"
    , commandHelp :: Doc
commandHelp = Doc
rebaseHelp
    , commandDescription :: String
commandDescription = String
rebaseDescription
    , commandPrereq :: [DarcsFlag] -> IO (Either String ())
commandPrereq = [DarcsFlag] -> IO (Either String ())
amInHashedRepository
    , commandSubCommands :: [CommandControl]
commandSubCommands =
        [ DarcsCommand -> CommandControl
normalCommand DarcsCommand
pull
        , DarcsCommand -> CommandControl
normalCommand DarcsCommand
apply
        , DarcsCommand -> CommandControl
normalCommand DarcsCommand
suspend
        , DarcsCommand -> CommandControl
normalCommand DarcsCommand
unsuspend
        , DarcsCommand -> CommandControl
hiddenCommand DarcsCommand
reify
        , DarcsCommand -> CommandControl
hiddenCommand DarcsCommand
inject
        , DarcsCommand -> CommandControl
normalCommand DarcsCommand
obliterate
        , DarcsCommand -> CommandControl
normalCommand DarcsCommand
log
        , DarcsCommand -> CommandControl
hiddenCommand DarcsCommand
changes
        , DarcsCommand -> CommandControl
normalCommand DarcsCommand
upgrade
        ]
    }
  where
    rebaseDescription :: String
rebaseDescription = String
"Edit several patches at once."
    rebaseHelp :: Doc
rebaseHelp = Int -> [String] -> Doc
formatText Int
80
      [ String
"The `darcs rebase' command is used to edit a collection of darcs patches."
      , String
"The basic idea is that you can suspend patches from the end of\
        \ a repository. These patches are no longer part of the history and\
        \ have no effect on the working tree. Suspended patches are invisible\
        \ to commands that access the repository from the outside, such as\
        \ push, pull, clone, send, etc."
      , String
"The sequence of suspended patches can be manipulated in ways that are\
        \ not allowed for normal patches. For instance, `darcs rebase obliterate`\
        \ allows you to remove a patch in this sequence, even if other suspended\
        \ patches depend on it. These other patches will as a result become\
        \ conflicted."
      , String
"You can also operate on the normal patches in the usual way. If you add\
        \ or remove normal patches, the suspended patches will be automatically\
        \ adapted to still apply to the pristine state, possibly becoming\
        \ conflicted in the course."
      , String
"Note that as soon as a patch gets suspended, it will irrevocably loose\
        \ its identity. This means that suspending a patch is subject to the\
        \ usual warnings about editing the history of your project."
      , String
"The opposite of suspending a patch is to unsuspend it.\
        \ This turns it back into a normal patch.\
        \ If the patch is conflicted as a result of previous operations on\
        \ either the normal patches or the suspended patches, unsuspending\
        \ will create appropriate conflict markup. Note, however, that the\
        \ unsuspended patch itself WILL NOT BE CONFLICTED itself. This means\
        \ that there is no way to re-generate the conflict markup. Once you\
        \ removed it, by editing files or using `darcs revert`, any information\
        \ about the conflict is lost."
      , String
"As long as you have suspended patches, darcs will display a short\
        \ message after each command to remind you that your patch editing\
        \ operation is still in progress."
      ]

suspend :: DarcsCommand
suspend :: DarcsCommand
suspend = DarcsCommand :: String
-> String
-> Doc
-> String
-> Int
-> [String]
-> ((AbsolutePath, AbsolutePath)
    -> [DarcsFlag] -> [String] -> IO ())
-> ([DarcsFlag] -> IO (Either String ()))
-> ((AbsolutePath, AbsolutePath)
    -> [DarcsFlag] -> [String] -> IO [String])
-> ([DarcsFlag] -> AbsolutePath -> [String] -> IO [String])
-> [DarcsOptDescr DarcsFlag]
-> [DarcsOptDescr DarcsFlag]
-> [DarcsFlag]
-> ([DarcsFlag] -> [String])
-> DarcsCommand
DarcsCommand
    { commandProgramName :: String
commandProgramName = String
"darcs"
    , commandName :: String
commandName = String
"suspend"
    , commandHelp :: Doc
commandHelp = String -> Doc
text String
suspendDescription Doc -> Doc -> Doc
$+$ Doc
historyEditHelp
    , commandDescription :: String
commandDescription = String
suspendDescription
    , commandPrereq :: [DarcsFlag] -> IO (Either String ())
commandPrereq = [DarcsFlag] -> IO (Either String ())
amInHashedRepository
    , commandExtraArgs :: Int
commandExtraArgs = Int
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 -> UMask -> Any)
-> [DarcsOptDescr DarcsFlag]
forall (d :: * -> *) f a b. OptSpec d f a b -> [d f]
odesc OptSpec
  DarcsOptDescr DarcsFlag Any (Bool -> UseIndex -> UMask -> Any)
forall a.
OptSpec DarcsOptDescr DarcsFlag a (Bool -> UseIndex -> UMask -> a)
suspendAdvancedOpts
    , commandBasicOptions :: [DarcsOptDescr DarcsFlag]
commandBasicOptions = OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  ([NotInRemote]
   -> [MatchFlag]
   -> SelectDeps
   -> Maybe Bool
   -> WithSummary
   -> DiffAlgorithm
   -> Any)
-> [DarcsOptDescr DarcsFlag]
forall (d :: * -> *) f a b. OptSpec d f a b -> [d f]
odesc OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  ([NotInRemote]
   -> [MatchFlag]
   -> SelectDeps
   -> Maybe Bool
   -> WithSummary
   -> DiffAlgorithm
   -> Any)
forall a.
OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  ([NotInRemote]
   -> [MatchFlag]
   -> SelectDeps
   -> Maybe Bool
   -> WithSummary
   -> DiffAlgorithm
   -> a)
suspendBasicOpts
    , commandDefaults :: [DarcsFlag]
commandDefaults = OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  ([NotInRemote]
   -> [MatchFlag]
   -> SelectDeps
   -> Maybe Bool
   -> WithSummary
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> Bool
   -> UseIndex
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> [DarcsFlag])
-> [DarcsFlag]
forall (d :: * -> *) f b. OptSpec d f [f] b -> [f]
defaultFlags OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  ([NotInRemote]
   -> [MatchFlag]
   -> SelectDeps
   -> Maybe Bool
   -> WithSummary
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> Bool
   -> UseIndex
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> [DarcsFlag])
forall a.
DarcsOption
  a
  ([NotInRemote]
   -> [MatchFlag]
   -> SelectDeps
   -> Maybe Bool
   -> WithSummary
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> Bool
   -> UseIndex
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
suspendOpts
    , commandCheckOptions :: [DarcsFlag] -> [String]
commandCheckOptions = OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  ([NotInRemote]
   -> [MatchFlag]
   -> SelectDeps
   -> Maybe Bool
   -> WithSummary
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> Bool
   -> UseIndex
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> Any)
-> [DarcsFlag] -> [String]
forall (d :: * -> *) f a b. OptSpec d f a b -> [f] -> [String]
ocheck OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  ([NotInRemote]
   -> [MatchFlag]
   -> SelectDeps
   -> Maybe Bool
   -> WithSummary
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> Bool
   -> UseIndex
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> Any)
forall a.
DarcsOption
  a
  ([NotInRemote]
   -> [MatchFlag]
   -> SelectDeps
   -> Maybe Bool
   -> WithSummary
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> Bool
   -> UseIndex
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
suspendOpts
    }
  where
    suspendBasicOpts :: OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  ([NotInRemote]
   -> [MatchFlag]
   -> SelectDeps
   -> Maybe Bool
   -> WithSummary
   -> DiffAlgorithm
   -> a)
suspendBasicOpts
      = PrimOptSpec
  DarcsOptDescr
  DarcsFlag
  ([MatchFlag]
   -> SelectDeps -> Maybe Bool -> WithSummary -> DiffAlgorithm -> a)
  [NotInRemote]
PrimDarcsOption [NotInRemote]
O.notInRemote
      PrimOptSpec
  DarcsOptDescr
  DarcsFlag
  ([MatchFlag]
   -> SelectDeps -> Maybe Bool -> WithSummary -> DiffAlgorithm -> a)
  [NotInRemote]
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (SelectDeps -> Maybe Bool -> WithSummary -> DiffAlgorithm -> a)
     ([MatchFlag]
      -> SelectDeps -> Maybe Bool -> WithSummary -> DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (SelectDeps -> Maybe Bool -> WithSummary -> DiffAlgorithm -> a)
     ([NotInRemote]
      -> [MatchFlag]
      -> SelectDeps
      -> Maybe Bool
      -> WithSummary
      -> 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 -> WithSummary -> DiffAlgorithm -> a)
  ([MatchFlag]
   -> SelectDeps -> Maybe Bool -> WithSummary -> DiffAlgorithm -> a)
MatchOption
O.matchSeveralOrLast
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (SelectDeps -> Maybe Bool -> WithSummary -> DiffAlgorithm -> a)
  ([NotInRemote]
   -> [MatchFlag]
   -> SelectDeps
   -> Maybe Bool
   -> WithSummary
   -> DiffAlgorithm
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Maybe Bool -> WithSummary -> DiffAlgorithm -> a)
     (SelectDeps -> Maybe Bool -> WithSummary -> DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Maybe Bool -> WithSummary -> DiffAlgorithm -> a)
     ([NotInRemote]
      -> [MatchFlag]
      -> SelectDeps
      -> Maybe Bool
      -> WithSummary
      -> 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 -> WithSummary -> DiffAlgorithm -> a)
  (SelectDeps -> Maybe Bool -> WithSummary -> DiffAlgorithm -> a)
PrimDarcsOption SelectDeps
O.selectDeps
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe Bool -> WithSummary -> DiffAlgorithm -> a)
  ([NotInRemote]
   -> [MatchFlag]
   -> SelectDeps
   -> Maybe Bool
   -> WithSummary
   -> DiffAlgorithm
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (WithSummary -> DiffAlgorithm -> a)
     (Maybe Bool -> WithSummary -> DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (WithSummary -> DiffAlgorithm -> a)
     ([NotInRemote]
      -> [MatchFlag]
      -> SelectDeps
      -> Maybe Bool
      -> WithSummary
      -> 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
  (WithSummary -> DiffAlgorithm -> a)
  (Maybe Bool -> WithSummary -> DiffAlgorithm -> a)
PrimDarcsOption (Maybe Bool)
O.interactive
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (WithSummary -> DiffAlgorithm -> a)
  ([NotInRemote]
   -> [MatchFlag]
   -> SelectDeps
   -> Maybe Bool
   -> WithSummary
   -> DiffAlgorithm
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (DiffAlgorithm -> a)
     (WithSummary -> DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (DiffAlgorithm -> a)
     ([NotInRemote]
      -> [MatchFlag]
      -> SelectDeps
      -> Maybe Bool
      -> WithSummary
      -> 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)
  (WithSummary -> DiffAlgorithm -> a)
PrimDarcsOption WithSummary
O.withSummary
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (DiffAlgorithm -> a)
  ([NotInRemote]
   -> [MatchFlag]
   -> SelectDeps
   -> Maybe Bool
   -> WithSummary
   -> DiffAlgorithm
   -> a)
-> OptSpec DarcsOptDescr DarcsFlag a (DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     a
     ([NotInRemote]
      -> [MatchFlag]
      -> SelectDeps
      -> Maybe Bool
      -> WithSummary
      -> 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 -> UMask -> a)
suspendAdvancedOpts
      = PrimOptSpec DarcsOptDescr DarcsFlag (UseIndex -> UMask -> a) Bool
PrimDarcsOption Bool
O.changesReverse
      PrimOptSpec DarcsOptDescr DarcsFlag (UseIndex -> UMask -> a) Bool
-> OptSpec
     DarcsOptDescr DarcsFlag (UMask -> a) (UseIndex -> UMask -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (UMask -> a)
     (Bool -> UseIndex -> UMask -> 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 -> a) (UseIndex -> UMask -> a)
PrimDarcsOption UseIndex
O.useIndex
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (UMask -> a)
  (Bool -> UseIndex -> UMask -> a)
-> OptSpec DarcsOptDescr DarcsFlag a (UMask -> a)
-> OptSpec
     DarcsOptDescr DarcsFlag a (Bool -> UseIndex -> UMask -> 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 (UMask -> a)
PrimDarcsOption UMask
O.umask
    suspendOpts :: DarcsOption
  a
  ([NotInRemote]
   -> [MatchFlag]
   -> SelectDeps
   -> Maybe Bool
   -> WithSummary
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> Bool
   -> UseIndex
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
suspendOpts = OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe StdCmdAction
   -> Verbosity
   -> Bool
   -> UseIndex
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
  ([NotInRemote]
   -> [MatchFlag]
   -> SelectDeps
   -> Maybe Bool
   -> WithSummary
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> Bool
   -> UseIndex
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
forall a.
OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  ([NotInRemote]
   -> [MatchFlag]
   -> SelectDeps
   -> Maybe Bool
   -> WithSummary
   -> DiffAlgorithm
   -> a)
suspendBasicOpts OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe StdCmdAction
   -> Verbosity
   -> Bool
   -> UseIndex
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
  ([NotInRemote]
   -> [MatchFlag]
   -> SelectDeps
   -> Maybe Bool
   -> WithSummary
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> Bool
   -> UseIndex
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
-> DarcsOption
     (UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a)
     (Bool
      -> UseIndex
      -> UMask
      -> UseCache
      -> HooksConfig
      -> Bool
      -> Bool
      -> Bool
      -> a)
-> DarcsOption
     a
     ([NotInRemote]
      -> [MatchFlag]
      -> SelectDeps
      -> Maybe Bool
      -> WithSummary
      -> DiffAlgorithm
      -> Maybe StdCmdAction
      -> Verbosity
      -> Bool
      -> UseIndex
      -> UMask
      -> UseCache
      -> HooksConfig
      -> Bool
      -> Bool
      -> Bool
      -> a)
forall b c a.
DarcsOption (Maybe StdCmdAction -> Verbosity -> b) c
-> DarcsOption
     (UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a) b
-> DarcsOption a c
`withStdOpts` DarcsOption
  (UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a)
  (Bool
   -> UseIndex
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
forall a.
OptSpec DarcsOptDescr DarcsFlag a (Bool -> UseIndex -> UMask -> a)
suspendAdvancedOpts
    suspendDescription :: String
suspendDescription =
      String
"Select patches to move into a suspended state at the end of the repo."

suspendCmd :: (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
suspendCmd :: (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
suspendCmd (AbsolutePath, AbsolutePath)
_ [DarcsFlag]
opts [String]
_args =
    DryRun -> UseCache -> UpdatePending -> UMask -> RepoJob () -> IO ()
forall a.
DryRun -> UseCache -> UpdatePending -> 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) UpdatePending
YesUpdatePending (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
$
    (forall (p :: * -> * -> *) wR wU.
 (RepoPatch p, ApplyState p ~ Tree) =>
 Repository ('RepoType 'IsRebase) p wR wU wR -> IO ())
-> RepoJob ()
forall a.
(forall (p :: * -> * -> *) wR wU.
 (RepoPatch p, ApplyState p ~ Tree) =>
 Repository ('RepoType 'IsRebase) p wR wU wR -> IO a)
-> RepoJob a
StartRebaseJob ((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 -> do
    Suspended p wR wR
suspended <- Repository ('RepoType 'IsRebase) p wR wU wR
-> IO (Suspended p wR wR)
forall (p :: * -> * -> *) (rt :: RepoType) wR wU wT.
RepoPatch p =>
Repository rt p wR wU wT -> IO (Suspended p wT wT)
readTentativeRebase Repository ('RepoType 'IsRebase) p wR wU wR
_repository
    (PatchSet ('RepoType 'IsRebase) p Origin wZ
_ :> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wR
candidates) <- [DarcsFlag]
-> Repository ('RepoType 'IsRebase) p wR wU wR
-> IO
     ((:>)
        (PatchSet ('RepoType 'IsRebase) p)
        (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
        Origin
        wR)
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
(IsRepoType rt, RepoPatch p) =>
[DarcsFlag]
-> Repository rt p wR wU wT
-> IO ((:>) (PatchSet rt p) (FL (PatchInfoAnd rt p)) Origin wR)
preselectPatches [DarcsFlag]
opts Repository ('RepoType 'IsRebase) p wR wU wR
_repository
    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
        selection_config :: SelectionConfig (PatchInfoAnd ('RepoType 'IsRebase) p)
selection_config = WhichChanges
-> String
-> PatchSelectionOptions
-> Maybe (Splitter (PatchInfoAnd ('RepoType 'IsRebase) p))
-> Maybe [AnchoredPath]
-> SelectionConfig (PatchInfoAnd ('RepoType 'IsRebase) p)
forall (p :: * -> * -> *).
Matchable p =>
WhichChanges
-> String
-> PatchSelectionOptions
-> Maybe (Splitter p)
-> Maybe [AnchoredPath]
-> SelectionConfig p
selectionConfig
                              WhichChanges
direction String
"suspend" (Bool -> [DarcsFlag] -> PatchSelectionOptions
patchSelOpts Bool
True [DarcsFlag]
opts) Maybe (Splitter (PatchInfoAnd ('RepoType 'IsRebase) p))
forall a. Maybe a
Nothing Maybe [AnchoredPath]
forall a. Maybe a
Nothing
    (FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wZ
_ :> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wR
psToSuspend) <-
        FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wR
-> SelectionConfig (PatchInfoAnd ('RepoType 'IsRebase) p)
-> IO
     ((:>)
        (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
        (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
        wZ
        wR)
forall (p :: * -> * -> *) wX wY.
(MatchableRP p, ShowPatch p, ShowContextPatch p,
 ApplyState p ~ Tree, ApplyState p ~ ApplyState (PrimOf p)) =>
FL p wX wY -> SelectionConfig p -> IO ((:>) (FL p) (FL p) wX wY)
runSelection
            FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wR
candidates
            SelectionConfig (PatchInfoAnd ('RepoType 'IsRebase) p)
selection_config
    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 String
"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 String
"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.
PatchInfoAndG 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
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wR
-> IO (Repository ('RepoType 'IsRebase) p wR wU wZ)
forall (p :: * -> * -> *) wR wU wX.
(RepoPatch p, ApplyState p ~ Tree) =>
[DarcsFlag]
-> Repository ('RepoType 'IsRebase) p wR wU wR
-> Suspended p wR wR
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wR
-> IO (Repository ('RepoType 'IsRebase) p wR wU wX)
doSuspend [DarcsFlag]
opts Repository ('RepoType 'IsRebase) p wR wU wR
_repository Suspended p wR wR
suspended FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wR
psToSuspend
    Repository ('RepoType 'IsRebase) p wZ wU wZ
_repository <- Repository ('RepoType 'IsRebase) p wR wU wZ
-> UpdatePending
-> Compression
-> IO (Repository ('RepoType 'IsRebase) p wZ wU wZ)
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wT
-> UpdatePending -> Compression -> IO (Repository rt p wT wU wT)
finalizeRepositoryChanges Repository ('RepoType 'IsRebase) p wR wU wZ
_repository UpdatePending
YesUpdatePending (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 wX
     . (RepoPatch p, ApplyState p ~ Tree)
    => [DarcsFlag]
    -> Repository ('RepoType 'IsRebase) p wR wU wR
    -> Suspended p wR wR
    -> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wR
    -> IO (Repository ('RepoType 'IsRebase) p wR wU wX)
doSuspend :: [DarcsFlag]
-> Repository ('RepoType 'IsRebase) p wR wU wR
-> Suspended p wR wR
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wR
-> IO (Repository ('RepoType 'IsRebase) p wR wU wX)
doSuspend [DarcsFlag]
opts Repository ('RepoType 'IsRebase) p wR wU wR
_repository Suspended p wR wR
suspended FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wR
psToSuspend = do
    let (UseIndex
_, ScanKnown
_, DiffAlgorithm
da) = [DarcsFlag] -> (UseIndex, ScanKnown, DiffAlgorithm)
diffingOpts [DarcsFlag]
opts
    FL (PrimOf p) wR wU
pend <- (UseIndex, ScanKnown, DiffAlgorithm)
-> LookForMoves
-> LookForReplaces
-> Repository ('RepoType 'IsRebase) p wR wU wR
-> Maybe [AnchoredPath]
-> IO (FL (PrimOf p) wR wU)
forall (p :: * -> * -> *) (rt :: RepoType) wR wU.
(RepoPatch p, ApplyState p ~ Tree) =>
(UseIndex, ScanKnown, DiffAlgorithm)
-> LookForMoves
-> LookForReplaces
-> Repository rt p wR wU wR
-> Maybe [AnchoredPath]
-> IO (FL (PrimOf p) wR wU)
unrecordedChanges ([DarcsFlag] -> (UseIndex, ScanKnown, DiffAlgorithm)
diffingOpts [DarcsFlag]
opts)
      LookForMoves
O.NoLookForMoves LookForReplaces
O.NoLookForReplaces
      Repository ('RepoType 'IsRebase) p wR wU wR
_repository Maybe [AnchoredPath]
forall a. Maybe a
Nothing
    FlippedSeal FL (PrimOf p) wX wU
psAfterPending <-
        let effectPsToSuspend :: FL (PrimOf (FL (PatchInfoAnd ('RepoType 'IsRebase) p))) wX wR
effectPsToSuspend = FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wR
-> FL (PrimOf (FL (PatchInfoAnd ('RepoType 'IsRebase) p))) wX wR
forall (p :: * -> * -> *) wX wY.
Effect p =>
p wX wY -> FL (PrimOf p) wX wY
effect FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wR
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 wR
effectPsToSuspend FL (PrimOf p) wX wR
-> FL (PrimOf p) wR 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) wR wU
pend) of
            Just (FL (PrimOf p) wX wZ
_ :> 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)
            Maybe ((:>) (FL (PrimOf p)) (FL (PrimOf p)) wX wU)
Nothing -> do
                [DarcsFlag] -> Doc -> IO ()
putVerbose [DarcsFlag]
opts (Doc -> IO ()) -> Doc -> IO ()
forall a b. (a -> b) -> a -> b
$
                    let invPsEffect :: FL (PrimOf p) wR wX
invPsEffect = FL (PrimOf p) wX wR -> FL (PrimOf p) wR wX
forall (p :: * -> * -> *) wX wY. Invert p => p wX wY -> p wY wX
invert FL (PrimOf p) wX wR
effectPsToSuspend
                    in
                    case (FL (PrimOf p) wR wX
-> FL (PrimOf p) wR wU
-> (:>) (FL (PrimOf p)) (FL (PrimOf p)) wR wX
forall (p :: * -> * -> *) wX wY wZ.
(Commute p, CleanMerge p) =>
FL p wX wY -> FL p wX wZ -> (:>) (FL p) (FL p) wX wY
partitionConflictingFL FL (PrimOf p) wR wX
invPsEffect FL (PrimOf p) wR wU
pend, FL (PrimOf p) wR wU
-> FL (PrimOf p) wR wX
-> (:>) (FL (PrimOf p)) (FL (PrimOf p)) wR wU
forall (p :: * -> * -> *) wX wY wZ.
(Commute p, CleanMerge p) =>
FL p wX wY -> FL p wX wZ -> (:>) (FL p) (FL p) wX wY
partitionConflictingFL FL (PrimOf p) wR wU
pend FL (PrimOf p) wR wX
invPsEffect) of
                        (FL (PrimOf p) wR wZ
_ :> FL (PrimOf p) wZ wX
invSuspendedConflicts, FL (PrimOf p) wR wZ
_ :> 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 String
"These changes in the suspended patches:" Doc -> Doc -> Doc
$$
                            FL (PrimOf p) wX wZ -> Doc
forall (p :: * -> * -> *) wX wY. ShowPatchBasic p => p wX wY -> Doc
displayPatch FL (PrimOf p) wX wZ
suspendedConflicts Doc -> Doc -> Doc
$$
                            String -> Doc
redText String
"...conflict with these local changes:" Doc -> Doc -> Doc
$$
                            FL (PrimOf p) wZ wU -> Doc
forall (p :: * -> * -> *) wX wY. ShowPatchBasic p => p wX wY -> Doc
displayPatch 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
$ String
"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 String
"" else String
" Use --verbose to see the details."


    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 wX
_repository <-
      Repository ('RepoType 'IsRebase) p wR wU wR
-> Compression
-> UpdatePending
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wR
-> 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
-> UpdatePending
-> 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) UpdatePending
YesUpdatePending FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wR
psToSuspend
    Repository ('RepoType 'IsRebase) p wR wU wX
-> FL (PrimOf p) wR wX -> IO ()
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT wX wY.
RepoPatch p =>
Repository rt p wR wU wT -> FL (PrimOf p) wX wY -> IO ()
tentativelyAddToPending Repository ('RepoType 'IsRebase) p wR wU wX
_repository (FL (PrimOf p) wR wX -> IO ()) -> FL (PrimOf p) wR wX -> IO ()
forall a b. (a -> b) -> a -> b
$ FL (PrimOf p) wX wR -> FL (PrimOf p) wR wX
forall (p :: * -> * -> *) wX wY. Invert p => p wX wY -> p wY wX
invert (FL (PrimOf p) wX wR -> FL (PrimOf p) wR wX)
-> FL (PrimOf p) wX wR -> FL (PrimOf p) wR wX
forall a b. (a -> b) -> a -> b
$ FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wR
-> FL (PrimOf (FL (PatchInfoAnd ('RepoType 'IsRebase) p))) wX wR
forall (p :: * -> * -> *) wX wY.
Effect p =>
p wX wY -> FL (PrimOf p) wX wY
effect FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wR
psToSuspend
    Suspended p wX wX
new_suspended <- DiffAlgorithm
-> FL (Named p) wX wR
-> Suspended p wR wR
-> IO (Suspended p wX wX)
forall (p :: * -> * -> *) wX wY.
RepoPatch p =>
DiffAlgorithm
-> FL (Named p) wX wY
-> Suspended p wY wY
-> IO (Suspended p wX wX)
addToEditsToSuspended DiffAlgorithm
da ((forall wW wY.
 PatchInfoAnd ('RepoType 'IsRebase) p wW wY -> Named p wW wY)
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wR
-> FL (Named p) wX wR
forall (a :: * -> * -> *) (b :: * -> * -> *) wX wZ.
(forall wW wY. a wW wY -> b wW wY) -> FL a wX wZ -> FL b wX wZ
mapFL_FL forall wW wY.
PatchInfoAnd ('RepoType 'IsRebase) p wW wY -> Named p wW wY
forall (rt :: RepoType) (p :: * -> * -> *) wA wB.
PatchInfoAndG rt p wA wB -> p wA wB
hopefully FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wR
psToSuspend) Suspended p wR wR
suspended
    Repository ('RepoType 'IsRebase) p wR wU wX
-> Suspended p wX wX -> IO ()
forall (p :: * -> * -> *) (rt :: RepoType) wR wU wT.
RepoPatch p =>
Repository rt p wR wU wT -> Suspended p wT wT -> IO ()
writeTentativeRebase Repository ('RepoType 'IsRebase) p wR wU wX
_repository Suspended p wX wX
new_suspended
    IO () -> IO ()
forall a. IO a -> IO a
withSignalsBlocked (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
      IO (Repository ('RepoType 'IsRebase) p wR wX wX) -> IO ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (IO (Repository ('RepoType 'IsRebase) p wR wX wX) -> IO ())
-> IO (Repository ('RepoType 'IsRebase) p wR wX wX) -> IO ()
forall a b. (a -> b) -> a -> b
$ 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)
    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

unsuspend :: DarcsCommand
unsuspend :: DarcsCommand
unsuspend = DarcsCommand :: String
-> String
-> Doc
-> String
-> Int
-> [String]
-> ((AbsolutePath, AbsolutePath)
    -> [DarcsFlag] -> [String] -> IO ())
-> ([DarcsFlag] -> IO (Either String ()))
-> ((AbsolutePath, AbsolutePath)
    -> [DarcsFlag] -> [String] -> IO [String])
-> ([DarcsFlag] -> AbsolutePath -> [String] -> IO [String])
-> [DarcsOptDescr DarcsFlag]
-> [DarcsOptDescr DarcsFlag]
-> [DarcsFlag]
-> ([DarcsFlag] -> [String])
-> DarcsCommand
DarcsCommand
    { commandProgramName :: String
commandProgramName = String
"darcs"
    , commandName :: String
commandName = String
"unsuspend"
    , commandHelp :: Doc
commandHelp = String -> Doc
text String
unsuspendDescription
    , commandDescription :: String
commandDescription = String
unsuspendDescription
    , commandPrereq :: [DarcsFlag] -> IO (Either String ())
commandPrereq = [DarcsFlag] -> IO (Either String ())
amInHashedRepository
    , commandExtraArgs :: Int
commandExtraArgs = Int
0
    , commandExtraArgHelp :: [String]
commandExtraArgHelp = []
    , commandCommand :: (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
commandCommand = String
-> Bool
-> (AbsolutePath, AbsolutePath)
-> [DarcsFlag]
-> [String]
-> IO ()
unsuspendCmd String
"unsuspend" 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
   -> WithSummary
   -> 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
   -> WithSummary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Any)
forall a.
OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> WithSummary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> a)
unsuspendBasicOpts
    , commandDefaults :: [DarcsFlag]
commandDefaults = OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> WithSummary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> [DarcsFlag])
-> [DarcsFlag]
forall (d :: * -> *) f b. OptSpec d f [f] b -> [f]
defaultFlags OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> WithSummary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> [DarcsFlag])
forall a.
DarcsOption
  a
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> WithSummary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
unsuspendOpts
    , commandCheckOptions :: [DarcsFlag] -> [String]
commandCheckOptions = OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> WithSummary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> 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
   -> WithSummary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> Any)
forall a.
DarcsOption
  a
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> WithSummary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
unsuspendOpts
    }
  where
    unsuspendBasicOpts :: OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> WithSummary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> a)
unsuspendBasicOpts
      = PrimOptSpec
  DarcsOptDescr
  DarcsFlag
  ([MatchFlag]
   -> Maybe Bool
   -> WithSummary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> a)
  (Maybe AllowConflicts)
PrimDarcsOption (Maybe AllowConflicts)
O.conflictsYes
      PrimOptSpec
  DarcsOptDescr
  DarcsFlag
  ([MatchFlag]
   -> Maybe Bool
   -> WithSummary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> a)
  (Maybe AllowConflicts)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Maybe Bool
      -> WithSummary
      -> ExternalMerge
      -> Bool
      -> Maybe String
      -> DiffAlgorithm
      -> a)
     ([MatchFlag]
      -> Maybe Bool
      -> WithSummary
      -> ExternalMerge
      -> Bool
      -> Maybe String
      -> DiffAlgorithm
      -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Maybe Bool
      -> WithSummary
      -> ExternalMerge
      -> Bool
      -> Maybe String
      -> DiffAlgorithm
      -> a)
     (Maybe AllowConflicts
      -> [MatchFlag]
      -> Maybe Bool
      -> WithSummary
      -> 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
   -> WithSummary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> a)
  ([MatchFlag]
   -> Maybe Bool
   -> WithSummary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> a)
MatchOption
O.matchSeveralOrFirst
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe Bool
   -> WithSummary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> a)
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> WithSummary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (WithSummary
      -> ExternalMerge -> Bool -> Maybe String -> DiffAlgorithm -> a)
     (Maybe Bool
      -> WithSummary
      -> ExternalMerge
      -> Bool
      -> Maybe String
      -> DiffAlgorithm
      -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (WithSummary
      -> ExternalMerge -> Bool -> Maybe String -> DiffAlgorithm -> a)
     (Maybe AllowConflicts
      -> [MatchFlag]
      -> Maybe Bool
      -> WithSummary
      -> 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
  (WithSummary
   -> ExternalMerge -> Bool -> Maybe String -> DiffAlgorithm -> a)
  (Maybe Bool
   -> WithSummary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> a)
PrimDarcsOption (Maybe Bool)
O.interactive
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (WithSummary
   -> ExternalMerge -> Bool -> Maybe String -> DiffAlgorithm -> a)
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> WithSummary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (ExternalMerge -> Bool -> Maybe String -> DiffAlgorithm -> a)
     (WithSummary
      -> ExternalMerge -> Bool -> Maybe String -> DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (ExternalMerge -> Bool -> Maybe String -> DiffAlgorithm -> a)
     (Maybe AllowConflicts
      -> [MatchFlag]
      -> Maybe Bool
      -> WithSummary
      -> 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)
  (WithSummary
   -> ExternalMerge -> Bool -> Maybe String -> DiffAlgorithm -> a)
PrimDarcsOption WithSummary
O.withSummary
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (ExternalMerge -> Bool -> Maybe String -> DiffAlgorithm -> a)
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> WithSummary
   -> 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
      -> WithSummary
      -> 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
   -> WithSummary
   -> 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
      -> WithSummary
      -> 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
   -> WithSummary
   -> 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
      -> WithSummary
      -> 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
   -> WithSummary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> a)
-> OptSpec DarcsOptDescr DarcsFlag a (DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     a
     (Maybe AllowConflicts
      -> [MatchFlag]
      -> Maybe Bool
      -> WithSummary
      -> 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
   -> WithSummary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
unsuspendOpts = OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe StdCmdAction
   -> Verbosity
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> WithSummary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
forall a.
OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> WithSummary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> a)
unsuspendBasicOpts OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe StdCmdAction
   -> Verbosity
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
  (Maybe AllowConflicts
   -> [MatchFlag]
   -> Maybe Bool
   -> WithSummary
   -> ExternalMerge
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> UseIndex
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
-> DarcsOption
     (UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a)
     (UseIndex -> UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a)
-> DarcsOption
     a
     (Maybe AllowConflicts
      -> [MatchFlag]
      -> Maybe Bool
      -> WithSummary
      -> ExternalMerge
      -> Bool
      -> Maybe String
      -> DiffAlgorithm
      -> Maybe StdCmdAction
      -> Verbosity
      -> UseIndex
      -> UseCache
      -> HooksConfig
      -> Bool
      -> Bool
      -> Bool
      -> a)
forall b c a.
DarcsOption (Maybe StdCmdAction -> Verbosity -> b) c
-> DarcsOption
     (UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a) b
-> DarcsOption a c
`withStdOpts` DarcsOption
  (UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a)
  (UseIndex -> UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a)
PrimDarcsOption UseIndex
unsuspendAdvancedOpts
    unsuspendDescription :: String
unsuspendDescription =
      String
"Select suspended patches to restore to the end of the repo."

reify :: DarcsCommand
reify :: DarcsCommand
reify = DarcsCommand :: String
-> String
-> Doc
-> String
-> Int
-> [String]
-> ((AbsolutePath, AbsolutePath)
    -> [DarcsFlag] -> [String] -> IO ())
-> ([DarcsFlag] -> IO (Either String ()))
-> ((AbsolutePath, AbsolutePath)
    -> [DarcsFlag] -> [String] -> IO [String])
-> ([DarcsFlag] -> AbsolutePath -> [String] -> IO [String])
-> [DarcsOptDescr DarcsFlag]
-> [DarcsOptDescr DarcsFlag]
-> [DarcsFlag]
-> ([DarcsFlag] -> [String])
-> DarcsCommand
DarcsCommand
    { commandProgramName :: String
commandProgramName = String
"darcs"
    , commandName :: String
commandName = String
"reify"
    , commandHelp :: Doc
commandHelp = String -> Doc
text String
reifyDescription
    , commandDescription :: String
commandDescription = String
reifyDescription
    , commandPrereq :: [DarcsFlag] -> IO (Either String ())
commandPrereq = [DarcsFlag] -> IO (Either String ())
amInHashedRepository
    , commandExtraArgs :: Int
commandExtraArgs = Int
0
    , commandExtraArgHelp :: [String]
commandExtraArgHelp = []
    , commandCommand :: (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
commandCommand = String
-> Bool
-> (AbsolutePath, AbsolutePath)
-> [DarcsFlag]
-> [String]
-> IO ()
unsuspendCmd String
"reify" 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
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> [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
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> [DarcsFlag])
forall a.
DarcsOption
  a
  ([MatchFlag]
   -> Maybe Bool
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
reifyOpts
    , commandCheckOptions :: [DarcsFlag] -> [String]
commandCheckOptions = OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  ([MatchFlag]
   -> Maybe Bool
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> 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
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> Any)
forall a.
DarcsOption
  a
  ([MatchFlag]
   -> Maybe Bool
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> 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
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
reifyOpts = OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe StdCmdAction
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
  ([MatchFlag]
   -> Maybe Bool
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
forall a.
OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  ([MatchFlag]
   -> Maybe Bool -> Bool -> Maybe String -> DiffAlgorithm -> a)
reifyBasicOpts OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe StdCmdAction
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
  ([MatchFlag]
   -> Maybe Bool
   -> Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
-> DarcsOption
     (UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a)
     (UMask -> UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a)
-> DarcsOption
     a
     ([MatchFlag]
      -> Maybe Bool
      -> Bool
      -> Maybe String
      -> DiffAlgorithm
      -> Maybe StdCmdAction
      -> Verbosity
      -> UMask
      -> UseCache
      -> HooksConfig
      -> Bool
      -> Bool
      -> Bool
      -> a)
forall b c a.
DarcsOption (Maybe StdCmdAction -> Verbosity -> b) c
-> DarcsOption
     (UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a) b
-> DarcsOption a c
`withStdOpts` DarcsOption
  (UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a)
  (UMask -> UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a)
PrimDarcsOption UMask
O.umask
    reifyDescription :: String
reifyDescription =
      String
"Select suspended patches to restore to the end of the repo,\
      \ reifying any fixup patches."

unsuspendCmd :: String -> Bool -> (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
unsuspendCmd :: String
-> Bool
-> (AbsolutePath, AbsolutePath)
-> [DarcsFlag]
-> [String]
-> IO ()
unsuspendCmd String
cmd Bool
reifyFixups (AbsolutePath, AbsolutePath)
_ [DarcsFlag]
opts [String]
_args =
  DryRun -> UseCache -> UpdatePending -> UMask -> RepoJob () -> IO ()
forall a.
DryRun -> UseCache -> UpdatePending -> 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) UpdatePending
YesUpdatePending (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
$
  (forall (p :: * -> * -> *) wR wU.
 (RepoPatch p, ApplyState p ~ Tree) =>
 Repository ('RepoType 'IsRebase) p wR wU wR -> IO ())
-> RepoJob ()
forall a.
(forall (p :: * -> * -> *) wR wU.
 (RepoPatch p, ApplyState p ~ Tree) =>
 Repository ('RepoType 'IsRebase) p wR wU wR -> IO a)
-> RepoJob a
RebaseJob ((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 -> do
    EqCheck wR wU
IsEq <- Repository ('RepoType 'IsRebase) p wR wU wR -> IO (EqCheck wR wU)
forall (p :: * -> * -> *) (rt :: RepoType) wR wU.
(RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wR -> IO (EqCheck wR wU)
requireNoUnrecordedChanges Repository ('RepoType 'IsRebase) p wR wU wR
_repository

    Items FL (RebaseChange (PrimOf p)) wR wY
selects <- Repository ('RepoType 'IsRebase) p wR wU wR
-> IO (Suspended p wR wR)
forall (p :: * -> * -> *) (rt :: RepoType) wR wU wT.
RepoPatch p =>
Repository rt p wR wU wT -> IO (Suspended p wT wT)
readTentativeRebase Repository ('RepoType 'IsRebase) p wR wU wR
_repository

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

    FL (RebaseChange (PrimOf p)) wR wZ
offer :> RL (RebaseChange (PrimOf p)) wZ wZ
dontoffer <-
        (:>)
  (FL (RebaseChange (PrimOf p))) (RL (RebaseChange (PrimOf p))) wR wZ
-> IO
     ((:>)
        (FL (RebaseChange (PrimOf p)))
        (RL (RebaseChange (PrimOf p)))
        wR
        wZ)
forall (m :: * -> *) a. Monad m => a -> m a
return ((:>)
   (FL (RebaseChange (PrimOf p))) (RL (RebaseChange (PrimOf p))) wR wZ
 -> IO
      ((:>)
         (FL (RebaseChange (PrimOf p)))
         (RL (RebaseChange (PrimOf p)))
         wR
         wZ))
-> (:>)
     (FL (RebaseChange (PrimOf p))) (RL (RebaseChange (PrimOf p))) wR wZ
-> IO
     ((:>)
        (FL (RebaseChange (PrimOf p)))
        (RL (RebaseChange (PrimOf 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
              Maybe AllowConflicts
Nothing -> FL (RebaseChange (PrimOf p)) wR wZ
-> (:>)
     (FL (RebaseChange (PrimOf p))) (RL (RebaseChange (PrimOf p))) wR wZ
forall (prim :: * -> * -> *) wX wY.
Commute prim =>
FL (RebaseChange prim) wX wY
-> (:>) (FL (RebaseChange prim)) (RL (RebaseChange prim)) wX wY
partitionUnconflicted FL (RebaseChange (PrimOf p)) wR wZ
inRange -- skip conflicts
              Just AllowConflicts
_ -> FL (RebaseChange (PrimOf p)) wR wZ
inRange FL (RebaseChange (PrimOf p)) wR wZ
-> RL (RebaseChange (PrimOf p)) wZ wZ
-> (:>)
     (FL (RebaseChange (PrimOf p))) (RL (RebaseChange (PrimOf p))) wR wZ
forall (a1 :: * -> * -> *) (a2 :: * -> * -> *) wX wY wZ.
a1 wX wZ -> a2 wZ wY -> (:>) a1 a2 wX wY
:> RL (RebaseChange (PrimOf p)) wZ wZ
forall (a :: * -> * -> *) wX. RL a wX wX
NilRL

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

    RL (RebaseChange (PrimOf p)) wZ wZ -> IO ()
forall (a :: * -> * -> *) wX wZ. RL a wX wZ -> IO ()
warnSkip RL (RebaseChange (PrimOf p)) wZ wZ
dontoffer

    let selection_config :: SelectionConfig (RebaseChange (PrimOf p))
selection_config = (forall wA wB.
 RebaseChange (PrimOf p) wA wB
 -> Sealed2 (PatchInfoAnd ('RepoType 'NoRebase) (PrimOf p)))
-> WhichChanges
-> String
-> PatchSelectionOptions
-> Maybe [AnchoredPath]
-> SelectionConfig (RebaseChange (PrimOf p))
forall (p :: * -> * -> *) (q :: * -> * -> *).
Matchable p =>
(forall wX wY. q wX wY -> Sealed2 p)
-> WhichChanges
-> String
-> PatchSelectionOptions
-> Maybe [AnchoredPath]
-> SelectionConfig q
selectionConfigGeneric forall wA wB.
RebaseChange (PrimOf p) wA wB
-> Sealed2 (PatchInfoAnd ('RepoType 'NoRebase) (PrimOf p))
forall (prim :: * -> * -> *) wX wY.
RebaseChange prim wX wY
-> Sealed2 (PatchInfoAnd ('RepoType 'NoRebase) prim)
rcToPia WhichChanges
First String
"unsuspend" (Bool -> [DarcsFlag] -> PatchSelectionOptions
patchSelOpts Bool
True [DarcsFlag]
opts) Maybe [AnchoredPath]
forall a. Maybe a
Nothing
    (FL (RebaseChange (PrimOf p)) wR wZ
chosen :> FL (RebaseChange (PrimOf p)) wZ wZ
keep) <- FL (RebaseChange (PrimOf p)) wR wZ
-> SelectionConfig (RebaseChange (PrimOf p))
-> IO
     ((:>)
        (FL (RebaseChange (PrimOf p)))
        (FL (RebaseChange (PrimOf p)))
        wR
        wZ)
forall (p :: * -> * -> *) wX wY.
(MatchableRP p, ShowPatch p, ShowContextPatch p,
 ApplyState p ~ Tree, ApplyState p ~ ApplyState (PrimOf p)) =>
FL p wX wY -> SelectionConfig p -> IO ((:>) (FL p) (FL p) wX wY)
runSelection FL (RebaseChange (PrimOf p)) wR wZ
offer SelectionConfig (RebaseChange (PrimOf p))
selection_config
    Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (FL (RebaseChange (PrimOf p)) wR wZ -> Bool
forall (a :: * -> * -> *) wX wZ. FL a wX wZ -> Bool
nullFL FL (RebaseChange (PrimOf p)) wR wZ
chosen) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ do String -> IO ()
putStrLn String
"No patches selected!"
                              IO ()
forall a. IO a
exitSuccess

    FL (WDDNamed p) wR wZ
ps_to_unsuspend :> FL (RebaseFixup (PrimOf p)) wZ wZ
chosen_fixups <-
      if Bool
reifyFixups
        then do
          String
author <- Maybe String -> Bool -> IO String
Flags.getAuthor (PrimDarcsOption (Maybe String)
O.author PrimDarcsOption (Maybe String) -> [DarcsFlag] -> Maybe String
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) Bool
False
          String
-> FL (RebaseChange (PrimOf p)) wR wZ
-> IO ((:>) (FL (WDDNamed p)) (FL (RebaseFixup (PrimOf p))) wR wZ)
forall (p :: * -> * -> *) wX wY.
FromPrim p =>
String
-> FL (RebaseChange (PrimOf p)) wX wY
-> IO ((:>) (FL (WDDNamed p)) (FL (RebaseFixup (PrimOf p))) wX wY)
reifyRebaseChange String
author FL (RebaseChange (PrimOf p)) wR wZ
chosen
        else (:>) (FL (WDDNamed p)) (FL (RebaseFixup (PrimOf p))) wR wZ
-> IO ((:>) (FL (WDDNamed p)) (FL (RebaseFixup (PrimOf p))) wR wZ)
forall (m :: * -> *) a. Monad m => a -> m a
return ((:>) (FL (WDDNamed p)) (FL (RebaseFixup (PrimOf p))) wR wZ
 -> IO ((:>) (FL (WDDNamed p)) (FL (RebaseFixup (PrimOf p))) wR wZ))
-> (:>) (FL (WDDNamed p)) (FL (RebaseFixup (PrimOf p))) wR wZ
-> IO ((:>) (FL (WDDNamed p)) (FL (RebaseFixup (PrimOf p))) wR wZ)
forall a b. (a -> b) -> a -> b
$ DiffAlgorithm
-> FL (RebaseChange (PrimOf p)) wR wZ
-> (:>) (FL (WDDNamed p)) (FL (RebaseFixup (PrimOf p))) wR wZ
forall (p :: * -> * -> *) wX wY.
RepoPatch p =>
DiffAlgorithm
-> FL (RebaseChange (PrimOf p)) wX wY
-> (:>) (FL (WDDNamed p)) (FL (RebaseFixup (PrimOf p))) wX wY
extractRebaseChange (PrimDarcsOption DiffAlgorithm
diffAlgorithm PrimDarcsOption DiffAlgorithm -> [DarcsFlag] -> DiffAlgorithm
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts) FL (RebaseChange (PrimOf 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 (RebaseChange (PrimOf p)) wZ)
ps_to_keep = DiffAlgorithm
-> FL (RebaseFixup (PrimOf p)) wZ wZ
-> FL (RebaseChange (PrimOf p)) wZ wY
-> Sealed (FL (RebaseChange (PrimOf p)) wZ)
forall (prim :: * -> * -> *) wX wY wZ.
PrimPatch prim =>
DiffAlgorithm
-> FL (RebaseFixup prim) wX wY
-> FL (RebaseChange prim) wY wZ
-> Sealed (FL (RebaseChange prim) wX)
simplifyPushes DiffAlgorithm
da FL (RebaseFixup (PrimOf p)) wZ wZ
chosen_fixups (FL (RebaseChange (PrimOf p)) wZ wY
 -> Sealed (FL (RebaseChange (PrimOf p)) wZ))
-> FL (RebaseChange (PrimOf p)) wZ wY
-> Sealed (FL (RebaseChange (PrimOf p)) wZ)
forall a b. (a -> b) -> a -> b
$
                     FL (RebaseChange (PrimOf p)) wZ wZ
keep FL (RebaseChange (PrimOf p)) wZ wZ
-> FL (RebaseChange (PrimOf p)) wZ wY
-> FL (RebaseChange (PrimOf p)) wZ wY
forall (a :: * -> * -> *) wX wY wZ.
FL a wX wY -> FL a wY wZ -> FL a wX wZ
+>+ RL (RebaseChange (PrimOf p)) wZ wZ
-> FL (RebaseChange (PrimOf p)) wZ wZ
forall (a :: * -> * -> *) wX wZ. RL a wX wZ -> FL a wX wZ
reverseRL RL (RebaseChange (PrimOf p)) wZ wZ
dontoffer FL (RebaseChange (PrimOf p)) wZ wZ
-> FL (RebaseChange (PrimOf p)) wZ wY
-> FL (RebaseChange (PrimOf p)) wZ wY
forall (a :: * -> * -> *) wX wY wZ.
FL a wX wY -> FL a wY wZ -> FL a wX wZ
+>+ FL (RebaseChange (PrimOf p)) wZ wY
outOfRange

    PatchSet ('RepoType 'IsRebase) p Origin wR
context <- 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

    let conflicts :: StandardResolution (PrimOf p) wZ
conflicts =
          RL (PatchInfoAnd ('RepoType 'IsRebase) p) Origin wR
-> RL (PatchInfoAnd ('RepoType 'IsRebase) p) wR wZ
-> StandardResolution (PrimOf p) wZ
forall (p :: * -> * -> *) (rt :: RepoType) wO wX wY.
(Commute p, PrimPatchBase p, Conflict p) =>
RL (PatchInfoAnd rt p) wO wX
-> RL (PatchInfoAnd rt p) wX wY -> StandardResolution (PrimOf p) wY
standardResolution (PatchSet ('RepoType 'IsRebase) p Origin wR
-> RL (PatchInfoAnd ('RepoType 'IsRebase) p) Origin wR
forall (rt :: RepoType) (p :: * -> * -> *) wStart wX.
PatchSet rt p wStart wX -> RL (PatchInfoAnd rt p) wStart wX
patchSet2RL PatchSet ('RepoType 'IsRebase) p Origin wR
context) (RL (PatchInfoAnd ('RepoType 'IsRebase) p) wR wZ
 -> StandardResolution (PrimOf p) wZ)
-> RL (PatchInfoAnd ('RepoType 'IsRebase) p) wR wZ
-> StandardResolution (PrimOf p) wZ
forall a b. (a -> b) -> a -> b
$
          String
-> RL (PatchInfoAnd ('RepoType 'IsRebase) p) wR wZ
-> RL (PatchInfoAnd ('RepoType 'IsRebase) p) wR wZ
forall (a :: * -> * -> *) wX wY. String -> RL a wX wY -> RL a wX wY
progressRL String
"Examining patches for conflicts" (RL (PatchInfoAnd ('RepoType 'IsRebase) p) wR wZ
 -> RL (PatchInfoAnd ('RepoType 'IsRebase) p) wR wZ)
-> RL (PatchInfoAnd ('RepoType 'IsRebase) p) wR wZ
-> RL (PatchInfoAnd ('RepoType 'IsRebase) p) wR wZ
forall a b. (a -> b) -> a -> b
$
          (forall wW wY.
 WithDroppedDeps (Named p) wW wY
 -> PatchInfoAnd ('RepoType 'IsRebase) p wW wY)
-> RL (WDDNamed p) wR wZ
-> RL (PatchInfoAnd ('RepoType 'IsRebase) p) wR wZ
forall (a :: * -> * -> *) (b :: * -> * -> *) wX wZ.
(forall wW wY. a wW wY -> b wW wY) -> RL a wX wZ -> RL b wX wZ
mapRL_RL (Named p wW wY
-> PatchInfoAndG ('RepoType 'IsRebase) (Named p) wW wY
forall (p :: * -> * -> *) wX wY (rt :: RepoType).
(Ident p, PatchId p ~ PatchInfo) =>
p wX wY -> PatchInfoAndG rt p wX wY
n2pia (Named p wW wY
 -> PatchInfoAndG ('RepoType 'IsRebase) (Named p) wW wY)
-> (WithDroppedDeps (Named p) wW wY -> Named p wW wY)
-> WithDroppedDeps (Named p) wW wY
-> PatchInfoAndG ('RepoType 'IsRebase) (Named 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) (RL (WDDNamed p) wR wZ
 -> RL (PatchInfoAnd ('RepoType 'IsRebase) p) wR wZ)
-> RL (WDDNamed p) wR wZ
-> RL (PatchInfoAnd ('RepoType 'IsRebase) p) wR wZ
forall a b. (a -> b) -> a -> b
$
          FL (WDDNamed p) wR wZ -> RL (WDDNamed p) wR wZ
forall (a :: * -> * -> *) wX wZ. FL a wX wZ -> RL a wX wZ
reverseFL FL (WDDNamed p) wR wZ
ps_to_unsuspend

    Bool
have_conflicts <- String
-> AllowConflicts
-> ExternalMerge
-> StandardResolution (PrimOf p) wZ
-> IO Bool
forall (prim :: * -> * -> *) wX.
PrimPatch prim =>
String
-> AllowConflicts
-> ExternalMerge
-> StandardResolution prim wX
-> IO Bool
announceConflicts String
"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) StandardResolution (PrimOf p) wZ
conflicts
    Sealed FL (PrimOf p) wZ wX
resolved_p <-
        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
            (ExternalMerge
NoExternalMerge, Bool
_) ->
                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 AllowConflicts
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
                    Maybe AllowConflicts
_ -> 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
$ StandardResolution (PrimOf p) wZ -> Sealed (FL (PrimOf p) wZ)
forall (prim :: * -> * -> *) wX.
StandardResolution prim wX -> Mangled prim wX
mangled StandardResolution (PrimOf p) wZ
conflicts
            (ExternalMerge
_, Bool
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
$ StandardResolution (PrimOf p) wZ -> Sealed (FL (PrimOf p) wZ)
forall (prim :: * -> * -> *) wX.
StandardResolution prim wX -> Mangled prim wX
mangled StandardResolution (PrimOf p) wZ
conflicts
            (YesExternalMerge String
_, Bool
True) ->
                String -> IO (Sealed (FL (PrimOf p) wZ))
forall a. HasCallStack => String -> a
error String
"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
    -- TODO should catch logfiles (fst value from updatePatchHeader) and clean them up as in AmendRecord
    Repository ('RepoType 'IsRebase) p wR wU wR
-> FL (PrimOf p) wR wX -> IO ()
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT wX wY.
RepoPatch p =>
Repository rt p wR wU wT -> FL (PrimOf p) wX wY -> IO ()
tentativelyAddToPending Repository ('RepoType 'IsRebase) p wR wU wR
_repository 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 ('RepoType 'IsRebase) p wR wU wZ
_repository, FL RebaseName wZ wZ
renames) <- HijackOptions
-> HijackT
     IO
     (Repository ('RepoType 'IsRebase) p wR wU wZ, FL RebaseName wZ wZ)
-> IO
     (Repository ('RepoType 'IsRebase) p wR wU wZ, FL RebaseName 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 wZ wZ)
 -> IO
      (Repository ('RepoType 'IsRebase) p wR wU wZ, FL RebaseName wZ wZ))
-> HijackT
     IO
     (Repository ('RepoType 'IsRebase) p wR wU wZ, FL RebaseName wZ wZ)
-> IO
     (Repository ('RepoType 'IsRebase) p wR wU wZ, FL RebaseName 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 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 wT2 wT2)
doAdd Repository ('RepoType 'IsRebase) p wR wU wR
_repository FL (WDDNamed p) wR wZ
ps_to_unsuspend
    case (forall wX.
 FL (RebaseChange (PrimOf p)) wZ wX
 -> Sealed (FL (RebaseChange (PrimOf p)) wZ))
-> Sealed (FL (RebaseChange (PrimOf p)) wZ)
-> Sealed (FL (RebaseChange (PrimOf p)) wZ)
forall (a :: * -> *) b. (forall wX. a wX -> b) -> Sealed a -> b
unseal (DiffAlgorithm
-> FL (RebaseFixup (PrimOf p)) wZ wZ
-> FL (RebaseChange (PrimOf p)) wZ wX
-> Sealed (FL (RebaseChange (PrimOf p)) wZ)
forall (prim :: * -> * -> *) wX wY wZ.
PrimPatch prim =>
DiffAlgorithm
-> FL (RebaseFixup prim) wX wY
-> FL (RebaseChange prim) wY wZ
-> Sealed (FL (RebaseChange prim) wX)
simplifyPushes DiffAlgorithm
da ((forall wW wY. RebaseName wW wY -> RebaseFixup (PrimOf p) wW wY)
-> FL RebaseName wZ wZ -> FL (RebaseFixup (PrimOf 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 wW wY -> RebaseFixup (PrimOf p) wW wY
forall wX wY (prim :: * -> * -> *).
RebaseName wX wY -> RebaseFixup prim wX wY
NameFixup FL RebaseName wZ wZ
renames)) Sealed (FL (RebaseChange (PrimOf p)) wZ)
ps_to_keep of
      Sealed FL (RebaseChange (PrimOf p)) wZ wX
new_ps -> Repository ('RepoType 'IsRebase) p wR wU wZ
-> Suspended p wZ wZ -> IO ()
forall (p :: * -> * -> *) (rt :: RepoType) wR wU wT.
RepoPatch p =>
Repository rt p wR wU wT -> Suspended p wT wT -> IO ()
writeTentativeRebase Repository ('RepoType 'IsRebase) p wR wU wZ
_repository (FL (RebaseChange (PrimOf p)) wZ wX -> Suspended p wZ wZ
forall (p :: * -> * -> *) wX wY.
FL (RebaseChange (PrimOf p)) wX wY -> Suspended p wX wX
Items FL (RebaseChange (PrimOf p)) wZ wX
new_ps)
    IO () -> IO ()
forall a. IO a -> IO a
withSignalsBlocked (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ do
      Repository ('RepoType 'IsRebase) p wZ wU wZ
_repository <- Repository ('RepoType 'IsRebase) p wR wU wZ
-> UpdatePending
-> Compression
-> IO (Repository ('RepoType 'IsRebase) p wZ wU wZ)
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wT
-> UpdatePending -> Compression -> IO (Repository rt p wT wU wT)
finalizeRepositoryChanges Repository ('RepoType 'IsRebase) p wR wU wZ
_repository UpdatePending
YesUpdatePending (PrimDarcsOption Compression
compress PrimDarcsOption Compression -> [DarcsFlag] -> Compression
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts)
      IO (Repository ('RepoType 'IsRebase) p wZ wX wZ) -> IO ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (IO (Repository ('RepoType 'IsRebase) p wZ wX wZ) -> IO ())
-> IO (Repository ('RepoType 'IsRebase) p wZ wX wZ) -> IO ()
forall a b. (a -> b) -> a -> b
$ Repository ('RepoType 'IsRebase) p wZ wU wZ
-> Verbosity
-> FL (PrimOf p) wU wX
-> IO (Repository ('RepoType 'IsRebase) p wZ 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 wZ 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

    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 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 wT2 wT2)
doAdd Repository ('RepoType 'IsRebase) p wR wU wT
_repo FL (WDDNamed p) wT wT2
NilFL = (Repository ('RepoType 'IsRebase) p wR wU wT,
 FL RebaseName wT2 wT2)
-> StateT
     HijackOptions
     IO
     (Repository ('RepoType 'IsRebase) p wR wU wT,
      FL RebaseName wT2 wT2)
forall (m :: * -> *) a. Monad m => a -> m a
return (Repository ('RepoType 'IsRebase) p wR wU wT
_repo, FL RebaseName wT2 wT2
forall (a :: * -> * -> *) wX. FL a wX wX
NilFL)
          doAdd Repository ('RepoType 'IsRebase) p wR wU wT
_repo ((WDDNamed p wT wY
p :: WDDNamed p wT wU) :>: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 ()
                  [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
$ String
"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 String
"dependency") String
":\n\n"
                      let printIndented :: Int -> PatchInfo -> IO ()
printIndented 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 Char
' '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 String
" 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 Int
2) [PatchInfo]
deps
                      String -> IO ()
putStr String
"\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
-> Named (PrimOf 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
-> Named (PrimOf p) wT wX
-> FL (PrimOf p) wX wY
-> HijackT IO (Maybe String, PatchInfoAnd rt p wT wY)
updatePatchHeader String
"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
O.keepDate PrimDarcsOption Bool -> [DarcsFlag] -> Bool
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts)
                      (PrimDarcsOption Bool
O.selectAuthor PrimDarcsOption Bool -> [DarcsFlag] -> Bool
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts)
                      (PrimDarcsOption (Maybe String)
O.author PrimDarcsOption (Maybe String) -> [DarcsFlag] -> Maybe String
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts)
                      (PrimDarcsOption (Maybe String)
O.patchname PrimDarcsOption (Maybe String) -> [DarcsFlag] -> Maybe String
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts)
                      (PrimDarcsOption (Maybe AskLongComment)
O.askLongComment PrimDarcsOption (Maybe AskLongComment)
-> [DarcsFlag] -> Maybe AskLongComment
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts)
                      ((FL p wT wY -> FL (PrimOf p) wT wY)
-> Named p wT wY -> Named (PrimOf p) wT wY
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 FL p wT wY -> FL (PrimOf p) wT wY
forall (p :: * -> * -> *) wX wY.
Effect p =>
p wX wY -> FL (PrimOf p) wX wY
effect (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
-> UpdatePending
-> 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
-> UpdatePending
-> 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) UpdatePending
YesUpdatePending 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 wU wU
                  rename :: RebaseName wY wY
rename = PatchInfo -> PatchInfo -> RebaseName wY wY
forall wX wY. PatchInfo -> PatchInfo -> RebaseName wX wY
Rename (PatchInfoAnd ('RepoType 'IsRebase) p wT wY -> PatchInfo
forall (rt :: RepoType) (p :: * -> * -> *) wA wB.
PatchInfoAndG 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 (FL (WDDNamed p) wY wZ
ps2 :> (RebaseName wZ wT2
rename2 :: RebaseName wV wT2)) <-
                Maybe ((:>) (FL (WDDNamed p)) RebaseName wY wT2)
-> StateT
     HijackOptions IO (Maybe ((:>) (FL (WDDNamed p)) RebaseName wY wT2))
forall (m :: * -> *) a. Monad m => a -> m a
return (CommuteFn RebaseName (WDDNamed p)
-> (:>) RebaseName (FL (WDDNamed p)) wY wT2
-> Maybe ((:>) (FL (WDDNamed p)) RebaseName wY wT2)
forall (p1 :: * -> * -> *) (p2 :: * -> * -> *).
CommuteFn p1 p2 -> CommuteFn p1 (FL p2)
commuterIdFL (CommuteFn RebaseName (Named p) -> CommuteFn RebaseName (WDDNamed p)
forall (p :: * -> * -> *) (q :: * -> * -> *).
CommuteFn p q -> CommuteFn p (WithDroppedDeps q)
commuterIdWDD CommuteFn RebaseName (Named p)
forall (p :: * -> * -> *). CommuteFn RebaseName (Named p)
commuteNameNamed) (RebaseName wY wY
rename RebaseName wY wY
-> FL (WDDNamed p) wY wT2
-> (:>) RebaseName (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)
              (Repository ('RepoType 'IsRebase) p wR wU wZ
_repo, FL RebaseName 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 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 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 wZ wZ)
-> HijackT
     IO
     (Repository ('RepoType 'IsRebase) p wR wU wZ, FL RebaseName wZ wZ)
forall (m :: * -> *) a. Monad m => a -> m a
return (Repository ('RepoType 'IsRebase) p wR wU wZ
_repo, RebaseName wZ wT2
rename2 RebaseName wZ wT2 -> FL RebaseName wT2 wZ -> FL RebaseName wZ wZ
forall (a :: * -> * -> *) wX wY wZ.
a wX wY -> FL a wY wZ -> FL a wX wZ
:>: FL RebaseName wT2 wZ
FL RebaseName wZ wZ
renames)

          requireNoUnrecordedChanges :: (RepoPatch p, ApplyState p ~ Tree)
                                     => Repository rt p wR wU wR
                                     -> IO (EqCheck wR wU)
          requireNoUnrecordedChanges :: Repository rt p wR wU wR -> IO (EqCheck wR wU)
requireNoUnrecordedChanges Repository rt p wR wU wR
repo = do
            FL (PrimOf p) wR wU
pend <-
              (UseIndex, ScanKnown, DiffAlgorithm)
-> LookForMoves
-> LookForReplaces
-> Repository rt p wR wU wR
-> Maybe [AnchoredPath]
-> IO (FL (PrimOf p) wR wU)
forall (p :: * -> * -> *) (rt :: RepoType) wR wU.
(RepoPatch p, ApplyState p ~ Tree) =>
(UseIndex, ScanKnown, DiffAlgorithm)
-> LookForMoves
-> LookForReplaces
-> Repository rt p wR wU wR
-> Maybe [AnchoredPath]
-> IO (FL (PrimOf p) wR wU)
unrecordedChanges ([DarcsFlag] -> (UseIndex, ScanKnown, DiffAlgorithm)
diffingOpts [DarcsFlag]
opts)
                LookForMoves
O.NoLookForMoves LookForReplaces
O.NoLookForReplaces
                Repository rt p wR wU wR
repo Maybe [AnchoredPath]
forall a. Maybe a
Nothing
            case FL (PrimOf p) wR wU
pend of
              FL (PrimOf p) wR wU
NilFL -> EqCheck wR wR -> IO (EqCheck wR wR)
forall (m :: * -> *) a. Monad m => a -> m a
return EqCheck wR wR
forall wA. EqCheck wA wA
IsEq
              FL (PrimOf p) wR wU
_ -> String -> IO (EqCheck wR wU)
forall a. String -> IO a
die (String -> IO (EqCheck wR wU)) -> String -> IO (EqCheck wR wU)
forall a b. (a -> b) -> a -> b
$ String
"Can't "String -> String -> String
forall a. [a] -> [a] -> [a]
++String
cmdString -> String -> String
forall a. [a] -> [a] -> [a]
++String
" when there are unrecorded changes."

inject :: DarcsCommand
inject :: DarcsCommand
inject = DarcsCommand :: String
-> String
-> Doc
-> String
-> Int
-> [String]
-> ((AbsolutePath, AbsolutePath)
    -> [DarcsFlag] -> [String] -> IO ())
-> ([DarcsFlag] -> IO (Either String ()))
-> ((AbsolutePath, AbsolutePath)
    -> [DarcsFlag] -> [String] -> IO [String])
-> ([DarcsFlag] -> AbsolutePath -> [String] -> IO [String])
-> [DarcsOptDescr DarcsFlag]
-> [DarcsOptDescr DarcsFlag]
-> [DarcsFlag]
-> ([DarcsFlag] -> [String])
-> DarcsCommand
DarcsCommand
    { commandProgramName :: String
commandProgramName = String
"darcs"
    , commandName :: String
commandName = String
"inject"
    , commandHelp :: Doc
commandHelp = String -> Doc
text String
injectDescription
    , commandDescription :: String
commandDescription = String
injectDescription
    , commandPrereq :: [DarcsFlag] -> IO (Either String ())
commandPrereq = [DarcsFlag] -> IO (Either String ())
amInHashedRepository
    , commandExtraArgs :: Int
commandExtraArgs = Int
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
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> [DarcsFlag])
-> [DarcsFlag]
forall (d :: * -> *) f b. OptSpec d f [f] b -> [f]
defaultFlags OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  (Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> [DarcsFlag])
forall a.
DarcsOption
  a
  (Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
injectOpts
    , commandCheckOptions :: [DarcsFlag] -> [String]
commandCheckOptions = OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  (Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> 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
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> Any)
forall a.
DarcsOption
  a
  (Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> 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
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
injectOpts = OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe StdCmdAction
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
  (Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
forall a.
OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  (Bool -> Maybe String -> DiffAlgorithm -> a)
injectBasicOpts OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe StdCmdAction
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
  (Bool
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
-> DarcsOption
     (UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a)
     (UMask -> UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a)
-> DarcsOption
     a
     (Bool
      -> Maybe String
      -> DiffAlgorithm
      -> Maybe StdCmdAction
      -> Verbosity
      -> UMask
      -> UseCache
      -> HooksConfig
      -> Bool
      -> Bool
      -> Bool
      -> a)
forall b c a.
DarcsOption (Maybe StdCmdAction -> Verbosity -> b) c
-> DarcsOption
     (UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a) b
-> DarcsOption a c
`withStdOpts` DarcsOption
  (UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a)
  (UMask -> UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a)
PrimDarcsOption UMask
O.umask
    injectDescription :: String
injectDescription =
      String
"Merge a change from the fixups of a patch into the patch itself."

injectCmd :: (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
injectCmd :: (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
injectCmd (AbsolutePath, AbsolutePath)
_ [DarcsFlag]
opts [String]
_args =
    DryRun -> UseCache -> UpdatePending -> UMask -> RepoJob () -> IO ()
forall a.
DryRun -> UseCache -> UpdatePending -> 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) UpdatePending
YesUpdatePending (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
$
    (forall (p :: * -> * -> *) wR wU.
 (RepoPatch p, ApplyState p ~ Tree) =>
 Repository ('RepoType 'IsRebase) p wR wU wR -> IO ())
-> RepoJob ()
forall a.
(forall (p :: * -> * -> *) wR wU.
 (RepoPatch p, ApplyState p ~ Tree) =>
 Repository ('RepoType 'IsRebase) p wR wU wR -> IO a)
-> RepoJob a
RebaseJob ((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
    Items FL (RebaseChange (PrimOf p)) wR wY
selects <- Repository ('RepoType 'IsRebase) p wR wU wR
-> IO (Suspended p wR wR)
forall (p :: * -> * -> *) (rt :: RepoType) wR wU wT.
RepoPatch p =>
Repository rt p wR wU wT -> IO (Suspended p wT wT)
readTentativeRebase Repository ('RepoType 'IsRebase) p wR wU wR
_repository

    -- TODO this selection doesn't need to respect dependencies
    -- TODO we only want to select one patch: generalise withSelectedPatchFromList
    let selection_config :: SelectionConfig (RebaseChange (PrimOf p))
selection_config =
          (forall wX wY.
 RebaseChange (PrimOf p) wX wY
 -> Sealed2 (PatchInfoAnd ('RepoType 'NoRebase) (PrimOf p)))
-> WhichChanges
-> String
-> PatchSelectionOptions
-> Maybe [AnchoredPath]
-> SelectionConfig (RebaseChange (PrimOf p))
forall (p :: * -> * -> *) (q :: * -> * -> *).
Matchable p =>
(forall wX wY. q wX wY -> Sealed2 p)
-> WhichChanges
-> String
-> PatchSelectionOptions
-> Maybe [AnchoredPath]
-> SelectionConfig q
selectionConfigGeneric forall wX wY.
RebaseChange (PrimOf p) wX wY
-> Sealed2 (PatchInfoAnd ('RepoType 'NoRebase) (PrimOf p))
forall (prim :: * -> * -> *) wX wY.
RebaseChange prim wX wY
-> Sealed2 (PatchInfoAnd ('RepoType 'NoRebase) prim)
rcToPia WhichChanges
First String
"inject into" (Bool -> [DarcsFlag] -> PatchSelectionOptions
patchSelOpts Bool
True [DarcsFlag]
opts) Maybe [AnchoredPath]
forall a. Maybe a
Nothing
    (FL (RebaseChange (PrimOf p)) wR wZ
chosens :> FL (RebaseChange (PrimOf p)) wZ wY
rest_selects) <- FL (RebaseChange (PrimOf p)) wR wY
-> SelectionConfig (RebaseChange (PrimOf p))
-> IO
     ((:>)
        (FL (RebaseChange (PrimOf p)))
        (FL (RebaseChange (PrimOf p)))
        wR
        wY)
forall (p :: * -> * -> *) wX wY.
(MatchableRP p, ShowPatch p, ShowContextPatch p,
 ApplyState p ~ Tree, ApplyState p ~ ApplyState (PrimOf p)) =>
FL p wX wY -> SelectionConfig p -> IO ((:>) (FL p) (FL p) wX wY)
runSelection FL (RebaseChange (PrimOf p)) wR wY
selects SelectionConfig (RebaseChange (PrimOf p))
selection_config

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

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

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

    let prim_selection_config :: SelectionConfig (PrimOf p)
prim_selection_config =
          WhichChanges
-> String
-> PatchSelectionOptions
-> Maybe (Splitter (PrimOf p))
-> Maybe [AnchoredPath]
-> Maybe (Tree IO)
-> SelectionConfig (PrimOf p)
forall (prim :: * -> * -> *).
WhichChanges
-> String
-> PatchSelectionOptions
-> Maybe (Splitter prim)
-> Maybe [AnchoredPath]
-> Maybe (Tree IO)
-> SelectionConfig prim
selectionConfigPrim
              WhichChanges
Last String
"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 [AnchoredPath]
forall a. Maybe a
Nothing Maybe (Tree IO)
forall a. Maybe a
Nothing
    (FL (PrimOf p) wZ wZ
rest_fixups :> FL (PrimOf p) wZ wZ
injects) <- FL (PrimOf p) wZ wZ
-> SelectionConfig (PrimOf p)
-> IO ((:>) (FL (PrimOf p)) (FL (PrimOf p)) wZ wZ)
forall (p :: * -> * -> *) wX wY.
(Invert p, MatchableRP p, ShowPatch p, ShowContextPatch p,
 ApplyState p ~ Tree) =>
FL p wX wY -> SelectionConfig p -> IO ((:>) (FL p) (FL p) wX wY)
runInvertibleSelection FL (PrimOf p) wZ wZ
prim_fixups SelectionConfig (PrimOf p)
prim_selection_config

    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 String
"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 (PrimOf p) wZ wZ
toeditNew = (FL (PrimOf p) wZ wZ -> FL (PrimOf p) wZ wZ)
-> Named (PrimOf p) wZ wZ -> Named (PrimOf 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 (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 (PrimOf p) wZ wZ -> FL (PrimOf p) wZ wZ)
-> FL (PrimOf 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
+>+)) Named (PrimOf p) wZ wZ
toedit
    case (forall wX.
 FL (RebaseChange (PrimOf p)) wZ wX
 -> Sealed (FL (RebaseChange (PrimOf p)) wR))
-> Sealed (FL (RebaseChange (PrimOf p)) wZ)
-> Sealed (FL (RebaseChange (PrimOf p)) wR)
forall (a :: * -> *) b. (forall wX. a wX -> b) -> Sealed a -> b
unseal (DiffAlgorithm
-> FL (RebaseFixup (PrimOf p)) wR wZ
-> FL (RebaseChange (PrimOf p)) wZ wX
-> Sealed (FL (RebaseChange (PrimOf p)) wR)
forall (prim :: * -> * -> *) wX wY wZ.
PrimPatch prim =>
DiffAlgorithm
-> FL (RebaseFixup prim) wX wY
-> FL (RebaseChange prim) wY wZ
-> Sealed (FL (RebaseChange prim) wX)
simplifyPushes DiffAlgorithm
da ((forall wW wY. RebaseName wW wY -> RebaseFixup (PrimOf p) wW wY)
-> FL RebaseName wR wZ -> FL (RebaseFixup (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. RebaseName wW wY -> RebaseFixup (PrimOf p) wW wY
forall wX wY (prim :: * -> * -> *).
RebaseName wX wY -> RebaseFixup prim wX wY
NameFixup FL RebaseName wR wZ
name_fixups))
            (Sealed (FL (RebaseChange (PrimOf p)) wZ)
 -> Sealed (FL (RebaseChange (PrimOf p)) wR))
-> Sealed (FL (RebaseChange (PrimOf p)) wZ)
-> Sealed (FL (RebaseChange (PrimOf p)) wR)
forall a b. (a -> b) -> a -> b
$ DiffAlgorithm
-> FL (RebaseFixup (PrimOf p)) wZ wZ
-> FL (RebaseChange (PrimOf p)) wZ wY
-> Sealed (FL (RebaseChange (PrimOf p)) wZ)
forall (prim :: * -> * -> *) wX wY wZ.
PrimPatch prim =>
DiffAlgorithm
-> FL (RebaseFixup prim) wX wY
-> FL (RebaseChange prim) wY wZ
-> Sealed (FL (RebaseChange prim) wX)
simplifyPushes DiffAlgorithm
da ((forall wW wY. PrimOf p wW wY -> RebaseFixup (PrimOf p) wW wY)
-> FL (PrimOf p) wZ wZ -> FL (RebaseFixup (PrimOf 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 (PrimOf p) wW wY
forall (prim :: * -> * -> *) wX wY.
prim wX wY -> RebaseFixup prim wX wY
PrimFixup FL (PrimOf p) wZ wZ
rest_fixups)
            (FL (RebaseChange (PrimOf p)) wZ wY
 -> Sealed (FL (RebaseChange (PrimOf p)) wZ))
-> FL (RebaseChange (PrimOf p)) wZ wY
-> Sealed (FL (RebaseChange (PrimOf p)) wZ)
forall a b. (a -> b) -> a -> b
$ FL (RebaseFixup (PrimOf p)) wZ wZ
-> Named (PrimOf p) wZ wZ -> RebaseChange (PrimOf p) wZ wZ
forall (prim :: * -> * -> *) wX wY wZ.
FL (RebaseFixup prim) wX wY
-> Named prim wY wZ -> RebaseChange prim wX wZ
RC FL (RebaseFixup (PrimOf p)) wZ wZ
forall (a :: * -> * -> *) wX. FL a wX wX
NilFL Named (PrimOf p) wZ wZ
toeditNew RebaseChange (PrimOf p) wZ wZ
-> FL (RebaseChange (PrimOf p)) wZ wY
-> FL (RebaseChange (PrimOf p)) wZ wY
forall (a :: * -> * -> *) wX wY wZ.
a wX wY -> FL a wY wZ -> FL a wX wZ
:>: FL (RebaseChange (PrimOf p)) wZ wY
rest_selects of
      Sealed FL (RebaseChange (PrimOf p)) wR wX
new_ps -> Repository ('RepoType 'IsRebase) p wR wU wR
-> Suspended p wR wR -> IO ()
forall (p :: * -> * -> *) (rt :: RepoType) wR wU wT.
RepoPatch p =>
Repository rt p wR wU wT -> Suspended p wT wT -> IO ()
writeTentativeRebase Repository ('RepoType 'IsRebase) p wR wU wR
_repository (FL (RebaseChange (PrimOf p)) wR wX -> Suspended p wR wR
forall (p :: * -> * -> *) wX wY.
FL (RebaseChange (PrimOf p)) wX wY -> Suspended p wX wX
Items FL (RebaseChange (PrimOf p)) wR wX
new_ps)
    Repository ('RepoType 'IsRebase) p wR wU wR
_repository <- Repository ('RepoType 'IsRebase) p wR wU wR
-> UpdatePending
-> Compression
-> IO (Repository ('RepoType 'IsRebase) p wR wU wR)
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wT
-> UpdatePending -> Compression -> IO (Repository rt p wT wU wT)
finalizeRepositoryChanges Repository ('RepoType 'IsRebase) p wR wU wR
_repository UpdatePending
YesUpdatePending (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
obliterate :: DarcsCommand
obliterate = DarcsCommand :: String
-> String
-> Doc
-> String
-> Int
-> [String]
-> ((AbsolutePath, AbsolutePath)
    -> [DarcsFlag] -> [String] -> IO ())
-> ([DarcsFlag] -> IO (Either String ()))
-> ((AbsolutePath, AbsolutePath)
    -> [DarcsFlag] -> [String] -> IO [String])
-> ([DarcsFlag] -> AbsolutePath -> [String] -> IO [String])
-> [DarcsOptDescr DarcsFlag]
-> [DarcsOptDescr DarcsFlag]
-> [DarcsFlag]
-> ([DarcsFlag] -> [String])
-> DarcsCommand
DarcsCommand
    { commandProgramName :: String
commandProgramName = String
"darcs"
    , commandName :: String
commandName = String
"obliterate"
    , commandHelp :: Doc
commandHelp = String -> Doc
text String
obliterateDescription
    , commandDescription :: String
commandDescription = String
obliterateDescription
    , commandPrereq :: [DarcsFlag] -> IO (Either String ())
commandPrereq = [DarcsFlag] -> IO (Either String ())
amInHashedRepository
    , commandExtraArgs :: Int
commandExtraArgs = Int
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
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> [DarcsFlag])
-> [DarcsFlag]
forall (d :: * -> *) f b. OptSpec d f [f] b -> [f]
defaultFlags OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  (DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> [DarcsFlag])
forall a.
DarcsOption
  a
  (DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
obliterateOpts
    , commandCheckOptions :: [DarcsFlag] -> [String]
commandCheckOptions = OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  (DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> Any)
-> [DarcsFlag] -> [String]
forall (d :: * -> *) f a b. OptSpec d f a b -> [f] -> [String]
ocheck OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  (DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> Any)
forall a.
DarcsOption
  a
  (DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> 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
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
obliterateOpts = PrimOptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe StdCmdAction
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
  DiffAlgorithm
PrimDarcsOption DiffAlgorithm
obliterateBasicOpts PrimOptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe StdCmdAction
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
  DiffAlgorithm
-> DarcsOption
     (UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a)
     (UMask -> UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a)
-> DarcsOption
     a
     (DiffAlgorithm
      -> Maybe StdCmdAction
      -> Verbosity
      -> UMask
      -> UseCache
      -> HooksConfig
      -> Bool
      -> Bool
      -> Bool
      -> a)
forall b c a.
DarcsOption (Maybe StdCmdAction -> Verbosity -> b) c
-> DarcsOption
     (UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a) b
-> DarcsOption a c
`withStdOpts` DarcsOption
  (UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a)
  (UMask -> UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a)
PrimDarcsOption UMask
O.umask
    obliterateDescription :: String
obliterateDescription =
      String
"Obliterate a patch that is currently suspended."

obliterateCmd :: (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
obliterateCmd :: (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
obliterateCmd (AbsolutePath, AbsolutePath)
_ [DarcsFlag]
opts [String]
_args =
    DryRun -> UseCache -> UpdatePending -> UMask -> RepoJob () -> IO ()
forall a.
DryRun -> UseCache -> UpdatePending -> 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) UpdatePending
YesUpdatePending (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
$
    (forall (p :: * -> * -> *) wR wU.
 (RepoPatch p, ApplyState p ~ Tree) =>
 Repository ('RepoType 'IsRebase) p wR wU wR -> IO ())
-> RepoJob ()
forall a.
(forall (p :: * -> * -> *) wR wU.
 (RepoPatch p, ApplyState p ~ Tree) =>
 Repository ('RepoType 'IsRebase) p wR wU wR -> IO a)
-> RepoJob a
RebaseJob ((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
    Items FL (RebaseChange (PrimOf p)) wR wY
selects <- Repository ('RepoType 'IsRebase) p wR wU wR
-> IO (Suspended p wR wR)
forall (p :: * -> * -> *) (rt :: RepoType) wR wU wT.
RepoPatch p =>
Repository rt p wR wU wT -> IO (Suspended p wT wT)
readTentativeRebase Repository ('RepoType 'IsRebase) p wR wU wR
_repository

    -- TODO this selection doesn't need to respect dependencies
    let selection_config :: SelectionConfig (RebaseChange (PrimOf p))
selection_config = (forall wX wY.
 RebaseChange (PrimOf p) wX wY
 -> Sealed2 (PatchInfoAnd ('RepoType 'NoRebase) (PrimOf p)))
-> WhichChanges
-> String
-> PatchSelectionOptions
-> Maybe [AnchoredPath]
-> SelectionConfig (RebaseChange (PrimOf p))
forall (p :: * -> * -> *) (q :: * -> * -> *).
Matchable p =>
(forall wX wY. q wX wY -> Sealed2 p)
-> WhichChanges
-> String
-> PatchSelectionOptions
-> Maybe [AnchoredPath]
-> SelectionConfig q
selectionConfigGeneric forall wX wY.
RebaseChange (PrimOf p) wX wY
-> Sealed2 (PatchInfoAnd ('RepoType 'NoRebase) (PrimOf p))
forall (prim :: * -> * -> *) wX wY.
RebaseChange prim wX wY
-> Sealed2 (PatchInfoAnd ('RepoType 'NoRebase) prim)
rcToPia WhichChanges
First String
"obliterate" ([DarcsFlag] -> PatchSelectionOptions
obliteratePatchSelOpts [DarcsFlag]
opts) Maybe [AnchoredPath]
forall a. Maybe a
Nothing
    (FL (RebaseChange (PrimOf p)) wR wZ
chosen :> FL (RebaseChange (PrimOf p)) wZ wY
keep) <- FL (RebaseChange (PrimOf p)) wR wY
-> SelectionConfig (RebaseChange (PrimOf p))
-> IO
     ((:>)
        (FL (RebaseChange (PrimOf p)))
        (FL (RebaseChange (PrimOf p)))
        wR
        wY)
forall (p :: * -> * -> *) wX wY.
(MatchableRP p, ShowPatch p, ShowContextPatch p,
 ApplyState p ~ Tree, ApplyState p ~ ApplyState (PrimOf p)) =>
FL p wX wY -> SelectionConfig p -> IO ((:>) (FL p) (FL p) wX wY)
runSelection FL (RebaseChange (PrimOf p)) wR wY
selects SelectionConfig (RebaseChange (PrimOf p))
selection_config
    Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (FL (RebaseChange (PrimOf p)) wR wZ -> Bool
forall (a :: * -> * -> *) wX wZ. FL a wX wZ -> Bool
nullFL FL (RebaseChange (PrimOf p)) wR wZ
chosen) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ do String -> IO ()
putStrLn String
"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
          :: PrimPatch prim
          => FL (RebaseChange prim) wX wY
          -> FL (RebaseChange prim) wY wZ
          -> Sealed (FL (RebaseChange prim) wX)
        do_obliterate :: FL (RebaseChange prim) wX wY
-> FL (RebaseChange prim) wY wZ
-> Sealed (FL (RebaseChange prim) wX)
do_obliterate FL (RebaseChange prim) wX wY
NilFL = FL (RebaseChange prim) wY wZ -> Sealed (FL (RebaseChange prim) wX)
forall (a :: * -> *) wX. a wX -> Sealed a
Sealed
        do_obliterate (RC FL (RebaseFixup prim) wX wY
fs Named prim wY wY
e :>: FL (RebaseChange prim) wY wY
qs) =
          (forall wX.
 FL (RebaseChange prim) wY wX -> Sealed (FL (RebaseChange prim) wX))
-> Sealed (FL (RebaseChange prim) wY)
-> Sealed (FL (RebaseChange prim) wX)
forall (a :: * -> *) b. (forall wX. a wX -> b) -> Sealed a -> b
unseal (DiffAlgorithm
-> FL (RebaseFixup prim) wX wY
-> FL (RebaseChange prim) wY wX
-> Sealed (FL (RebaseChange prim) wX)
forall (prim :: * -> * -> *) wX wY wZ.
PrimPatch prim =>
DiffAlgorithm
-> FL (RebaseFixup prim) wX wY
-> FL (RebaseChange prim) wY wZ
-> Sealed (FL (RebaseChange prim) wX)
simplifyPushes DiffAlgorithm
da FL (RebaseFixup prim) wX wY
fs) (Sealed (FL (RebaseChange prim) wY)
 -> Sealed (FL (RebaseChange prim) wX))
-> (FL (RebaseChange prim) wY wZ
    -> Sealed (FL (RebaseChange prim) wY))
-> FL (RebaseChange prim) wY wZ
-> Sealed (FL (RebaseChange prim) wX)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
          -- 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 (RebaseChange prim) wY wX -> Sealed (FL (RebaseChange prim) wY))
-> Sealed (FL (RebaseChange prim) wY)
-> Sealed (FL (RebaseChange prim) wY)
forall (a :: * -> *) b. (forall wX. a wX -> b) -> Sealed a -> b
unseal (DiffAlgorithm
-> RebaseFixup prim wY wY
-> FL (RebaseChange prim) wY wX
-> Sealed (FL (RebaseChange prim) wY)
forall (prim :: * -> * -> *) wX wY wZ.
PrimPatch prim =>
DiffAlgorithm
-> RebaseFixup prim wX wY
-> FL (RebaseChange prim) wY wZ
-> Sealed (FL (RebaseChange prim) wX)
simplifyPush DiffAlgorithm
da (RebaseName wY wY -> RebaseFixup prim wY wY
forall wX wY (prim :: * -> * -> *).
RebaseName wX wY -> RebaseFixup prim wX wY
NameFixup (PatchInfo -> RebaseName wY wY
forall wX wY. PatchInfo -> RebaseName wX wY
AddName (Named prim wY wY -> PatchInfo
forall (p :: * -> * -> *) wX wY. Named p wX wY -> PatchInfo
patch2patchinfo Named prim wY wY
e)))) (Sealed (FL (RebaseChange prim) wY)
 -> Sealed (FL (RebaseChange prim) wY))
-> (FL (RebaseChange prim) wY wZ
    -> Sealed (FL (RebaseChange prim) wY))
-> FL (RebaseChange prim) wY wZ
-> Sealed (FL (RebaseChange prim) wY)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
          (forall wX.
 FL (RebaseChange prim) wY wX -> Sealed (FL (RebaseChange prim) wY))
-> Sealed (FL (RebaseChange prim) wY)
-> Sealed (FL (RebaseChange prim) wY)
forall (a :: * -> *) b. (forall wX. a wX -> b) -> Sealed a -> b
unseal (DiffAlgorithm
-> FL (RebaseFixup prim) wY wY
-> FL (RebaseChange prim) wY wX
-> Sealed (FL (RebaseChange prim) wY)
forall (prim :: * -> * -> *) wX wY wZ.
PrimPatch prim =>
DiffAlgorithm
-> FL (RebaseFixup prim) wX wY
-> FL (RebaseChange prim) wY wZ
-> Sealed (FL (RebaseChange prim) wX)
simplifyPushes DiffAlgorithm
da ((forall wW wY. prim wW wY -> RebaseFixup prim wW wY)
-> FL prim wY wY -> FL (RebaseFixup prim) wY 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. prim wW wY -> RebaseFixup prim wW wY
forall (prim :: * -> * -> *) wX wY.
prim wX wY -> RebaseFixup prim wX wY
PrimFixup (Named prim wY wY -> FL prim wY wY
forall (p :: * -> * -> *) wX wY. Named p wX wY -> FL p wX wY
patchcontents Named prim wY wY
e))) (Sealed (FL (RebaseChange prim) wY)
 -> Sealed (FL (RebaseChange prim) wY))
-> (FL (RebaseChange prim) wY wZ
    -> Sealed (FL (RebaseChange prim) wY))
-> FL (RebaseChange prim) wY wZ
-> Sealed (FL (RebaseChange prim) wY)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
          FL (RebaseChange prim) wY wY
-> FL (RebaseChange prim) wY wZ
-> Sealed (FL (RebaseChange prim) wY)
forall (prim :: * -> * -> *) wX wY wZ.
PrimPatch prim =>
FL (RebaseChange prim) wX wY
-> FL (RebaseChange prim) wY wZ
-> Sealed (FL (RebaseChange prim) wX)
do_obliterate FL (RebaseChange prim) wY wY
qs

    let ps_to_keep :: Sealed (FL (RebaseChange (PrimOf p)) wR)
ps_to_keep = FL (RebaseChange (PrimOf p)) wR wZ
-> FL (RebaseChange (PrimOf p)) wZ wY
-> Sealed (FL (RebaseChange (PrimOf p)) wR)
forall (prim :: * -> * -> *) wX wY wZ.
PrimPatch prim =>
FL (RebaseChange prim) wX wY
-> FL (RebaseChange prim) wY wZ
-> Sealed (FL (RebaseChange prim) wX)
do_obliterate FL (RebaseChange (PrimOf p)) wR wZ
chosen FL (RebaseChange (PrimOf p)) wZ wY
keep
    case Sealed (FL (RebaseChange (PrimOf p)) wR)
ps_to_keep of
      Sealed FL (RebaseChange (PrimOf p)) wR wX
new_ps -> Repository ('RepoType 'IsRebase) p wR wU wR
-> Suspended p wR wR -> IO ()
forall (p :: * -> * -> *) (rt :: RepoType) wR wU wT.
RepoPatch p =>
Repository rt p wR wU wT -> Suspended p wT wT -> IO ()
writeTentativeRebase Repository ('RepoType 'IsRebase) p wR wU wR
_repository (FL (RebaseChange (PrimOf p)) wR wX -> Suspended p wR wR
forall (p :: * -> * -> *) wX wY.
FL (RebaseChange (PrimOf p)) wX wY -> Suspended p wX wX
Items FL (RebaseChange (PrimOf p)) wR wX
new_ps)

    Repository ('RepoType 'IsRebase) p wR wU wR
_repository <- Repository ('RepoType 'IsRebase) p wR wU wR
-> UpdatePending
-> Compression
-> IO (Repository ('RepoType 'IsRebase) p wR wU wR)
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wT
-> UpdatePending -> Compression -> IO (Repository rt p wT wU wT)
finalizeRepositoryChanges Repository ('RepoType 'IsRebase) p wR wU wR
_repository UpdatePending
YesUpdatePending (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 ()


pull :: DarcsCommand
pull :: DarcsCommand
pull = DarcsCommand :: String
-> String
-> Doc
-> String
-> Int
-> [String]
-> ((AbsolutePath, AbsolutePath)
    -> [DarcsFlag] -> [String] -> IO ())
-> ([DarcsFlag] -> IO (Either String ()))
-> ((AbsolutePath, AbsolutePath)
    -> [DarcsFlag] -> [String] -> IO [String])
-> ([DarcsFlag] -> AbsolutePath -> [String] -> IO [String])
-> [DarcsOptDescr DarcsFlag]
-> [DarcsOptDescr DarcsFlag]
-> [DarcsFlag]
-> ([DarcsFlag] -> [String])
-> DarcsCommand
DarcsCommand
    { commandProgramName :: String
commandProgramName = String
"darcs"
    , commandName :: String
commandName = String
"pull"
    , commandHelp :: Doc
commandHelp = String -> Doc
text String
pullDescription
    , commandDescription :: String
commandDescription = String
pullDescription
    , commandExtraArgs :: Int
commandExtraArgs = -Int
1
    , commandExtraArgHelp :: [String]
commandExtraArgHelp = [String
"[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 String
"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
   -> 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
   -> NetworkOptions
   -> Any)
forall a.
OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  (RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> NetworkOptions
   -> a)
pullAdvancedOpts
    , commandBasicOptions :: [DarcsOptDescr DarcsFlag]
commandBasicOptions = OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> WithSummary
   -> SelectDeps
   -> 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
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> Any)
forall a.
OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
pullBasicOpts
    , commandDefaults :: [DarcsFlag]
commandDefaults = OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> NetworkOptions
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> [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
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> NetworkOptions
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> [DarcsFlag])
forall a.
DarcsOption
  a
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> NetworkOptions
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
pullOpts
    , commandCheckOptions :: [DarcsFlag] -> [String]
commandCheckOptions = OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> NetworkOptions
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> 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
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> NetworkOptions
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> Any)
forall a.
DarcsOption
  a
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> NetworkOptions
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
pullOpts
    }
  where
    pullBasicOpts :: OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
pullBasicOpts
      = PrimOptSpec
  DarcsOptDescr
  DarcsFlag
  (Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
  [MatchFlag]
MatchOption
O.matchSeveral
      PrimOptSpec
  DarcsOptDescr
  DarcsFlag
  (Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
  [MatchFlag]
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Maybe Bool
      -> Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> WithSummary
      -> SelectDeps
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
     (Reorder
      -> Maybe Bool
      -> Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> WithSummary
      -> SelectDeps
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Maybe Bool
      -> Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> WithSummary
      -> SelectDeps
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
     ([MatchFlag]
      -> Reorder
      -> Maybe Bool
      -> Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> WithSummary
      -> SelectDeps
      -> 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
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
  (Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
PrimDarcsOption Reorder
O.reorder
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> WithSummary
      -> SelectDeps
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
     (Maybe Bool
      -> Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> WithSummary
      -> SelectDeps
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> WithSummary
      -> SelectDeps
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
     ([MatchFlag]
      -> Reorder
      -> Maybe Bool
      -> Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> WithSummary
      -> SelectDeps
      -> 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
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
  (Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
PrimDarcsOption (Maybe Bool)
O.interactive
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> WithSummary
      -> SelectDeps
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
     (Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> WithSummary
      -> SelectDeps
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> WithSummary
      -> SelectDeps
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
     ([MatchFlag]
      -> Reorder
      -> Maybe Bool
      -> Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> WithSummary
      -> SelectDeps
      -> 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
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
  (Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
PrimDarcsOption (Maybe AllowConflicts)
O.conflictsYes
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (RunTest
      -> DryRun
      -> XmlOutput
      -> WithSummary
      -> SelectDeps
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
     (ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> WithSummary
      -> SelectDeps
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (RunTest
      -> DryRun
      -> XmlOutput
      -> WithSummary
      -> SelectDeps
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
     ([MatchFlag]
      -> Reorder
      -> Maybe Bool
      -> Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> WithSummary
      -> SelectDeps
      -> 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
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
  (ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
PrimDarcsOption ExternalMerge
O.externalMerge
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (RunTest
   -> DryRun
   -> XmlOutput
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (DryRun
      -> XmlOutput
      -> WithSummary
      -> SelectDeps
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
     (RunTest
      -> DryRun
      -> XmlOutput
      -> WithSummary
      -> SelectDeps
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (DryRun
      -> XmlOutput
      -> WithSummary
      -> SelectDeps
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
     ([MatchFlag]
      -> Reorder
      -> Maybe Bool
      -> Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> WithSummary
      -> SelectDeps
      -> 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
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
  (RunTest
   -> DryRun
   -> XmlOutput
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
PrimDarcsOption RunTest
O.runTest
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (DryRun
   -> XmlOutput
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (WithSummary
      -> SelectDeps -> Maybe String -> Bool -> DiffAlgorithm -> a)
     (DryRun
      -> XmlOutput
      -> WithSummary
      -> SelectDeps
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (WithSummary
      -> SelectDeps -> Maybe String -> Bool -> DiffAlgorithm -> a)
     ([MatchFlag]
      -> Reorder
      -> Maybe Bool
      -> Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> WithSummary
      -> SelectDeps
      -> 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
  (WithSummary
   -> SelectDeps -> Maybe String -> Bool -> DiffAlgorithm -> a)
  (DryRun
   -> XmlOutput
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
forall a. DarcsOption a (DryRun -> XmlOutput -> a)
O.dryRunXml
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (WithSummary
   -> SelectDeps -> Maybe String -> Bool -> DiffAlgorithm -> a)
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (SelectDeps -> Maybe String -> Bool -> DiffAlgorithm -> a)
     (WithSummary
      -> SelectDeps -> Maybe String -> Bool -> DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (SelectDeps -> Maybe String -> Bool -> DiffAlgorithm -> a)
     ([MatchFlag]
      -> Reorder
      -> Maybe Bool
      -> Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> WithSummary
      -> SelectDeps
      -> 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 String -> Bool -> DiffAlgorithm -> a)
  (WithSummary
   -> SelectDeps -> Maybe String -> Bool -> DiffAlgorithm -> a)
PrimDarcsOption WithSummary
O.withSummary
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (SelectDeps -> Maybe String -> Bool -> DiffAlgorithm -> a)
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Maybe String -> Bool -> DiffAlgorithm -> a)
     (SelectDeps -> Maybe String -> Bool -> DiffAlgorithm -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Maybe String -> Bool -> DiffAlgorithm -> a)
     ([MatchFlag]
      -> Reorder
      -> Maybe Bool
      -> Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> WithSummary
      -> SelectDeps
      -> 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)
  (SelectDeps -> Maybe String -> Bool -> DiffAlgorithm -> a)
PrimDarcsOption SelectDeps
O.selectDeps
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe String -> Bool -> DiffAlgorithm -> a)
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> WithSummary
   -> SelectDeps
   -> 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
      -> WithSummary
      -> SelectDeps
      -> 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
   -> WithSummary
   -> SelectDeps
   -> 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
      -> WithSummary
      -> SelectDeps
      -> 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
   -> WithSummary
   -> SelectDeps
   -> 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
      -> WithSummary
      -> SelectDeps
      -> 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
   -> NetworkOptions
   -> a)
pullAdvancedOpts
      = PrimOptSpec
  DarcsOptDescr
  DarcsFlag
  (Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> NetworkOptions
   -> a)
  RepoCombinator
PrimDarcsOption RepoCombinator
O.repoCombinator
      PrimOptSpec
  DarcsOptDescr
  DarcsFlag
  (Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> NetworkOptions
   -> a)
  RepoCombinator
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (UseIndex
      -> RemoteRepos
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> NetworkOptions
      -> a)
     (Compression
      -> UseIndex
      -> RemoteRepos
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> NetworkOptions
      -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (UseIndex
      -> RemoteRepos
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> NetworkOptions
      -> a)
     (RepoCombinator
      -> Compression
      -> UseIndex
      -> RemoteRepos
      -> SetScriptsExecutable
      -> UMask
      -> 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
   -> NetworkOptions
   -> a)
  (Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> NetworkOptions
   -> a)
PrimDarcsOption Compression
O.compress
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> NetworkOptions
   -> a)
  (RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> NetworkOptions
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (RemoteRepos
      -> SetScriptsExecutable -> UMask -> Bool -> NetworkOptions -> a)
     (UseIndex
      -> RemoteRepos
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> NetworkOptions
      -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (RemoteRepos
      -> SetScriptsExecutable -> UMask -> Bool -> NetworkOptions -> a)
     (RepoCombinator
      -> Compression
      -> UseIndex
      -> RemoteRepos
      -> SetScriptsExecutable
      -> UMask
      -> 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 -> NetworkOptions -> a)
  (UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> NetworkOptions
   -> a)
PrimDarcsOption UseIndex
O.useIndex
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (RemoteRepos
   -> SetScriptsExecutable -> UMask -> Bool -> NetworkOptions -> a)
  (RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> NetworkOptions
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (SetScriptsExecutable -> UMask -> Bool -> NetworkOptions -> a)
     (RemoteRepos
      -> SetScriptsExecutable -> UMask -> Bool -> NetworkOptions -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (SetScriptsExecutable -> UMask -> Bool -> NetworkOptions -> a)
     (RepoCombinator
      -> Compression
      -> UseIndex
      -> RemoteRepos
      -> SetScriptsExecutable
      -> UMask
      -> 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 -> NetworkOptions -> a)
  (RemoteRepos
   -> SetScriptsExecutable -> UMask -> Bool -> NetworkOptions -> a)
PrimDarcsOption RemoteRepos
O.remoteRepos
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (SetScriptsExecutable -> UMask -> Bool -> NetworkOptions -> a)
  (RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> NetworkOptions
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (UMask -> Bool -> NetworkOptions -> a)
     (SetScriptsExecutable -> UMask -> Bool -> NetworkOptions -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (UMask -> Bool -> NetworkOptions -> a)
     (RepoCombinator
      -> Compression
      -> UseIndex
      -> RemoteRepos
      -> SetScriptsExecutable
      -> UMask
      -> 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 -> NetworkOptions -> a)
  (SetScriptsExecutable -> UMask -> Bool -> NetworkOptions -> a)
PrimDarcsOption SetScriptsExecutable
O.setScriptsExecutable
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (UMask -> Bool -> NetworkOptions -> a)
  (RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> NetworkOptions
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Bool -> NetworkOptions -> a)
     (UMask -> Bool -> NetworkOptions -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Bool -> NetworkOptions -> a)
     (RepoCombinator
      -> Compression
      -> UseIndex
      -> RemoteRepos
      -> SetScriptsExecutable
      -> UMask
      -> 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)
  (UMask -> Bool -> NetworkOptions -> a)
PrimDarcsOption UMask
O.umask
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (Bool -> NetworkOptions -> a)
  (RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> NetworkOptions
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (NetworkOptions -> a)
     (Bool -> NetworkOptions -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (NetworkOptions -> a)
     (RepoCombinator
      -> Compression
      -> UseIndex
      -> RemoteRepos
      -> SetScriptsExecutable
      -> UMask
      -> 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
   -> NetworkOptions
   -> a)
-> OptSpec DarcsOptDescr DarcsFlag a (NetworkOptions -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     a
     (RepoCombinator
      -> Compression
      -> UseIndex
      -> RemoteRepos
      -> SetScriptsExecutable
      -> UMask
      -> 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
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> NetworkOptions
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
pullOpts = OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe StdCmdAction
   -> Verbosity
   -> RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> NetworkOptions
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> NetworkOptions
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
forall a.
OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> a)
pullBasicOpts OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe StdCmdAction
   -> Verbosity
   -> RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> NetworkOptions
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
  ([MatchFlag]
   -> Reorder
   -> Maybe Bool
   -> Maybe AllowConflicts
   -> ExternalMerge
   -> RunTest
   -> DryRun
   -> XmlOutput
   -> WithSummary
   -> SelectDeps
   -> Maybe String
   -> Bool
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> NetworkOptions
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
-> DarcsOption
     (UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a)
     (RepoCombinator
      -> Compression
      -> UseIndex
      -> RemoteRepos
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> NetworkOptions
      -> UseCache
      -> HooksConfig
      -> Bool
      -> Bool
      -> Bool
      -> a)
-> DarcsOption
     a
     ([MatchFlag]
      -> Reorder
      -> Maybe Bool
      -> Maybe AllowConflicts
      -> ExternalMerge
      -> RunTest
      -> DryRun
      -> XmlOutput
      -> WithSummary
      -> SelectDeps
      -> Maybe String
      -> Bool
      -> DiffAlgorithm
      -> Maybe StdCmdAction
      -> Verbosity
      -> RepoCombinator
      -> Compression
      -> UseIndex
      -> RemoteRepos
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> NetworkOptions
      -> UseCache
      -> HooksConfig
      -> Bool
      -> Bool
      -> Bool
      -> a)
forall b c a.
DarcsOption (Maybe StdCmdAction -> Verbosity -> b) c
-> DarcsOption
     (UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a) b
-> DarcsOption a c
`withStdOpts` DarcsOption
  (UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a)
  (RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> NetworkOptions
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
forall a.
OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  (RepoCombinator
   -> Compression
   -> UseIndex
   -> RemoteRepos
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> NetworkOptions
   -> a)
pullAdvancedOpts
    pullDescription :: String
pullDescription =
      String
"Copy and apply patches from another repository,\
      \ suspending any local patches that conflict."

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

apply :: DarcsCommand
apply :: DarcsCommand
apply = DarcsCommand :: String
-> String
-> Doc
-> String
-> Int
-> [String]
-> ((AbsolutePath, AbsolutePath)
    -> [DarcsFlag] -> [String] -> IO ())
-> ([DarcsFlag] -> IO (Either String ()))
-> ((AbsolutePath, AbsolutePath)
    -> [DarcsFlag] -> [String] -> IO [String])
-> ([DarcsFlag] -> AbsolutePath -> [String] -> IO [String])
-> [DarcsOptDescr DarcsFlag]
-> [DarcsOptDescr DarcsFlag]
-> [DarcsFlag]
-> ([DarcsFlag] -> [String])
-> DarcsCommand
DarcsCommand
    { commandProgramName :: String
commandProgramName = String
"darcs"
    , commandName :: String
commandName = String
"apply"
    , commandHelp :: Doc
commandHelp = String -> Doc
text String
applyDescription
    , commandDescription :: String
commandDescription = String
applyDescription
    , commandExtraArgs :: Int
commandExtraArgs = Int
1
    , commandExtraArgHelp :: [String]
commandExtraArgHelp = [String
"<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
  (UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> WantGuiPause
   -> Any)
-> [DarcsOptDescr DarcsFlag]
forall (d :: * -> *) f a b. OptSpec d f a b -> [d f]
odesc OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  (UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> WantGuiPause
   -> Any)
forall a.
OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  (UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> 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
   -> Verbosity
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> WantGuiPause
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> [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
   -> Verbosity
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> WantGuiPause
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> [DarcsFlag])
forall a.
DarcsOption
  a
  (Verify
   -> Reorder
   -> Maybe Bool
   -> DryRun
   -> XmlOutput
   -> [MatchFlag]
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> WantGuiPause
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
applyOpts
    , commandCheckOptions :: [DarcsFlag] -> [String]
commandCheckOptions = OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  (Verify
   -> Reorder
   -> Maybe Bool
   -> DryRun
   -> XmlOutput
   -> [MatchFlag]
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> WantGuiPause
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> 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
   -> Verbosity
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> WantGuiPause
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> Any)
forall a.
DarcsOption
  a
  (Verify
   -> Reorder
   -> Maybe Bool
   -> DryRun
   -> XmlOutput
   -> [MatchFlag]
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> WantGuiPause
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> 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
  (UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> WantGuiPause
   -> a)
applyAdvancedOpts
      = PrimOptSpec
  DarcsOptDescr
  DarcsFlag
  (Compression
   -> SetScriptsExecutable -> UMask -> Bool -> WantGuiPause -> a)
  UseIndex
PrimDarcsOption UseIndex
O.useIndex
      PrimOptSpec
  DarcsOptDescr
  DarcsFlag
  (Compression
   -> SetScriptsExecutable -> UMask -> Bool -> WantGuiPause -> a)
  UseIndex
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (SetScriptsExecutable -> UMask -> Bool -> WantGuiPause -> a)
     (Compression
      -> SetScriptsExecutable -> UMask -> Bool -> WantGuiPause -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (SetScriptsExecutable -> UMask -> Bool -> WantGuiPause -> a)
     (UseIndex
      -> Compression
      -> SetScriptsExecutable
      -> UMask
      -> 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 -> WantGuiPause -> a)
  (Compression
   -> SetScriptsExecutable -> UMask -> Bool -> WantGuiPause -> a)
PrimDarcsOption Compression
O.compress
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (SetScriptsExecutable -> UMask -> Bool -> WantGuiPause -> a)
  (UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> WantGuiPause
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (UMask -> Bool -> WantGuiPause -> a)
     (SetScriptsExecutable -> UMask -> Bool -> WantGuiPause -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (UMask -> Bool -> WantGuiPause -> a)
     (UseIndex
      -> Compression
      -> SetScriptsExecutable
      -> UMask
      -> 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 -> WantGuiPause -> a)
  (SetScriptsExecutable -> UMask -> Bool -> WantGuiPause -> a)
PrimDarcsOption SetScriptsExecutable
O.setScriptsExecutable
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (UMask -> Bool -> WantGuiPause -> a)
  (UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> WantGuiPause
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Bool -> WantGuiPause -> a)
     (UMask -> Bool -> WantGuiPause -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (Bool -> WantGuiPause -> a)
     (UseIndex
      -> Compression
      -> SetScriptsExecutable
      -> UMask
      -> 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)
  (UMask -> Bool -> WantGuiPause -> a)
PrimDarcsOption UMask
O.umask
      OptSpec
  DarcsOptDescr
  DarcsFlag
  (Bool -> WantGuiPause -> a)
  (UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> WantGuiPause
   -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (WantGuiPause -> a)
     (Bool -> WantGuiPause -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     (WantGuiPause -> a)
     (UseIndex
      -> Compression
      -> SetScriptsExecutable
      -> UMask
      -> 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)
  (UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> WantGuiPause
   -> a)
-> OptSpec DarcsOptDescr DarcsFlag a (WantGuiPause -> a)
-> OptSpec
     DarcsOptDescr
     DarcsFlag
     a
     (UseIndex
      -> Compression
      -> SetScriptsExecutable
      -> UMask
      -> 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
   -> Verbosity
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> WantGuiPause
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
applyOpts = OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe StdCmdAction
   -> Verbosity
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> WantGuiPause
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
  (Verify
   -> Reorder
   -> Maybe Bool
   -> DryRun
   -> XmlOutput
   -> [MatchFlag]
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> WantGuiPause
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
forall a.
OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  (Verify
   -> Reorder
   -> Maybe Bool
   -> DryRun
   -> XmlOutput
   -> [MatchFlag]
   -> Maybe String
   -> DiffAlgorithm
   -> a)
applyBasicOpts OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe StdCmdAction
   -> Verbosity
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> WantGuiPause
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
  (Verify
   -> Reorder
   -> Maybe Bool
   -> DryRun
   -> XmlOutput
   -> [MatchFlag]
   -> Maybe String
   -> DiffAlgorithm
   -> Maybe StdCmdAction
   -> Verbosity
   -> UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> WantGuiPause
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
-> DarcsOption
     (UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a)
     (UseIndex
      -> Compression
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> WantGuiPause
      -> UseCache
      -> HooksConfig
      -> Bool
      -> Bool
      -> Bool
      -> a)
-> DarcsOption
     a
     (Verify
      -> Reorder
      -> Maybe Bool
      -> DryRun
      -> XmlOutput
      -> [MatchFlag]
      -> Maybe String
      -> DiffAlgorithm
      -> Maybe StdCmdAction
      -> Verbosity
      -> UseIndex
      -> Compression
      -> SetScriptsExecutable
      -> UMask
      -> Bool
      -> WantGuiPause
      -> UseCache
      -> HooksConfig
      -> Bool
      -> Bool
      -> Bool
      -> a)
forall b c a.
DarcsOption (Maybe StdCmdAction -> Verbosity -> b) c
-> DarcsOption
     (UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a) b
-> DarcsOption a c
`withStdOpts` DarcsOption
  (UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a)
  (UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> WantGuiPause
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
forall a.
OptSpec
  DarcsOptDescr
  DarcsFlag
  a
  (UseIndex
   -> Compression
   -> SetScriptsExecutable
   -> UMask
   -> Bool
   -> WantGuiPause
   -> a)
applyAdvancedOpts
    applyDescription :: String
applyDescription =
      String
"Apply a patch bundle, suspending any local patches that conflict."

data RebasePatchApplier = RebasePatchApplier

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

    repoJob :: RebasePatchApplier
-> (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
RebasePatchApplier 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 = (forall (p :: * -> * -> *) wR wU.
 (RepoPatch p, ApplyState p ~ Tree) =>
 Repository ('RepoType 'IsRebase) p wR wU wR -> IO ())
-> RepoJob ()
forall a.
(forall (p :: * -> * -> *) wR wU.
 (RepoPatch p, ApplyState p ~ Tree) =>
 Repository ('RepoType 'IsRebase) p wR wU wR -> IO a)
-> RepoJob a
StartRebaseJob (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]
-> Repository rt p wR wU wR
-> Fork
     (PatchSet rt p)
     (FL (PatchInfoAnd rt p))
     (FL (PatchInfoAnd rt p))
     Origin
     wR
     wZ
-> IO ()
applyPatches RebasePatchApplier
RebasePatchApplier PatchProxy p
PatchProxy = String
-> [DarcsFlag]
-> Repository rt p wR wU wR
-> Fork
     (PatchSet rt p)
     (FL (PatchInfoAnd rt p))
     (FL (PatchInfoAnd rt p))
     Origin
     wR
     wZ
-> IO ()
forall (p :: * -> * -> *) wR wU wZ.
(RepoPatch p, ApplyState p ~ Tree) =>
String
-> [DarcsFlag]
-> Repository ('RepoType 'IsRebase) p wR wU wR
-> Fork
     (PatchSet ('RepoType 'IsRebase) p)
     (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
     (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
     Origin
     wR
     wZ
-> IO ()
applyPatchesForRebaseCmd

applyPatchesForRebaseCmd
    :: forall p wR wU wZ
     . ( RepoPatch p, ApplyState p ~ Tree )
    => String
    -> [DarcsFlag]
    -> Repository ('RepoType 'IsRebase) p wR wU wR
    -> Fork (PatchSet ('RepoType 'IsRebase) p)
            (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
            (FL (PatchInfoAnd ('RepoType 'IsRebase) p)) Origin wR wZ
    -> IO ()
applyPatchesForRebaseCmd :: String
-> [DarcsFlag]
-> Repository ('RepoType 'IsRebase) p wR wU wR
-> Fork
     (PatchSet ('RepoType 'IsRebase) p)
     (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
     (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
     Origin
     wR
     wZ
-> IO ()
applyPatchesForRebaseCmd String
cmdName [DarcsFlag]
opts Repository ('RepoType 'IsRebase) p wR wU wR
_repository (Fork PatchSet ('RepoType 'IsRebase) p Origin wU
common FL (PatchInfoAnd ('RepoType 'IsRebase) p) wU wR
us' FL (PatchInfoAnd ('RepoType 'IsRebase) p) wU wZ
to_be_applied) = do
    String
-> [DarcsFlag]
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wU wZ
-> IO ()
forall (p :: * -> * -> *) (rt :: RepoType) wX wY.
(RepoPatch p, ApplyState p ~ Tree) =>
String -> [DarcsFlag] -> FL (PatchInfoAnd rt p) wX wY -> IO ()
applyPatchesStart String
cmdName [DarcsFlag]
opts FL (PatchInfoAnd ('RepoType 'IsRebase) p) wU wZ
to_be_applied

    FL (PatchInfoAnd ('RepoType 'IsRebase) p) wU wZ
usOk :> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wR
usConflicted <- (:>)
  (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
  (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
  wU
  wR
-> IO
     ((:>)
        (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
        (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
        wU
        wR)
forall (m :: * -> *) a. Monad m => a -> m a
return ((:>)
   (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
   (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
   wU
   wR
 -> IO
      ((:>)
         (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
         (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
         wU
         wR))
-> (:>)
     (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
     (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
     wU
     wR
-> IO
     ((:>)
        (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
        (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
        wU
        wR)
forall a b. (a -> b) -> a -> b
$ FL (PatchInfoAnd ('RepoType 'IsRebase) p) wU wR
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wU wZ
-> (:>)
     (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
     (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
     wU
     wR
forall (p :: * -> * -> *) wX wY wZ.
(Commute p, CleanMerge p) =>
FL p wX wY -> FL p wX wZ -> (:>) (FL p) (FL p) wX wY
partitionConflictingFL FL (PatchInfoAnd ('RepoType 'IsRebase) p) wU wR
us' FL (PatchInfoAnd ('RepoType 'IsRebase) p) wU wZ
to_be_applied

    Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wR -> Int
forall (a :: * -> * -> *) wX wZ. FL a wX wZ -> Int
lengthFL FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wR
usConflicted Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
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 String
"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 selection_config :: SelectionConfig (PatchInfoAnd ('RepoType 'IsRebase) p)
selection_config = WhichChanges
-> String
-> PatchSelectionOptions
-> Maybe (Splitter (PatchInfoAnd ('RepoType 'IsRebase) p))
-> Maybe [AnchoredPath]
-> SelectionConfig (PatchInfoAnd ('RepoType 'IsRebase) p)
forall (p :: * -> * -> *).
Matchable p =>
WhichChanges
-> String
-> PatchSelectionOptions
-> Maybe (Splitter p)
-> Maybe [AnchoredPath]
-> SelectionConfig p
selectionConfig WhichChanges
LastReversed String
"suspend" PatchSelectionOptions
applyPatchSelOpts Maybe (Splitter (PatchInfoAnd ('RepoType 'IsRebase) p))
forall a. Maybe a
Nothing Maybe [AnchoredPath]
forall a. Maybe a
Nothing

    (FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wZ
usKeep :> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wR
usToSuspend) <- FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wR
-> SelectionConfig (PatchInfoAnd ('RepoType 'IsRebase) p)
-> IO
     ((:>)
        (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
        (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
        wZ
        wR)
forall (p :: * -> * -> *) wX wY.
(MatchableRP p, ShowPatch p, ShowContextPatch p,
 ApplyState p ~ Tree, ApplyState p ~ ApplyState (PrimOf p)) =>
FL p wX wY -> SelectionConfig p -> IO ((:>) (FL p) (FL p) wX wY)
runSelection FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wR
usConflicted SelectionConfig (PatchInfoAnd ('RepoType 'IsRebase) p)
selection_config

    -- 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 String
"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.
PatchInfoAndG rt p wA wB -> PatchInfo
info FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wR
usToSuspend

    Suspended p wR wR
suspended <- Repository ('RepoType 'IsRebase) p wR wU wR
-> IO (Suspended p wR wR)
forall (p :: * -> * -> *) (rt :: RepoType) wR wU wT.
RepoPatch p =>
Repository rt p wR wU wT -> IO (Suspended p wT wT)
readTentativeRebase Repository ('RepoType 'IsRebase) p wR wU wR
_repository

    Repository ('RepoType 'IsRebase) p wR wU wZ
_repository <- [DarcsFlag]
-> Repository ('RepoType 'IsRebase) p wR wU wR
-> Suspended p wR wR
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wR
-> IO (Repository ('RepoType 'IsRebase) p wR wU wZ)
forall (p :: * -> * -> *) wR wU wX.
(RepoPatch p, ApplyState p ~ Tree) =>
[DarcsFlag]
-> Repository ('RepoType 'IsRebase) p wR wU wR
-> Suspended p wR wR
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wX wR
-> IO (Repository ('RepoType 'IsRebase) p wR wU wX)
doSuspend [DarcsFlag]
opts Repository ('RepoType 'IsRebase) p wR wU wR
_repository Suspended p wR wR
suspended FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wR
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 most functions
    -- in Darcs.Repository.State require the recorded state to be equal to the
    -- tentative state and thus must not be called after the repo was changed.
    Repository ('RepoType 'IsRebase) p wZ wU wZ
_repository <- Repository ('RepoType 'IsRebase) p wR wU wZ
-> UpdatePending
-> Compression
-> IO (Repository ('RepoType 'IsRebase) p wZ wU wZ)
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wT
-> UpdatePending -> Compression -> IO (Repository rt p wT wU wT)
finalizeRepositoryChanges Repository ('RepoType 'IsRebase) p wR wU wZ
_repository UpdatePending
YesUpdatePending (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 wZ wU wZ
_repository <- Repository ('RepoType 'IsRebase) p wZ wU wZ
-> UpdatePending
-> IO (Repository ('RepoType 'IsRebase) p wZ wU wZ)
forall (p :: * -> * -> *) (rt :: RepoType) wR wU wT.
RepoPatch p =>
Repository rt p wR wU wT
-> UpdatePending -> IO (Repository rt p wR wU wR)
revertRepositoryChanges Repository ('RepoType 'IsRebase) p wZ wU wZ
_repository UpdatePending
YesUpdatePending

    Sealed FL (PrimOf p) wU wX
pw <-
        Repository ('RepoType 'IsRebase) p wZ wU wZ
-> String
-> AllowConflicts
-> ExternalMerge
-> WantGuiPause
-> Compression
-> Verbosity
-> Reorder
-> (UseIndex, ScanKnown, DiffAlgorithm)
-> Fork
     (PatchSet ('RepoType 'IsRebase) p)
     (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
     (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
     Origin
     wZ
     wZ
-> IO (Sealed (FL (PrimOf p) wU))
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wY.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wR
-> String
-> AllowConflicts
-> ExternalMerge
-> WantGuiPause
-> Compression
-> Verbosity
-> Reorder
-> (UseIndex, ScanKnown, DiffAlgorithm)
-> Fork
     (PatchSet rt p)
     (FL (PatchInfoAnd rt p))
     (FL (PatchInfoAnd rt p))
     Origin
     wR
     wY
-> IO (Sealed (FL (PrimOf p) wU))
tentativelyMergePatches
            Repository ('RepoType 'IsRebase) p wZ wU wZ
_repository String
cmdName
            ([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)
            ([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)
            (PatchSet ('RepoType 'IsRebase) p Origin wU
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wU wZ
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wU wZ
-> Fork
     (PatchSet ('RepoType 'IsRebase) p)
     (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
     (FL (PatchInfoAnd ('RepoType 'IsRebase) p))
     Origin
     wZ
     wZ
forall (common :: * -> * -> *) (left :: * -> * -> *)
       (right :: * -> * -> *) wA wX wY wU.
common wA wU
-> left wU wX -> right wU wY -> Fork common left right wA wX wY
Fork PatchSet ('RepoType 'IsRebase) p Origin wU
common (FL (PatchInfoAnd ('RepoType 'IsRebase) p) wU wZ
usOk FL (PatchInfoAnd ('RepoType 'IsRebase) p) wU wZ
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wZ wZ
-> FL (PatchInfoAnd ('RepoType 'IsRebase) p) wU 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) wU wZ
to_be_applied)
    Repository ('RepoType 'IsRebase) p wZ wU wZ -> IO ()
forall t. t -> IO ()
invalidateIndex Repository ('RepoType 'IsRebase) p wZ wU wZ
_repository

    String
-> [DarcsFlag]
-> Repository ('RepoType 'IsRebase) p wZ wU wZ
-> FL (PrimOf p) wU wX
-> Bool
-> IO ()
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wY.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
String
-> [DarcsFlag]
-> Repository rt p wR wU wR
-> FL (PrimOf p) wU wY
-> Bool
-> IO ()
applyPatchesFinish String
cmdName [DarcsFlag]
opts Repository ('RepoType 'IsRebase) p wZ wU wZ
_repository FL (PrimOf p) wU wX
pw (FL (PatchInfoAnd ('RepoType 'IsRebase) p) wU wZ -> Bool
forall (a :: * -> * -> *) wX wZ. FL a wX wZ -> Bool
nullFL FL (PatchInfoAnd ('RepoType 'IsRebase) p) wU wZ
to_be_applied)

-- TODO I doubt this is right, e.g. withContext should be inherited
applyPatchSelOpts :: S.PatchSelectionOptions
applyPatchSelOpts :: PatchSelectionOptions
applyPatchSelOpts = PatchSelectionOptions :: Verbosity
-> [MatchFlag]
-> Bool
-> SelectDeps
-> WithSummary
-> 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
    , withSummary :: WithSummary
S.withSummary = WithSummary
O.NoSummary
    , withContext :: WithContext
S.withContext = WithContext
O.NoContext
    }

obliteratePatchSelOpts :: [DarcsFlag] -> S.PatchSelectionOptions
obliteratePatchSelOpts :: [DarcsFlag] -> PatchSelectionOptions
obliteratePatchSelOpts [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 Bool
defInteractive [DarcsFlag]
flags = PatchSelectionOptions :: Verbosity
-> [MatchFlag]
-> Bool
-> SelectDeps
-> WithSummary
-> 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
O.matchSeveralOrLast MatchOption -> [DarcsFlag] -> [MatchFlag]
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [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
    , withSummary :: WithSummary
S.withSummary = PrimDarcsOption WithSummary
O.withSummary PrimDarcsOption WithSummary -> [DarcsFlag] -> WithSummary
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
flags
    , withContext :: WithContext
S.withContext = WithContext
O.NoContext
    }

log :: DarcsCommand
log :: DarcsCommand
log = DarcsCommand :: String
-> String
-> Doc
-> String
-> Int
-> [String]
-> ((AbsolutePath, AbsolutePath)
    -> [DarcsFlag] -> [String] -> IO ())
-> ([DarcsFlag] -> IO (Either String ()))
-> ((AbsolutePath, AbsolutePath)
    -> [DarcsFlag] -> [String] -> IO [String])
-> ([DarcsFlag] -> AbsolutePath -> [String] -> IO [String])
-> [DarcsOptDescr DarcsFlag]
-> [DarcsOptDescr DarcsFlag]
-> [DarcsFlag]
-> ([DarcsFlag] -> [String])
-> DarcsCommand
DarcsCommand
    { commandProgramName :: String
commandProgramName = String
"darcs"
    , commandName :: String
commandName = String
"log"
    , commandHelp :: Doc
commandHelp = String -> Doc
text String
logDescription
    , commandDescription :: String
commandDescription = String
logDescription
    , commandPrereq :: [DarcsFlag] -> IO (Either String ())
commandPrereq = [DarcsFlag] -> IO (Either String ())
amInHashedRepository
    , commandExtraArgs :: Int
commandExtraArgs = Int
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 (WithSummary -> Maybe Bool -> Any)
-> [DarcsOptDescr DarcsFlag]
forall (d :: * -> *) f a b. OptSpec d f a b -> [d f]
odesc OptSpec
  DarcsOptDescr DarcsFlag Any (WithSummary -> Maybe Bool -> Any)
forall a.
OptSpec DarcsOptDescr DarcsFlag a (WithSummary -> Maybe Bool -> a)
logBasicOpts
    , commandDefaults :: [DarcsFlag]
commandDefaults = OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  (WithSummary
   -> Maybe Bool
   -> Maybe StdCmdAction
   -> Verbosity
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> [DarcsFlag])
-> [DarcsFlag]
forall (d :: * -> *) f b. OptSpec d f [f] b -> [f]
defaultFlags OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  (WithSummary
   -> Maybe Bool
   -> Maybe StdCmdAction
   -> Verbosity
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> [DarcsFlag])
forall a.
DarcsOption
  a
  (WithSummary
   -> Maybe Bool
   -> Maybe StdCmdAction
   -> Verbosity
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
logOpts
    , commandCheckOptions :: [DarcsFlag] -> [String]
commandCheckOptions = OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  (WithSummary
   -> Maybe Bool
   -> Maybe StdCmdAction
   -> Verbosity
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> Any)
-> [DarcsFlag] -> [String]
forall (d :: * -> *) f a b. OptSpec d f a b -> [f] -> [String]
ocheck OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  (WithSummary
   -> Maybe Bool
   -> Maybe StdCmdAction
   -> Verbosity
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> Any)
forall a.
DarcsOption
  a
  (WithSummary
   -> Maybe Bool
   -> Maybe StdCmdAction
   -> Verbosity
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
logOpts
    }
  where
    logBasicOpts :: OptSpec DarcsOptDescr DarcsFlag a (WithSummary -> Maybe Bool -> a)
logBasicOpts = PrimOptSpec DarcsOptDescr DarcsFlag (Maybe Bool -> a) WithSummary
PrimDarcsOption WithSummary
O.withSummary PrimOptSpec DarcsOptDescr DarcsFlag (Maybe Bool -> a) WithSummary
-> OptSpec DarcsOptDescr DarcsFlag a (Maybe Bool -> a)
-> OptSpec
     DarcsOptDescr DarcsFlag a (WithSummary -> 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
  (WithSummary
   -> Maybe Bool
   -> Maybe StdCmdAction
   -> Verbosity
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
logOpts = OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe StdCmdAction
   -> Verbosity
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
  (WithSummary
   -> Maybe Bool
   -> Maybe StdCmdAction
   -> Verbosity
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
forall a.
OptSpec DarcsOptDescr DarcsFlag a (WithSummary -> Maybe Bool -> a)
logBasicOpts OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe StdCmdAction
   -> Verbosity
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
  (WithSummary
   -> Maybe Bool
   -> Maybe StdCmdAction
   -> Verbosity
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
-> DarcsOption
     (UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a)
     (UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a)
-> DarcsOption
     a
     (WithSummary
      -> Maybe Bool
      -> Maybe StdCmdAction
      -> Verbosity
      -> UseCache
      -> HooksConfig
      -> Bool
      -> Bool
      -> Bool
      -> a)
forall b c a.
DarcsOption (Maybe StdCmdAction -> Verbosity -> b) c
-> DarcsOption
     (UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a) b
-> DarcsOption a c
`withStdOpts` DarcsOption
  (UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a)
  (UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a)
forall (d :: * -> *) f a. OptSpec d f a a
logAdvancedOpts
    logDescription :: String
logDescription = String
"List the currently suspended changes."

logCmd :: (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
logCmd :: (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
logCmd (AbsolutePath, AbsolutePath)
_ [DarcsFlag]
opts [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
$
    (forall (p :: * -> * -> *) wR wU.
 (RepoPatch p, ApplyState p ~ Tree) =>
 Repository ('RepoType 'IsRebase) p wR wU wR -> IO ())
-> RepoJob ()
forall a.
(forall (p :: * -> * -> *) wR wU.
 (RepoPatch p, ApplyState p ~ Tree) =>
 Repository ('RepoType 'IsRebase) p wR wU wR -> IO a)
-> RepoJob a
RebaseJob ((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 -> do
        Items FL (RebaseChange (PrimOf p)) wR wY
ps <- Repository ('RepoType 'IsRebase) p wR wU wR
-> IO (Suspended p wR wR)
forall (p :: * -> * -> *) (rt :: RepoType) wR wU.
RepoPatch p =>
Repository rt p wR wU wR -> IO (Suspended p wR wR)
readRebase Repository ('RepoType 'IsRebase) p wR wU wR
_repository
        let psToShow :: FL
  (PatchInfoAndG ('RepoType 'IsRebase) (RebaseChange (PrimOf p)))
  wR
  wY
psToShow = FL (RebaseChange (PrimOf p)) wR wY
-> FL
     (PatchInfoAndG ('RepoType 'IsRebase) (RebaseChange (PrimOf p)))
     wR
     wY
forall (prim :: * -> * -> *) wX wY.
FL (RebaseChange prim) wX wY
-> FL
     (PatchInfoAndG ('RepoType 'IsRebase) (RebaseChange prim)) wX wY
toRebaseChanges FL (RebaseChange (PrimOf p)) wR wY
ps
        if Bool -> [DarcsFlag] -> Bool
isInteractive Bool
False [DarcsFlag]
opts
            then PatchSelectionOptions
-> [Sealed2
      (PatchInfoAndG ('RepoType 'IsRebase) (RebaseChange (PrimOf 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.
 PatchInfoAndG ('RepoType 'IsRebase) (RebaseChange (PrimOf p)) wW wZ
 -> Sealed2
      (PatchInfoAndG ('RepoType 'IsRebase) (RebaseChange (PrimOf p))))
-> FL
     (PatchInfoAndG ('RepoType 'IsRebase) (RebaseChange (PrimOf p)))
     wR
     wY
-> [Sealed2
      (PatchInfoAndG ('RepoType 'IsRebase) (RebaseChange (PrimOf p)))]
forall (a :: * -> * -> *) b wX wY.
(forall wW wZ. a wW wZ -> b) -> FL a wX wY -> [b]
mapFL forall wW wZ.
PatchInfoAndG ('RepoType 'IsRebase) (RebaseChange (PrimOf p)) wW wZ
-> Sealed2
     (PatchInfoAndG ('RepoType 'IsRebase) (RebaseChange (PrimOf p)))
forall (a :: * -> * -> *) wX wY. a wX wY -> Sealed2 a
Sealed2 FL
  (PatchInfoAndG ('RepoType 'IsRebase) (RebaseChange (PrimOf p)))
  wR
  wY
psToShow)
            else do
                String -> IO ()
debugMessage String
"About to print the changes..."
                let printers :: Printers
printers = if [DarcsFlag] -> Bool
hasXmlOutput [DarcsFlag]
opts then Printers
simplePrinters else Printers
fancyPrinters
                let logDoc :: Doc
logDoc = [DarcsFlag]
-> RL
     (PatchInfoAndG ('RepoType 'IsRebase) (RebaseChange (PrimOf p)))
     wR
     wY
-> LogInfo
     (PatchInfoAndG ('RepoType 'IsRebase) (RebaseChange (PrimOf p)))
-> Doc
forall (rt :: RepoType) (p :: * -> * -> *) wStart wX.
(ShowPatch p, PatchListFormat p, Summary p, HasDeps p,
 PrimDetails (PrimOf p)) =>
[DarcsFlag]
-> RL (PatchInfoAndG rt p) wStart wX
-> LogInfo (PatchInfoAndG rt p)
-> Doc
changelog [DarcsFlag]
opts (FL
  (PatchInfoAndG ('RepoType 'IsRebase) (RebaseChange (PrimOf p)))
  wR
  wY
-> RL
     (PatchInfoAndG ('RepoType 'IsRebase) (RebaseChange (PrimOf p)))
     wR
     wY
forall (a :: * -> * -> *) wX wZ. FL a wX wZ -> RL a wX wZ
reverseFL FL
  (PatchInfoAndG ('RepoType 'IsRebase) (RebaseChange (PrimOf p)))
  wR
  wY
psToShow) (FL
  (PatchInfoAndG ('RepoType 'IsRebase) (RebaseChange (PrimOf p)))
  wR
  wY
-> LogInfo
     (PatchInfoAndG ('RepoType 'IsRebase) (RebaseChange (PrimOf p)))
forall (p :: * -> * -> *) wX wY. FL p wX wY -> LogInfo p
logInfoFL FL
  (PatchInfoAndG ('RepoType 'IsRebase) (RebaseChange (PrimOf p)))
  wR
  wY
psToShow)
                Printers -> Doc -> IO ()
viewDocWith Printers
printers Doc
logDoc

-- | changes is an alias for log
changes :: DarcsCommand
changes :: DarcsCommand
changes = String -> Maybe DarcsCommand -> DarcsCommand -> DarcsCommand
commandAlias String
"changes" Maybe DarcsCommand
forall a. Maybe a
Nothing DarcsCommand
log

upgrade :: DarcsCommand
upgrade :: DarcsCommand
upgrade = DarcsCommand :: String
-> String
-> Doc
-> String
-> Int
-> [String]
-> ((AbsolutePath, AbsolutePath)
    -> [DarcsFlag] -> [String] -> IO ())
-> ([DarcsFlag] -> IO (Either String ()))
-> ((AbsolutePath, AbsolutePath)
    -> [DarcsFlag] -> [String] -> IO [String])
-> ([DarcsFlag] -> AbsolutePath -> [String] -> IO [String])
-> [DarcsOptDescr DarcsFlag]
-> [DarcsOptDescr DarcsFlag]
-> [DarcsFlag]
-> ([DarcsFlag] -> [String])
-> DarcsCommand
DarcsCommand
    { commandProgramName :: String
commandProgramName = String
"darcs"
    , commandName :: String
commandName = String
"upgrade"
    , commandHelp :: Doc
commandHelp = Doc
help
    , commandDescription :: String
commandDescription = String
desc
    , commandPrereq :: [DarcsFlag] -> IO (Either String ())
commandPrereq = [DarcsFlag] -> IO (Either String ())
amInHashedRepository
    , commandExtraArgs :: Int
commandExtraArgs = Int
0
    , commandExtraArgHelp :: [String]
commandExtraArgHelp = []
    , commandCommand :: (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
commandCommand = (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
upgradeCmd
    , 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 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
basicOpts
    , commandDefaults :: [DarcsFlag]
commandDefaults = OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  (Maybe StdCmdAction
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> [DarcsFlag])
-> [DarcsFlag]
forall (d :: * -> *) f b. OptSpec d f [f] b -> [f]
defaultFlags OptSpec
  DarcsOptDescr
  DarcsFlag
  [DarcsFlag]
  (Maybe StdCmdAction
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> [DarcsFlag])
forall a.
DarcsOption
  a
  (Maybe StdCmdAction
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
opts
    , commandCheckOptions :: [DarcsFlag] -> [String]
commandCheckOptions = OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  (Maybe StdCmdAction
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> Any)
-> [DarcsFlag] -> [String]
forall (d :: * -> *) f a b. OptSpec d f a b -> [f] -> [String]
ocheck OptSpec
  DarcsOptDescr
  DarcsFlag
  Any
  (Maybe StdCmdAction
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> Any)
forall a.
DarcsOption
  a
  (Maybe StdCmdAction
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
opts
    }
  where
    basicOpts :: OptSpec d f a a
basicOpts = OptSpec d f a a
forall (d :: * -> *) f a. OptSpec d f a a
oid
    opts :: DarcsOption
  a
  (Maybe StdCmdAction
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
opts = OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe StdCmdAction
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
  (Maybe StdCmdAction
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
forall (d :: * -> *) f a. OptSpec d f a a
basicOpts OptSpec
  DarcsOptDescr
  DarcsFlag
  (Maybe StdCmdAction
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
  (Maybe StdCmdAction
   -> Verbosity
   -> UMask
   -> UseCache
   -> HooksConfig
   -> Bool
   -> Bool
   -> Bool
   -> a)
-> DarcsOption
     (UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a)
     (UMask -> UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a)
-> DarcsOption
     a
     (Maybe StdCmdAction
      -> Verbosity
      -> UMask
      -> UseCache
      -> HooksConfig
      -> Bool
      -> Bool
      -> Bool
      -> a)
forall b c a.
DarcsOption (Maybe StdCmdAction -> Verbosity -> b) c
-> DarcsOption
     (UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a) b
-> DarcsOption a c
`withStdOpts` DarcsOption
  (UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a)
  (UMask -> UseCache -> HooksConfig -> Bool -> Bool -> Bool -> a)
PrimDarcsOption UMask
O.umask
    desc :: String
desc = String
"Upgrade a repo with an old-style rebase in progress."
    help :: Doc
help = String -> Doc
text String
desc Doc -> Doc -> Doc
$+$ [String] -> Doc
formatWords
      [ String
"Doing this means you won't be able to use darcs version < 2.15"
      , String
"with this repository until the rebase is finished."
      ]

upgradeCmd :: (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
upgradeCmd :: (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
upgradeCmd (AbsolutePath, AbsolutePath)
_ [DarcsFlag]
opts [String]
_args =
  DryRun -> UseCache -> UpdatePending -> UMask -> RepoJob () -> IO ()
forall a.
DryRun -> UseCache -> UpdatePending -> 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) UpdatePending
YesUpdatePending (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
$
  (forall (p :: * -> * -> *) wR wU.
 (RepoPatch p, ApplyState p ~ Tree) =>
 Repository ('RepoType 'IsRebase) p wR wU wR -> IO ())
-> RepoJob ()
forall a.
(forall (p :: * -> * -> *) wR wU.
 (RepoPatch p, ApplyState p ~ Tree) =>
 Repository ('RepoType 'IsRebase) p wR wU wR -> IO a)
-> RepoJob a
OldRebaseJob ((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
_repo :: Repository ('RepoType 'IsRebase) p wR wU wR) ->
    Repository ('RepoType 'IsRebase) p wR wU wR -> Compression -> IO ()
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wT -> Compression -> IO ()
upgradeOldStyleRebase Repository ('RepoType 'IsRebase) p wR wU wR
_repo (PrimDarcsOption Compression
compress PrimDarcsOption Compression -> [DarcsFlag] -> Compression
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [DarcsFlag]
opts)

{-
TODO:

 - amend-record shows the diff between the conflicted state and the
   resolution, which is unhelpful
 - make aggregate commands
 - argument handling
 - what should happen to patch comment on unsuspend?
 - warn about suspending conflicts
 - indication of expected conflicts on unsuspend
    - why isn't ! when you do x accurate?
 - 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?
 - 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
 - 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
-}