module Darcs.UI.Commands.Amend
(
amend
, amendrecord
) where
import Prelude ()
import Darcs.Prelude
import Data.Maybe ( isNothing, isJust )
import Control.Monad ( when )
import Darcs.UI.Commands
( DarcsCommand(..), withStdOpts
, commandAlias
, nodefaults
, setEnvDarcsFiles
, setEnvDarcsPatches
, amInHashedRepository
)
import Darcs.UI.Commands.Util ( announceFiles, testTentativeAndMaybeExit )
import Darcs.UI.Completion ( modifiedFileArgs, knownFileArgs )
import Darcs.UI.Flags ( DarcsFlag, diffOpts, fixSubPaths )
import Darcs.UI.Options ( DarcsOption, (^), oparse, odesc, ocheck, defaultFlags, (?) )
import qualified Darcs.UI.Options.All as O
import Darcs.UI.PatchHeader ( updatePatchHeader, AskAboutDeps(..)
, HijackOptions(..)
, runHijackT )
import Darcs.Repository.Flags ( UpdateWorking(..), DryRun(NoDryRun) )
import Darcs.Patch ( IsRepoType, RepoPatch, description, PrimOf
, effect, invert, invertFL
)
import Darcs.Patch.Apply ( ApplyState )
import Darcs.Patch.Info ( isTag )
import Darcs.Patch.Split ( primSplitter )
import Darcs.Patch.PatchInfoAnd ( PatchInfoAnd, info, patchDesc )
import Darcs.Patch.Rebase.Fixup ( RebaseFixup(..) )
import Darcs.Patch.Rebase.Name ( RebaseName(..) )
import Darcs.Util.Path ( toFilePath, SubPath(), AbsolutePath )
import Darcs.Repository
( Repository
, withRepoLock
, RepoJob(..)
, RebaseJobFlags(..)
, tentativelyRemovePatches
, tentativelyAddPatch
, withManualRebaseUpdate
, finalizeRepositoryChanges
, invalidateIndex
, unrecordedChanges
, readRecorded
)
import Darcs.Repository.Prefs ( globalPrefsDirDoc )
import Darcs.UI.SelectChanges
( WhichChanges(..)
, selectionContextPrim
, runSelection
, withSelectedPatchFromRepo
)
import qualified Darcs.UI.SelectChanges as S
( PatchSelectionOptions(..)
)
import Darcs.Util.Exception ( clarifyErrors )
import Darcs.Patch.Witnesses.Ordered
( FL(..), (:>)(..), (+>+), nullFL, reverseRL, mapFL_FL )
import Darcs.Util.Printer ( putDocLn )
import Darcs.Util.Tree( Tree )
import Darcs.Repository.Pending ( tentativelyRemoveFromPending )
amendDescription :: String
amendDescription :: String
amendDescription = "Improve a patch before it leaves your repository."
amendHelp :: String
amendHelp :: String
amendHelp =
"Amend updates a \"draft\" patch with additions or improvements,\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"resulting in a single \"finished\" patch.\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"By default `amend` proposes you to record additional changes.\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"If instead you want to remove changes, use the flag `--unrecord`.\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"When recording a draft patch, it is a good idea to start the name with\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"`DRAFT:`. When done, remove it with `darcs amend --edit-long-comment`.\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"Alternatively, to change the patch name without starting an editor, \n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"use the `--name`/`-m` flag:\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
" darcs amend --match 'name \"DRAFT: foo\"' --name 'foo2'\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"Like `darcs record`, if you call amend with files as arguments,\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"you will only be asked about changes to those files. So to amend a\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"patch to foo.c with improvements in bar.c, you would run:\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
" darcs amend --match 'touch foo.c' bar.c\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"It is usually a bad idea to amend another developer's patch. To make\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"amend only ask about your own patches by default, you can add\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"something like `amend match David Roundy` to `" String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
globalPrefsDirDoc String -> String -> String
forall a. [a] -> [a] -> [a]
++
"defaults`, \n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
"where `David Roundy` is your name.\n"
amendBasicOpts :: DarcsOption a
(Bool
-> [O.MatchFlag]
-> O.TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe O.AskLongComment
-> Bool
-> O.LookFor
-> Maybe String
-> O.WithContext
-> O.DiffAlgorithm
-> a)
amendBasicOpts :: DarcsOption
a
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
amendBasicOpts
= PrimOptSpec
DarcsOptDescr
Flag
([MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
Bool
PrimDarcsOption Bool
O.amendUnrecord
PrimOptSpec
DarcsOptDescr
Flag
([MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
Bool
-> OptSpec
DarcsOptDescr
Flag
(TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
([MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
-> OptSpec
DarcsOptDescr
Flag
(TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
Flag
(TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
([MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
MatchOption
O.matchOneNontag
OptSpec
DarcsOptDescr
Flag
(TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
-> OptSpec
DarcsOptDescr
Flag
(Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
-> OptSpec
DarcsOptDescr
Flag
(Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
Flag
(Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
PrimDarcsOption TestChanges
O.testChanges
OptSpec
DarcsOptDescr
Flag
(Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
-> OptSpec
DarcsOptDescr
Flag
(Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
-> OptSpec
DarcsOptDescr
Flag
(Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
Flag
(Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
PrimDarcsOption (Maybe Bool)
O.interactive
OptSpec
DarcsOptDescr
Flag
(Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
-> OptSpec
DarcsOptDescr
Flag
(Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
-> OptSpec
DarcsOptDescr
Flag
(Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
Flag
(Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
PrimDarcsOption (Maybe String)
O.author
OptSpec
DarcsOptDescr
Flag
(Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
-> OptSpec
DarcsOptDescr
Flag
(Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
-> OptSpec
DarcsOptDescr
Flag
(Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
Flag
(Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
PrimDarcsOption Bool
O.selectAuthor
OptSpec
DarcsOptDescr
Flag
(Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
-> OptSpec
DarcsOptDescr
Flag
(Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
-> OptSpec
DarcsOptDescr
Flag
(Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
Flag
(Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
PrimDarcsOption (Maybe String)
O.patchname
OptSpec
DarcsOptDescr
Flag
(Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
-> OptSpec
DarcsOptDescr
Flag
(Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
-> OptSpec
DarcsOptDescr
Flag
(Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
Flag
(Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
PrimDarcsOption Bool
O.askDeps
OptSpec
DarcsOptDescr
Flag
(Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
-> OptSpec
DarcsOptDescr
Flag
(Bool
-> LookFor -> Maybe String -> WithContext -> DiffAlgorithm -> a)
(Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
-> OptSpec
DarcsOptDescr
Flag
(Bool
-> LookFor -> Maybe String -> WithContext -> DiffAlgorithm -> a)
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
Flag
(Bool
-> LookFor -> Maybe String -> WithContext -> DiffAlgorithm -> a)
(Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
PrimDarcsOption (Maybe AskLongComment)
O.askLongComment
OptSpec
DarcsOptDescr
Flag
(Bool
-> LookFor -> Maybe String -> WithContext -> DiffAlgorithm -> a)
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
-> OptSpec
DarcsOptDescr
Flag
(LookFor -> Maybe String -> WithContext -> DiffAlgorithm -> a)
(Bool
-> LookFor -> Maybe String -> WithContext -> DiffAlgorithm -> a)
-> OptSpec
DarcsOptDescr
Flag
(LookFor -> Maybe String -> WithContext -> DiffAlgorithm -> a)
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
Flag
(LookFor -> Maybe String -> WithContext -> DiffAlgorithm -> a)
(Bool
-> LookFor -> Maybe String -> WithContext -> DiffAlgorithm -> a)
PrimDarcsOption Bool
O.keepDate
OptSpec
DarcsOptDescr
Flag
(LookFor -> Maybe String -> WithContext -> DiffAlgorithm -> a)
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
-> OptSpec
DarcsOptDescr
Flag
(Maybe String -> WithContext -> DiffAlgorithm -> a)
(LookFor -> Maybe String -> WithContext -> DiffAlgorithm -> a)
-> OptSpec
DarcsOptDescr
Flag
(Maybe String -> WithContext -> DiffAlgorithm -> a)
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
Flag
(Maybe String -> WithContext -> DiffAlgorithm -> a)
(LookFor -> Maybe String -> WithContext -> DiffAlgorithm -> a)
PrimDarcsOption LookFor
O.lookfor
OptSpec
DarcsOptDescr
Flag
(Maybe String -> WithContext -> DiffAlgorithm -> a)
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
-> OptSpec
DarcsOptDescr
Flag
(WithContext -> DiffAlgorithm -> a)
(Maybe String -> WithContext -> DiffAlgorithm -> a)
-> OptSpec
DarcsOptDescr
Flag
(WithContext -> DiffAlgorithm -> a)
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
Flag
(WithContext -> DiffAlgorithm -> a)
(Maybe String -> WithContext -> DiffAlgorithm -> a)
PrimDarcsOption (Maybe String)
O.repoDir
OptSpec
DarcsOptDescr
Flag
(WithContext -> DiffAlgorithm -> a)
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
-> OptSpec
DarcsOptDescr
Flag
(DiffAlgorithm -> a)
(WithContext -> DiffAlgorithm -> a)
-> OptSpec
DarcsOptDescr
Flag
(DiffAlgorithm -> a)
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
Flag
(DiffAlgorithm -> a)
(WithContext -> DiffAlgorithm -> a)
PrimDarcsOption WithContext
O.withContext
OptSpec
DarcsOptDescr
Flag
(DiffAlgorithm -> a)
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
-> OptSpec DarcsOptDescr Flag a (DiffAlgorithm -> a)
-> DarcsOption
a
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec DarcsOptDescr Flag a (DiffAlgorithm -> a)
PrimDarcsOption DiffAlgorithm
O.diffAlgorithm
amendAdvancedOpts :: DarcsOption a
(O.Compression
-> O.UseIndex
-> O.UMask
-> O.SetScriptsExecutable
-> a)
amendAdvancedOpts :: DarcsOption
a (Compression -> UseIndex -> UMask -> SetScriptsExecutable -> a)
amendAdvancedOpts = PrimOptSpec
DarcsOptDescr
Flag
(UseIndex -> UMask -> SetScriptsExecutable -> a)
Compression
PrimDarcsOption Compression
O.compress PrimOptSpec
DarcsOptDescr
Flag
(UseIndex -> UMask -> SetScriptsExecutable -> a)
Compression
-> OptSpec
DarcsOptDescr
Flag
(UMask -> SetScriptsExecutable -> a)
(UseIndex -> UMask -> SetScriptsExecutable -> a)
-> OptSpec
DarcsOptDescr
Flag
(UMask -> SetScriptsExecutable -> a)
(Compression -> UseIndex -> UMask -> SetScriptsExecutable -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
Flag
(UMask -> SetScriptsExecutable -> a)
(UseIndex -> UMask -> SetScriptsExecutable -> a)
PrimDarcsOption UseIndex
O.useIndex OptSpec
DarcsOptDescr
Flag
(UMask -> SetScriptsExecutable -> a)
(Compression -> UseIndex -> UMask -> SetScriptsExecutable -> a)
-> OptSpec
DarcsOptDescr
Flag
(SetScriptsExecutable -> a)
(UMask -> SetScriptsExecutable -> a)
-> OptSpec
DarcsOptDescr
Flag
(SetScriptsExecutable -> a)
(Compression -> UseIndex -> UMask -> SetScriptsExecutable -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
Flag
(SetScriptsExecutable -> a)
(UMask -> SetScriptsExecutable -> a)
PrimDarcsOption UMask
O.umask OptSpec
DarcsOptDescr
Flag
(SetScriptsExecutable -> a)
(Compression -> UseIndex -> UMask -> SetScriptsExecutable -> a)
-> OptSpec DarcsOptDescr Flag a (SetScriptsExecutable -> a)
-> DarcsOption
a (Compression -> UseIndex -> UMask -> SetScriptsExecutable -> a)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec DarcsOptDescr Flag a (SetScriptsExecutable -> a)
PrimDarcsOption SetScriptsExecutable
O.setScriptsExecutable
amendOpts :: DarcsOption a
(Bool
-> [O.MatchFlag]
-> O.TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe O.AskLongComment
-> Bool
-> O.LookFor
-> Maybe String
-> O.WithContext
-> O.DiffAlgorithm
-> Maybe O.StdCmdAction
-> Bool
-> Bool
-> O.Verbosity
-> Bool
-> O.Compression
-> O.UseIndex
-> O.UMask
-> O.SetScriptsExecutable
-> O.UseCache
-> O.HooksConfig
-> a)
amendOpts :: DarcsOption
a
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> UseCache
-> HooksConfig
-> a)
amendOpts = DarcsOption
(Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> UseCache
-> HooksConfig
-> a)
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> UseCache
-> HooksConfig
-> a)
-> DarcsOption
(UseCache -> HooksConfig -> a)
(Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> UseCache
-> HooksConfig
-> a)
-> DarcsOption
a
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> UseCache
-> HooksConfig
-> a)
forall b c a.
DarcsOption
(Maybe StdCmdAction -> Bool -> Bool -> Verbosity -> Bool -> b) c
-> DarcsOption (UseCache -> HooksConfig -> a) b -> DarcsOption a c
withStdOpts DarcsOption
(Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> UseCache
-> HooksConfig
-> a)
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> UseCache
-> HooksConfig
-> a)
forall a.
DarcsOption
a
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
amendBasicOpts DarcsOption
(UseCache -> HooksConfig -> a)
(Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> UseCache
-> HooksConfig
-> a)
forall a.
DarcsOption
a (Compression -> UseIndex -> UMask -> SetScriptsExecutable -> a)
amendAdvancedOpts
data AmendConfig = AmendConfig
{ AmendConfig -> Bool
amendUnrecord :: Bool
, AmendConfig -> [MatchFlag]
matchFlags :: [O.MatchFlag]
, AmendConfig -> TestChanges
testChanges :: O.TestChanges
, AmendConfig -> Maybe Bool
interactive :: Maybe Bool
, AmendConfig -> Maybe String
author :: Maybe String
, AmendConfig -> Bool
selectAuthor :: Bool
, AmendConfig -> Maybe String
patchname :: Maybe String
, AmendConfig -> Bool
askDeps :: Bool
, :: Maybe O.AskLongComment
, AmendConfig -> Bool
keepDate :: Bool
, AmendConfig -> LookFor
lookfor :: O.LookFor
, AmendConfig -> Maybe String
_workingRepoDir :: Maybe String
, AmendConfig -> WithContext
withContext :: O.WithContext
, AmendConfig -> DiffAlgorithm
diffAlgorithm :: O.DiffAlgorithm
, AmendConfig -> Verbosity
verbosity :: O.Verbosity
, AmendConfig -> Compression
compress :: O.Compression
, AmendConfig -> UseIndex
useIndex :: O.UseIndex
, AmendConfig -> UMask
umask :: O.UMask
, AmendConfig -> SetScriptsExecutable
sse :: O.SetScriptsExecutable
, AmendConfig -> UseCache
useCache :: O.UseCache
}
amendConfig :: [DarcsFlag] -> AmendConfig
amendConfig :: [Flag] -> AmendConfig
amendConfig =
OptSpec
DarcsOptDescr
Flag
AmendConfig
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Verbosity
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> UseCache
-> AmendConfig)
-> (Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Verbosity
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> UseCache
-> AmendConfig)
-> [Flag]
-> AmendConfig
forall (d :: * -> *) f a b. OptSpec d f a b -> b -> [f] -> a
oparse (DarcsOption
(Verbosity
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> UseCache
-> AmendConfig)
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Verbosity
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> UseCache
-> AmendConfig)
forall a.
DarcsOption
a
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
amendBasicOpts DarcsOption
(Verbosity
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> UseCache
-> AmendConfig)
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Verbosity
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> UseCache
-> AmendConfig)
-> OptSpec
DarcsOptDescr
Flag
(Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> UseCache
-> AmendConfig)
(Verbosity
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> UseCache
-> AmendConfig)
-> OptSpec
DarcsOptDescr
Flag
(Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> UseCache
-> AmendConfig)
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Verbosity
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> UseCache
-> AmendConfig)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
Flag
(Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> UseCache
-> AmendConfig)
(Verbosity
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> UseCache
-> AmendConfig)
PrimDarcsOption Verbosity
O.verbosity OptSpec
DarcsOptDescr
Flag
(Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> UseCache
-> AmendConfig)
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Verbosity
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> UseCache
-> AmendConfig)
-> OptSpec
DarcsOptDescr
Flag
(UseCache -> AmendConfig)
(Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> UseCache
-> AmendConfig)
-> OptSpec
DarcsOptDescr
Flag
(UseCache -> AmendConfig)
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Verbosity
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> UseCache
-> AmendConfig)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec
DarcsOptDescr
Flag
(UseCache -> AmendConfig)
(Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> UseCache
-> AmendConfig)
forall a.
DarcsOption
a (Compression -> UseIndex -> UMask -> SetScriptsExecutable -> a)
amendAdvancedOpts OptSpec
DarcsOptDescr
Flag
(UseCache -> AmendConfig)
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Verbosity
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> UseCache
-> AmendConfig)
-> OptSpec DarcsOptDescr Flag AmendConfig (UseCache -> AmendConfig)
-> OptSpec
DarcsOptDescr
Flag
AmendConfig
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Verbosity
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> UseCache
-> AmendConfig)
forall (d :: * -> *) f b c a.
OptSpec d f b c -> OptSpec d f a b -> OptSpec d f a c
^ OptSpec DarcsOptDescr Flag AmendConfig (UseCache -> AmendConfig)
PrimDarcsOption UseCache
O.useCache) Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Verbosity
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> UseCache
-> AmendConfig
AmendConfig
amend :: DarcsCommand AmendConfig
amend :: DarcsCommand AmendConfig
amend = DarcsCommand :: forall parsedFlags.
String
-> String
-> String
-> String
-> Int
-> [String]
-> ((AbsolutePath, AbsolutePath)
-> parsedFlags -> [String] -> IO ())
-> ([Flag] -> IO (Either String ()))
-> ((AbsolutePath, AbsolutePath)
-> [Flag] -> [String] -> IO [String])
-> ([Flag] -> AbsolutePath -> [String] -> IO [String])
-> [DarcsOptDescr Flag]
-> [DarcsOptDescr Flag]
-> [Flag]
-> ([Flag] -> [String])
-> ([Flag] -> parsedFlags)
-> DarcsCommand parsedFlags
DarcsCommand
{
commandProgramName :: String
commandProgramName = "darcs"
, commandName :: String
commandName = "amend"
, commandHelp :: String
commandHelp = String
amendHelp
, commandDescription :: String
commandDescription = String
amendDescription
, commandExtraArgs :: Int
commandExtraArgs = -1
, commandExtraArgHelp :: [String]
commandExtraArgHelp = ["[FILE or DIRECTORY]..."]
, commandCommand :: (AbsolutePath, AbsolutePath) -> AmendConfig -> [String] -> IO ()
commandCommand = (AbsolutePath, AbsolutePath) -> AmendConfig -> [String] -> IO ()
amendCmd
, commandPrereq :: [Flag] -> IO (Either String ())
commandPrereq = [Flag] -> IO (Either String ())
amInHashedRepository
, commandCompleteArgs :: (AbsolutePath, AbsolutePath) -> [Flag] -> [String] -> IO [String]
commandCompleteArgs = (AbsolutePath, AbsolutePath) -> [Flag] -> [String] -> IO [String]
amendFileArgs
, commandArgdefaults :: [Flag] -> AbsolutePath -> [String] -> IO [String]
commandArgdefaults = [Flag] -> AbsolutePath -> [String] -> IO [String]
nodefaults
, commandAdvancedOptions :: [DarcsOptDescr Flag]
commandAdvancedOptions = OptSpec
DarcsOptDescr
Flag
Any
(Compression -> UseIndex -> UMask -> SetScriptsExecutable -> Any)
-> [DarcsOptDescr Flag]
forall (d :: * -> *) f a b. OptSpec d f a b -> [d f]
odesc OptSpec
DarcsOptDescr
Flag
Any
(Compression -> UseIndex -> UMask -> SetScriptsExecutable -> Any)
forall a.
DarcsOption
a (Compression -> UseIndex -> UMask -> SetScriptsExecutable -> a)
amendAdvancedOpts
, commandBasicOptions :: [DarcsOptDescr Flag]
commandBasicOptions = OptSpec
DarcsOptDescr
Flag
Any
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Any)
-> [DarcsOptDescr Flag]
forall (d :: * -> *) f a b. OptSpec d f a b -> [d f]
odesc OptSpec
DarcsOptDescr
Flag
Any
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Any)
forall a.
DarcsOption
a
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> a)
amendBasicOpts
, commandDefaults :: [Flag]
commandDefaults = OptSpec
DarcsOptDescr
Flag
[Flag]
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> UseCache
-> HooksConfig
-> [Flag])
-> [Flag]
forall (d :: * -> *) f b. OptSpec d f [f] b -> [f]
defaultFlags OptSpec
DarcsOptDescr
Flag
[Flag]
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> UseCache
-> HooksConfig
-> [Flag])
forall a.
DarcsOption
a
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> UseCache
-> HooksConfig
-> a)
amendOpts
, commandCheckOptions :: [Flag] -> [String]
commandCheckOptions = OptSpec
DarcsOptDescr
Flag
Any
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> UseCache
-> HooksConfig
-> Any)
-> [Flag] -> [String]
forall (d :: * -> *) f a b. OptSpec d f a b -> [f] -> [String]
ocheck OptSpec
DarcsOptDescr
Flag
Any
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> UseCache
-> HooksConfig
-> Any)
forall a.
DarcsOption
a
(Bool
-> [MatchFlag]
-> TestChanges
-> Maybe Bool
-> Maybe String
-> Bool
-> Maybe String
-> Bool
-> Maybe AskLongComment
-> Bool
-> LookFor
-> Maybe String
-> WithContext
-> DiffAlgorithm
-> Maybe StdCmdAction
-> Bool
-> Bool
-> Verbosity
-> Bool
-> Compression
-> UseIndex
-> UMask
-> SetScriptsExecutable
-> UseCache
-> HooksConfig
-> a)
amendOpts
, commandParseOptions :: [Flag] -> AmendConfig
commandParseOptions = [Flag] -> AmendConfig
amendConfig
}
where
amendFileArgs :: (AbsolutePath, AbsolutePath) -> [Flag] -> [String] -> IO [String]
amendFileArgs fps :: (AbsolutePath, AbsolutePath)
fps flags :: [Flag]
flags args :: [String]
args =
if (PrimDarcsOption Bool
O.amendUnrecord PrimDarcsOption Bool -> [Flag] -> Bool
forall (d :: * -> *) f v.
(forall a. PrimOptSpec d f a v) -> [f] -> v
? [Flag]
flags)
then (AbsolutePath, AbsolutePath) -> [Flag] -> [String] -> IO [String]
knownFileArgs (AbsolutePath, AbsolutePath)
fps [Flag]
flags [String]
args
else (AbsolutePath, AbsolutePath) -> [Flag] -> [String] -> IO [String]
modifiedFileArgs (AbsolutePath, AbsolutePath)
fps [Flag]
flags [String]
args
amendrecord :: DarcsCommand AmendConfig
amendrecord :: DarcsCommand AmendConfig
amendrecord = String
-> Maybe (DarcsCommand AmendConfig)
-> DarcsCommand AmendConfig
-> DarcsCommand AmendConfig
forall pf.
String
-> Maybe (DarcsCommand pf) -> DarcsCommand pf -> DarcsCommand pf
commandAlias "amend-record" Maybe (DarcsCommand AmendConfig)
forall a. Maybe a
Nothing DarcsCommand AmendConfig
amend
amendCmd :: (AbsolutePath, AbsolutePath)
-> AmendConfig
-> [String]
-> IO ()
amendCmd :: (AbsolutePath, AbsolutePath) -> AmendConfig -> [String] -> IO ()
amendCmd _ cfg :: AmendConfig
cfg [] = AmendConfig -> Maybe [SubPath] -> IO ()
doAmend AmendConfig
cfg Maybe [SubPath]
forall a. Maybe a
Nothing
amendCmd fps :: (AbsolutePath, AbsolutePath)
fps cfg :: AmendConfig
cfg args :: [String]
args = do
[SubPath]
files <- (AbsolutePath, AbsolutePath) -> [String] -> IO [SubPath]
fixSubPaths (AbsolutePath, AbsolutePath)
fps [String]
args
if [SubPath] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [SubPath]
files
then String -> IO ()
forall (m :: * -> *) a. MonadFail m => String -> m a
fail "No valid arguments were given, nothing to do."
else AmendConfig -> Maybe [SubPath] -> IO ()
doAmend AmendConfig
cfg (Maybe [SubPath] -> IO ()) -> Maybe [SubPath] -> IO ()
forall a b. (a -> b) -> a -> b
$ [SubPath] -> Maybe [SubPath]
forall a. a -> Maybe a
Just [SubPath]
files
doAmend :: AmendConfig -> Maybe [SubPath] -> IO ()
doAmend :: AmendConfig -> Maybe [SubPath] -> IO ()
doAmend cfg :: AmendConfig
cfg files :: Maybe [SubPath]
files =
let rebaseJobFlags :: RebaseJobFlags
rebaseJobFlags = Compression -> Verbosity -> UpdateWorking -> RebaseJobFlags
RebaseJobFlags (AmendConfig -> Compression
compress AmendConfig
cfg) (AmendConfig -> Verbosity
verbosity AmendConfig
cfg) UpdateWorking
YesUpdateWorking in
DryRun -> UseCache -> UpdateWorking -> UMask -> RepoJob () -> IO ()
forall a.
DryRun -> UseCache -> UpdateWorking -> UMask -> RepoJob a -> IO a
withRepoLock DryRun
NoDryRun (AmendConfig -> UseCache
useCache AmendConfig
cfg) UpdateWorking
YesUpdateWorking (AmendConfig -> UMask
umask AmendConfig
cfg) (RepoJob () -> IO ()) -> RepoJob () -> IO ()
forall a b. (a -> b) -> a -> b
$
RebaseJobFlags
-> (forall (rt :: RepoType) (p :: * -> * -> *) wR wU.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wR -> IO ())
-> RepoJob ()
forall a.
RebaseJobFlags
-> (forall (rt :: RepoType) (p :: * -> * -> *) wR wU.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wR -> IO a)
-> RepoJob a
RebaseAwareJob RebaseJobFlags
rebaseJobFlags ((forall (rt :: RepoType) (p :: * -> * -> *) wR wU.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wR -> IO ())
-> RepoJob ())
-> (forall (rt :: RepoType) (p :: * -> * -> *) wR wU.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wR -> IO ())
-> RepoJob ()
forall a b. (a -> b) -> a -> b
$ \(Repository rt p wR wU wR
repository :: Repository rt p wR wU wR) ->
String
-> Repository rt p wR wU wR
-> PatchSelectionOptions
-> (forall wA.
(:>) (FL (PatchInfoAnd rt p)) (PatchInfoAnd rt p) wA wR -> IO ())
-> IO ()
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
String
-> Repository rt p wR wU wT
-> PatchSelectionOptions
-> (forall wA.
(:>) (FL (PatchInfoAnd rt p)) (PatchInfoAnd rt p) wA wR -> IO ())
-> IO ()
withSelectedPatchFromRepo "amend" Repository rt p wR wU wR
repository (AmendConfig -> PatchSelectionOptions
patchSelOpts AmendConfig
cfg) ((forall wA.
(:>) (FL (PatchInfoAnd rt p)) (PatchInfoAnd rt p) wA wR -> IO ())
-> IO ())
-> (forall wA.
(:>) (FL (PatchInfoAnd rt p)) (PatchInfoAnd rt p) wA wR -> IO ())
-> IO ()
forall a b. (a -> b) -> a -> b
$ \ (_ :> oldp :: PatchInfoAnd rt p wZ wR
oldp) -> do
Verbosity -> Maybe [SubPath] -> String -> IO ()
announceFiles (AmendConfig -> Verbosity
verbosity AmendConfig
cfg) Maybe [SubPath]
files "Amending changes in"
Tree IO
pristine <- Repository rt p wR wU wR -> IO (Tree IO)
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
Repository rt p wR wU wT -> IO (Tree IO)
readRecorded Repository rt p wR wU wR
repository
let go :: forall wU1 . FL (PrimOf p) wR wU1 -> IO ()
go :: FL (PrimOf p) wR wU1 -> IO ()
go NilFL | Bool -> Bool
not (AmendConfig -> Bool
hasEditMetadata AmendConfig
cfg) = String -> IO ()
putStrLn "No changes!"
go ch :: FL (PrimOf p) wR wU1
ch =
do let context :: PatchSelectionContext (PrimOf p)
context = WhichChanges
-> String
-> PatchSelectionOptions
-> Maybe (Splitter (PrimOf p))
-> Maybe [String]
-> Maybe (Tree IO)
-> PatchSelectionContext (PrimOf p)
forall (prim :: * -> * -> *).
WhichChanges
-> String
-> PatchSelectionOptions
-> Maybe (Splitter prim)
-> Maybe [String]
-> Maybe (Tree IO)
-> PatchSelectionContext prim
selectionContextPrim WhichChanges
First "record"
(AmendConfig -> PatchSelectionOptions
patchSelOpts AmendConfig
cfg)
(Splitter (PrimOf p) -> Maybe (Splitter (PrimOf p))
forall a. a -> Maybe a
Just (DiffAlgorithm -> Splitter (PrimOf p)
forall (p :: * -> * -> *).
PrimPatch p =>
DiffAlgorithm -> Splitter p
primSplitter (AmendConfig -> DiffAlgorithm
diffAlgorithm AmendConfig
cfg)))
((SubPath -> String) -> [SubPath] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map SubPath -> String
forall a. FilePathLike a => a -> String
toFilePath ([SubPath] -> [String]) -> Maybe [SubPath] -> Maybe [String]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe [SubPath]
files)
(Tree IO -> Maybe (Tree IO)
forall a. a -> Maybe a
Just Tree IO
pristine)
(chosenPatches :: FL (PrimOf p) wR wZ
chosenPatches :> _) <- FL (PrimOf p) wR wU1
-> PatchSelectionContext (PrimOf p)
-> IO ((:>) (FL (PrimOf p)) (FL (PrimOf p)) wR wU1)
forall (p :: * -> * -> *) wX wY.
(Invert p, Commute p, Apply p, PatchInspect p, ShowPatch p,
ShowContextPatch p, ApplyState p ~ Tree) =>
FL p wX wY
-> PatchSelectionContext p -> IO ((:>) (FL p) (FL p) wX wY)
runSelection FL (PrimOf p) wR wU1
ch PatchSelectionContext (PrimOf p)
context
AmendConfig
-> Repository rt p wR wU wR
-> PatchInfoAnd rt p wZ wR
-> FL (PrimOf p) wR wZ
-> IO ()
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT wX wY.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
AmendConfig
-> Repository rt p wR wU wT
-> PatchInfoAnd rt p wX wT
-> FL (PrimOf p) wT wY
-> IO ()
addChangesToPatch AmendConfig
cfg Repository rt p wR wU wR
repository PatchInfoAnd rt p wZ wR
oldp FL (PrimOf p) wR wZ
chosenPatches
if Bool -> Bool
not (PatchInfo -> Bool
isTag (PatchInfoAnd rt p wZ wR -> PatchInfo
forall (rt :: RepoType) (p :: * -> * -> *) wA wB.
PatchInfoAnd rt p wA wB -> PatchInfo
info PatchInfoAnd rt p wZ wR
oldp))
then if AmendConfig -> Bool
amendUnrecord AmendConfig
cfg
then do let context :: PatchSelectionContext (PrimOf p)
context = WhichChanges
-> String
-> PatchSelectionOptions
-> Maybe (Splitter (PrimOf p))
-> Maybe [String]
-> Maybe (Tree IO)
-> PatchSelectionContext (PrimOf p)
forall (prim :: * -> * -> *).
WhichChanges
-> String
-> PatchSelectionOptions
-> Maybe (Splitter prim)
-> Maybe [String]
-> Maybe (Tree IO)
-> PatchSelectionContext prim
selectionContextPrim WhichChanges
Last "unrecord"
(AmendConfig -> PatchSelectionOptions
patchSelOpts AmendConfig
cfg)
(Splitter (PrimOf p) -> Maybe (Splitter (PrimOf p))
forall a. a -> Maybe a
Just (DiffAlgorithm -> Splitter (PrimOf p)
forall (p :: * -> * -> *).
PrimPatch p =>
DiffAlgorithm -> Splitter p
primSplitter (AmendConfig -> DiffAlgorithm
diffAlgorithm AmendConfig
cfg)))
((SubPath -> String) -> [SubPath] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map SubPath -> String
forall a. FilePathLike a => a -> String
toFilePath ([SubPath] -> [String]) -> Maybe [SubPath] -> Maybe [String]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe [SubPath]
files)
(Tree IO -> Maybe (Tree IO)
forall a. a -> Maybe a
Just Tree IO
pristine)
(_ :> chosenPrims :: FL (PrimOf p) wZ wR
chosenPrims) <- FL (PrimOf p) wZ wR
-> PatchSelectionContext (PrimOf p)
-> IO ((:>) (FL (PrimOf p)) (FL (PrimOf p)) wZ wR)
forall (p :: * -> * -> *) wX wY.
(Invert p, Commute p, Apply p, PatchInspect p, ShowPatch p,
ShowContextPatch p, ApplyState p ~ Tree) =>
FL p wX wY
-> PatchSelectionContext p -> IO ((:>) (FL p) (FL p) wX wY)
runSelection (PatchInfoAnd rt p wZ wR -> FL (PrimOf (PatchInfoAnd rt p)) wZ wR
forall (p :: * -> * -> *) wX wY.
Effect p =>
p wX wY -> FL (PrimOf p) wX wY
effect PatchInfoAnd rt p wZ wR
oldp) PatchSelectionContext (PrimOf p)
context
let invPrims :: FL (PrimOf p) wR wZ
invPrims = RL (PrimOf p) wR wZ -> FL (PrimOf p) wR wZ
forall (a :: * -> * -> *) wX wZ. RL a wX wZ -> FL a wX wZ
reverseRL (FL (PrimOf p) wZ wR -> RL (PrimOf p) wR wZ
forall (p :: * -> * -> *) wX wY.
Invert p =>
FL p wX wY -> RL p wY wX
invertFL FL (PrimOf p) wZ wR
chosenPrims)
AmendConfig
-> Repository rt p wR wU wR
-> PatchInfoAnd rt p wZ wR
-> FL (PrimOf p) wR wZ
-> IO ()
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT wX wY.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
AmendConfig
-> Repository rt p wR wU wT
-> PatchInfoAnd rt p wX wT
-> FL (PrimOf p) wT wY
-> IO ()
addChangesToPatch AmendConfig
cfg Repository rt p wR wU wR
repository PatchInfoAnd rt p wZ wR
oldp FL (PrimOf p) wR wZ
invPrims
else FL (PrimOf p) wR wU -> IO ()
forall wU1. FL (PrimOf p) wR wU1 -> IO ()
go (FL (PrimOf p) wR wU -> IO ()) -> IO (FL (PrimOf p) wR wU) -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< (UseIndex, ScanKnown, DiffAlgorithm)
-> LookForMoves
-> LookForReplaces
-> Repository rt p wR wU wR
-> Maybe [SubPath]
-> IO (FL (PrimOf p) wR wU)
forall (p :: * -> * -> *) (rt :: RepoType) wR wU wT.
(RepoPatch p, ApplyState p ~ Tree) =>
(UseIndex, ScanKnown, DiffAlgorithm)
-> LookForMoves
-> LookForReplaces
-> Repository rt p wR wU wT
-> Maybe [SubPath]
-> IO (FL (PrimOf p) wT wU)
unrecordedChanges (AmendConfig -> (UseIndex, ScanKnown, DiffAlgorithm)
diffingOpts AmendConfig
cfg)
(LookFor -> LookForMoves
O.moves (AmendConfig -> LookFor
lookfor AmendConfig
cfg)) (LookFor -> LookForReplaces
O.replaces (AmendConfig -> LookFor
lookfor AmendConfig
cfg))
Repository rt p wR wU wR
repository Maybe [SubPath]
files
else if AmendConfig -> Bool
hasEditMetadata AmendConfig
cfg Bool -> Bool -> Bool
&& Maybe [SubPath] -> Bool
forall a. Maybe a -> Bool
isNothing Maybe [SubPath]
files
then FL (PrimOf p) wR wR -> IO ()
forall wU1. FL (PrimOf p) wR wU1 -> IO ()
go FL (PrimOf p) wR wR
forall (a :: * -> * -> *) wX. FL a wX wX
NilFL
else do if AmendConfig -> Bool
hasEditMetadata AmendConfig
cfg
then String -> IO ()
putStrLn "You cannot add new changes to a tag."
else String -> IO ()
putStrLn "You cannot add new changes to a tag, but you are allowed to edit tag's metadata (see darcs help amend)."
FL (PrimOf p) wR wR -> IO ()
forall wU1. FL (PrimOf p) wR wU1 -> IO ()
go FL (PrimOf p) wR wR
forall (a :: * -> * -> *) wX. FL a wX wX
NilFL
addChangesToPatch :: forall rt p wR wU wT wX wY
. (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree)
=> AmendConfig
-> Repository rt p wR wU wT
-> PatchInfoAnd rt p wX wT
-> FL (PrimOf p) wT wY
-> IO ()
addChangesToPatch :: AmendConfig
-> Repository rt p wR wU wT
-> PatchInfoAnd rt p wX wT
-> FL (PrimOf p) wT wY
-> IO ()
addChangesToPatch cfg :: AmendConfig
cfg repository :: Repository rt p wR wU wT
repository oldp :: PatchInfoAnd rt p wX wT
oldp chs :: FL (PrimOf p) wT wY
chs =
let rebaseJobFlags :: RebaseJobFlags
rebaseJobFlags = Compression -> Verbosity -> UpdateWorking -> RebaseJobFlags
RebaseJobFlags (AmendConfig -> Compression
compress AmendConfig
cfg) (AmendConfig -> Verbosity
verbosity AmendConfig
cfg) UpdateWorking
YesUpdateWorking in
if FL (PrimOf p) wT wY -> Bool
forall (a :: * -> * -> *) wX wZ. FL a wX wZ -> Bool
nullFL FL (PrimOf p) wT wY
chs Bool -> Bool -> Bool
&& Bool -> Bool
not (AmendConfig -> Bool
hasEditMetadata AmendConfig
cfg)
then String -> IO ()
putStrLn "You don't want to record anything!"
else do
Repository rt p wR wU wT -> IO ()
forall t. t -> IO ()
invalidateIndex Repository rt p wR wU wT
repository
(repository''' :: Repository rt p wR wU wY
repository''', (mlogf :: Maybe String
mlogf, newp :: PatchInfoAnd rt p wX wY
newp)) <- RebaseJobFlags
-> Repository rt p wR wU wT
-> (Repository rt p wR wU wT
-> IO
(Repository rt p wR wU wY, FL (RebaseFixup p) wY wT,
(Maybe String, PatchInfoAnd rt p wX wY)))
-> IO
(Repository rt p wR wU wY, (Maybe String, PatchInfoAnd rt p wX wY))
forall (rt :: RepoType) (p :: * -> * -> *) x wR wU wT1 wT2.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
RebaseJobFlags
-> Repository rt p wR wU wT1
-> (Repository rt p wR wU wT1
-> IO (Repository rt p wR wU wT2, FL (RebaseFixup p) wT2 wT1, x))
-> IO (Repository rt p wR wU wT2, x)
withManualRebaseUpdate RebaseJobFlags
rebaseJobFlags Repository rt p wR wU wT
repository ((Repository rt p wR wU wT
-> IO
(Repository rt p wR wU wY, FL (RebaseFixup p) wY wT,
(Maybe String, PatchInfoAnd rt p wX wY)))
-> IO
(Repository rt p wR wU wY,
(Maybe String, PatchInfoAnd rt p wX wY)))
-> (Repository rt p wR wU wT
-> IO
(Repository rt p wR wU wY, FL (RebaseFixup p) wY wT,
(Maybe String, PatchInfoAnd rt p wX wY)))
-> IO
(Repository rt p wR wU wY, (Maybe String, PatchInfoAnd rt p wX wY))
forall a b. (a -> b) -> a -> b
$ \repository' :: Repository rt p wR wU wT
repository' -> do
Repository rt p wR wU wX
repository'' <- Repository rt p wR wU wT
-> Compression
-> UpdateWorking
-> FL (PatchInfoAnd rt p) wX wT
-> IO (Repository rt p wR wU wX)
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT wX.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wT
-> Compression
-> UpdateWorking
-> FL (PatchInfoAnd rt p) wX wT
-> IO (Repository rt p wR wU wX)
tentativelyRemovePatches Repository rt p wR wU wT
repository' (AmendConfig -> Compression
compress AmendConfig
cfg) UpdateWorking
YesUpdateWorking (PatchInfoAnd rt p wX wT
oldp PatchInfoAnd rt p wX wT
-> FL (PatchInfoAnd rt p) wT wT -> FL (PatchInfoAnd rt p) wX wT
forall (a :: * -> * -> *) wX wY wZ.
a wX wY -> FL a wY wZ -> FL a wX wZ
:>: FL (PatchInfoAnd rt p) wT wT
forall (a :: * -> * -> *) wX. FL a wX wX
NilFL)
(mlogf :: Maybe String
mlogf, newp :: PatchInfoAnd rt p wX wY
newp) <- HijackOptions
-> HijackT IO (Maybe String, PatchInfoAnd rt p wX wY)
-> IO (Maybe String, PatchInfoAnd rt p wX wY)
forall (m :: * -> *) a.
Monad m =>
HijackOptions -> HijackT m a -> m a
runHijackT HijackOptions
AlwaysRequestHijackPermission (HijackT IO (Maybe String, PatchInfoAnd rt p wX wY)
-> IO (Maybe String, PatchInfoAnd rt p wX wY))
-> HijackT IO (Maybe String, PatchInfoAnd rt p wX wY)
-> IO (Maybe String, PatchInfoAnd rt p wX wY)
forall a b. (a -> b) -> a -> b
$ String
-> AskAboutDeps rt p wR wU wX
-> PatchSelectionOptions
-> DiffAlgorithm
-> Bool
-> Bool
-> Maybe String
-> Maybe String
-> Maybe AskLongComment
-> PatchInfoAnd rt p wX wT
-> FL (PrimOf p) wT wY
-> HijackT IO (Maybe String, PatchInfoAnd rt p wX wY)
forall (rt :: RepoType) (p :: * -> * -> *) wX wY wR wU wT.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
String
-> AskAboutDeps rt p wR wU wT
-> PatchSelectionOptions
-> DiffAlgorithm
-> Bool
-> Bool
-> Maybe String
-> Maybe String
-> Maybe AskLongComment
-> PatchInfoAnd rt p wT wX
-> FL (PrimOf p) wX wY
-> HijackT IO (Maybe String, PatchInfoAnd rt p wT wY)
updatePatchHeader "amend"
(if AmendConfig -> Bool
askDeps AmendConfig
cfg then Repository rt p wR wU wX -> AskAboutDeps rt p wR wU wX
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
Repository rt p wR wU wT -> AskAboutDeps rt p wR wU wT
AskAboutDeps Repository rt p wR wU wX
repository'' else AskAboutDeps rt p wR wU wX
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
AskAboutDeps rt p wR wU wT
NoAskAboutDeps)
(AmendConfig -> PatchSelectionOptions
patchSelOpts AmendConfig
cfg)
(AmendConfig -> DiffAlgorithm
diffAlgorithm AmendConfig
cfg)
(AmendConfig -> Bool
keepDate AmendConfig
cfg)
(AmendConfig -> Bool
selectAuthor AmendConfig
cfg)
(AmendConfig -> Maybe String
author AmendConfig
cfg)
(AmendConfig -> Maybe String
patchname AmendConfig
cfg)
(AmendConfig -> Maybe AskLongComment
askLongComment AmendConfig
cfg)
PatchInfoAnd rt p wX wT
oldp FL (PrimOf p) wT wY
chs
let fixups :: FL (RebaseFixup p) wY wZ
fixups =
(forall wW wY. PrimOf p wW wY -> RebaseFixup p wW wY)
-> FL (PrimOf p) wY wT -> FL (RebaseFixup p) wY wT
forall (a :: * -> * -> *) (b :: * -> * -> *) wX wZ.
(forall wW wY. a wW wY -> b wW wY) -> FL a wX wZ -> FL b wX wZ
mapFL_FL forall wW wY. PrimOf p wW wY -> RebaseFixup p wW wY
forall (p :: * -> * -> *) wX wY.
PrimPatch (PrimOf p) =>
PrimOf p wX wY -> RebaseFixup p wX wY
PrimFixup (FL (PrimOf p) wT wY -> FL (PrimOf p) wY wT
forall (p :: * -> * -> *) wX wY. Invert p => p wX wY -> p wY wX
invert FL (PrimOf p) wT wY
chs) FL (RebaseFixup p) wY wT
-> FL (RebaseFixup p) wT wZ -> FL (RebaseFixup p) wY wZ
forall (a :: * -> * -> *) wX wY wZ.
FL a wX wY -> FL a wY wZ -> FL a wX wZ
+>+
RebaseName p wT wZ -> RebaseFixup p wT wZ
forall (p :: * -> * -> *) wX wY.
RebaseName p wX wY -> RebaseFixup p wX wY
NameFixup (PatchInfo -> PatchInfo -> RebaseName p wT wZ
forall (p :: * -> * -> *) wX wY.
PatchInfo -> PatchInfo -> RebaseName p wX wY
Rename (PatchInfoAnd rt p wX wY -> PatchInfo
forall (rt :: RepoType) (p :: * -> * -> *) wA wB.
PatchInfoAnd rt p wA wB -> PatchInfo
info PatchInfoAnd rt p wX wY
newp) (PatchInfoAnd rt p wX wT -> PatchInfo
forall (rt :: RepoType) (p :: * -> * -> *) wA wB.
PatchInfoAnd rt p wA wB -> PatchInfo
info PatchInfoAnd rt p wX wT
oldp)) RebaseFixup p wT wZ
-> FL (RebaseFixup p) wZ wZ -> FL (RebaseFixup p) wT wZ
forall (a :: * -> * -> *) wX wY wZ.
a wX wY -> FL a wY wZ -> FL a wX wZ
:>:
FL (RebaseFixup p) wZ wZ
forall (a :: * -> * -> *) wX. FL a wX wX
NilFL
PatchInfoAnd rt p wX wY -> IO ()
forall (p :: * -> * -> *) wX wY. PatchInspect p => p wX wY -> IO ()
setEnvDarcsFiles PatchInfoAnd rt p wX wY
newp
Repository rt p wR wU wY
repository''' <- Repository rt p wR wU wX
-> Compression
-> Verbosity
-> UpdateWorking
-> PatchInfoAnd rt p wX wY
-> IO (Repository rt p wR wU wY)
forall (p :: * -> * -> *) (rt :: RepoType) wR wU wT wY.
(RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wT
-> Compression
-> Verbosity
-> UpdateWorking
-> PatchInfoAnd rt p wT wY
-> IO (Repository rt p wR wU wY)
tentativelyAddPatch Repository rt p wR wU wX
repository'' (AmendConfig -> Compression
compress AmendConfig
cfg) (AmendConfig -> Verbosity
verbosity AmendConfig
cfg) UpdateWorking
YesUpdateWorking PatchInfoAnd rt p wX wY
newp
(Repository rt p wR wU wY, FL (RebaseFixup p) wY wT,
(Maybe String, PatchInfoAnd rt p wX wY))
-> IO
(Repository rt p wR wU wY, FL (RebaseFixup p) wY wT,
(Maybe String, PatchInfoAnd rt p wX wY))
forall (m :: * -> *) a. Monad m => a -> m a
return (Repository rt p wR wU wY
repository''', FL (RebaseFixup p) wY wT
forall wZ. FL (RebaseFixup p) wY wZ
fixups, (Maybe String
mlogf, PatchInfoAnd rt p wX wY
newp))
let failmsg :: String
failmsg = String -> (String -> String) -> Maybe String -> String
forall b a. b -> (a -> b) -> Maybe a -> b
maybe "" (\lf :: String
lf -> "\nLogfile left in "String -> String -> String
forall a. [a] -> [a] -> [a]
++String
lfString -> String -> String
forall a. [a] -> [a] -> [a]
++".") Maybe String
mlogf
Repository rt p wR wU wY
-> Verbosity
-> TestChanges
-> SetScriptsExecutable
-> Bool
-> String
-> String
-> Maybe String
-> IO ()
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
Repository rt p wR wU wT
-> Verbosity
-> TestChanges
-> SetScriptsExecutable
-> Bool
-> String
-> String
-> Maybe String
-> IO ()
testTentativeAndMaybeExit Repository rt p wR wU wY
repository''' (AmendConfig -> Verbosity
verbosity AmendConfig
cfg) (AmendConfig -> TestChanges
testChanges AmendConfig
cfg) (AmendConfig -> SetScriptsExecutable
sse AmendConfig
cfg) (AmendConfig -> Bool
isInteractive AmendConfig
cfg)
("you have a bad patch: '" String -> String -> String
forall a. [a] -> [a] -> [a]
++ PatchInfoAnd rt p wX wY -> String
forall (rt :: RepoType) (p :: * -> * -> *) wX wY.
PatchInfoAnd rt p wX wY -> String
patchDesc PatchInfoAnd rt p wX wY
newp String -> String -> String
forall a. [a] -> [a] -> [a]
++ "'") "amend it"
(String -> Maybe String
forall a. a -> Maybe a
Just String
failmsg)
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (LookFor -> LookForMoves
O.moves (AmendConfig -> LookFor
lookfor AmendConfig
cfg) LookForMoves -> LookForMoves -> Bool
forall a. Eq a => a -> a -> Bool
== LookForMoves
O.YesLookForMoves Bool -> Bool -> Bool
|| LookFor -> LookForReplaces
O.replaces (AmendConfig -> LookFor
lookfor AmendConfig
cfg) LookForReplaces -> LookForReplaces -> Bool
forall a. Eq a => a -> a -> Bool
== LookForReplaces
O.YesLookForReplaces)
(IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ Repository rt p wR wU wY
-> UpdateWorking -> PatchInfoAnd rt p wX wT -> IO ()
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT wX wY.
RepoPatch p =>
Repository rt p wR wU wT
-> UpdateWorking -> PatchInfoAnd rt p wX wY -> IO ()
tentativelyRemoveFromPending Repository rt p wR wU wY
repository''' UpdateWorking
YesUpdateWorking PatchInfoAnd rt p wX wT
oldp
Repository rt p wR wU wY -> UpdateWorking -> Compression -> IO ()
forall (rt :: RepoType) (p :: * -> * -> *) wR wU wT.
(IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) =>
Repository rt p wR wU wT -> UpdateWorking -> Compression -> IO ()
finalizeRepositoryChanges Repository rt p wR wU wY
repository''' UpdateWorking
YesUpdateWorking (AmendConfig -> Compression
compress AmendConfig
cfg) IO () -> String -> IO ()
forall a. IO a -> String -> IO a
`clarifyErrors` String
failmsg
String -> IO ()
putStrLn "Finished amending patch:"
Doc -> IO ()
putDocLn (Doc -> IO ()) -> Doc -> IO ()
forall a b. (a -> b) -> a -> b
$ PatchInfoAnd rt p wX wY -> Doc
forall (p :: * -> * -> *) wX wY. ShowPatch p => p wX wY -> Doc
description PatchInfoAnd rt p wX wY
newp
FL (PatchInfoAnd rt p) wX wY -> IO ()
forall (p :: * -> * -> *) (rt :: RepoType) wX wY.
(RepoPatch p, ApplyState p ~ Tree) =>
FL (PatchInfoAnd rt p) wX wY -> IO ()
setEnvDarcsPatches (PatchInfoAnd rt p wX wY
newp PatchInfoAnd rt p wX wY
-> FL (PatchInfoAnd rt p) wY wY -> FL (PatchInfoAnd rt p) wX wY
forall (a :: * -> * -> *) wX wY wZ.
a wX wY -> FL a wY wZ -> FL a wX wZ
:>: FL (PatchInfoAnd rt p) wY wY
forall (a :: * -> * -> *) wX. FL a wX wX
NilFL)
hasEditMetadata :: AmendConfig -> Bool
hasEditMetadata :: AmendConfig -> Bool
hasEditMetadata cfg :: AmendConfig
cfg = Maybe String -> Bool
forall a. Maybe a -> Bool
isJust (AmendConfig -> Maybe String
author AmendConfig
cfg)
Bool -> Bool -> Bool
|| AmendConfig -> Bool
selectAuthor AmendConfig
cfg
Bool -> Bool -> Bool
|| Maybe String -> Bool
forall a. Maybe a -> Bool
isJust (AmendConfig -> Maybe String
patchname AmendConfig
cfg)
Bool -> Bool -> Bool
|| AmendConfig -> Maybe AskLongComment
askLongComment AmendConfig
cfg Maybe AskLongComment -> Maybe AskLongComment -> Bool
forall a. Eq a => a -> a -> Bool
== AskLongComment -> Maybe AskLongComment
forall a. a -> Maybe a
Just AskLongComment
O.YesEditLongComment
Bool -> Bool -> Bool
|| AmendConfig -> Maybe AskLongComment
askLongComment AmendConfig
cfg Maybe AskLongComment -> Maybe AskLongComment -> Bool
forall a. Eq a => a -> a -> Bool
== AskLongComment -> Maybe AskLongComment
forall a. a -> Maybe a
Just AskLongComment
O.PromptLongComment
Bool -> Bool -> Bool
|| AmendConfig -> Bool
askDeps AmendConfig
cfg
patchSelOpts :: AmendConfig -> S.PatchSelectionOptions
patchSelOpts :: AmendConfig -> PatchSelectionOptions
patchSelOpts cfg :: AmendConfig
cfg = PatchSelectionOptions :: Verbosity
-> [MatchFlag]
-> Bool
-> SelectDeps
-> Summary
-> WithContext
-> PatchSelectionOptions
S.PatchSelectionOptions
{ verbosity :: Verbosity
S.verbosity = AmendConfig -> Verbosity
verbosity AmendConfig
cfg
, matchFlags :: [MatchFlag]
S.matchFlags = AmendConfig -> [MatchFlag]
matchFlags AmendConfig
cfg
, interactive :: Bool
S.interactive = AmendConfig -> Bool
isInteractive AmendConfig
cfg
, selectDeps :: SelectDeps
S.selectDeps = SelectDeps
O.PromptDeps
, summary :: Summary
S.summary = Summary
O.NoSummary
, withContext :: WithContext
S.withContext = AmendConfig -> WithContext
withContext AmendConfig
cfg
}
diffingOpts :: AmendConfig -> (O.UseIndex, O.ScanKnown, O.DiffAlgorithm)
diffingOpts :: AmendConfig -> (UseIndex, ScanKnown, DiffAlgorithm)
diffingOpts cfg :: AmendConfig
cfg = UseIndex
-> LookForAdds
-> IncludeBoring
-> DiffAlgorithm
-> (UseIndex, ScanKnown, DiffAlgorithm)
diffOpts (AmendConfig -> UseIndex
useIndex AmendConfig
cfg) (LookFor -> LookForAdds
O.adds (AmendConfig -> LookFor
lookfor AmendConfig
cfg)) IncludeBoring
O.NoIncludeBoring (AmendConfig -> DiffAlgorithm
diffAlgorithm AmendConfig
cfg)
isInteractive :: AmendConfig -> Bool
isInteractive :: AmendConfig -> Bool
isInteractive = Bool -> (Bool -> Bool) -> Maybe Bool -> Bool
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Bool
True Bool -> Bool
forall a. a -> a
id (Maybe Bool -> Bool)
-> (AmendConfig -> Maybe Bool) -> AmendConfig -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. AmendConfig -> Maybe Bool
interactive