recompute: display one of the changed files
This commit is contained in:
parent
b01a0d2323
commit
89bfeada87
2 changed files with 21 additions and 14 deletions
|
@ -79,18 +79,22 @@ start' o r si file key =
|
||||||
Remote.Compute.getComputeState
|
Remote.Compute.getComputeState
|
||||||
(Remote.remoteStateHandle r) key >>= \case
|
(Remote.remoteStateHandle r) key >>= \case
|
||||||
Nothing -> stop
|
Nothing -> stop
|
||||||
Just state ->
|
Just state -> shouldrecompute state >>= \case
|
||||||
stopUnless (shouldrecompute state) $
|
Nothing -> stop
|
||||||
starting "recompute" ai si $
|
Just mreason -> starting "recompute" ai si $ do
|
||||||
|
maybe noop showNote mreason
|
||||||
perform o r file key state
|
perform o r file key state
|
||||||
where
|
where
|
||||||
ai = mkActionItem (key, file)
|
ai = mkActionItem (key, file)
|
||||||
|
|
||||||
shouldrecompute state
|
shouldrecompute state
|
||||||
| originalOption o = return True
|
| originalOption o = return (Just Nothing)
|
||||||
| otherwise =
|
| otherwise = firstM (inputchanged state)
|
||||||
anyM (inputchanged state) $
|
(M.toList (Remote.Compute.computeInputs state))
|
||||||
M.toList (Remote.Compute.computeInputs state)
|
>>= return . \case
|
||||||
|
Nothing -> Nothing
|
||||||
|
Just (inputfile, _) -> Just $ Just $
|
||||||
|
QuotedPath inputfile <> " changed"
|
||||||
|
|
||||||
inputchanged state (inputfile, inputkey) = do
|
inputchanged state (inputfile, inputkey) = do
|
||||||
-- Note that the paths from the remote state are not to be
|
-- Note that the paths from the remote state are not to be
|
||||||
|
@ -109,10 +113,12 @@ start' o r si file key =
|
||||||
Just (sha, _, _) -> sha /= inputgitsha
|
Just (sha, _, _) -> sha /= inputgitsha
|
||||||
Nothing -> inputfilemissing
|
Nothing -> inputfilemissing
|
||||||
Nothing -> return inputfilemissing
|
Nothing -> return inputfilemissing
|
||||||
|
where
|
||||||
-- When an input file is missing, go ahead and recompute. This way,
|
-- When an input file is missing, go ahead and recompute.
|
||||||
-- the user will see the computation fail, with an error message that
|
-- This way, the user will see the computation fail,
|
||||||
-- explains the problem.
|
-- with an error message that explains the problem.
|
||||||
|
-- Or, if the input file is only optionally used by the
|
||||||
|
-- computation, it might succeed.
|
||||||
inputfilemissing = True
|
inputfilemissing = True
|
||||||
|
|
||||||
perform :: RecomputeOptions -> Remote -> OsPath -> Key -> Remote.Compute.ComputeState -> CommandPerform
|
perform :: RecomputeOptions -> Remote -> OsPath -> Key -> Remote.Compute.ComputeState -> CommandPerform
|
||||||
|
|
|
@ -15,7 +15,8 @@ By default, this only recomputes files whose input files have changed.
|
||||||
The new contents of the input files are used to re-run the computation.
|
The new contents of the input files are used to re-run the computation.
|
||||||
|
|
||||||
When the output of the computation is different, the computed file is
|
When the output of the computation is different, the computed file is
|
||||||
updated with the new content.
|
updated with the new content. The updated file is written to the worktree,
|
||||||
|
but is not staged, in order to avoid overwriting any staged changes.
|
||||||
|
|
||||||
# OPTIONS
|
# OPTIONS
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue