make sync update adjusted branch to hide/unhide

This completes initial support for --hide-missing, although the
assistant still needs to be updated and it perhaps needs to be sped up,
and maybe there needs to be a way for git-annex get to operate on
missing files. Opened some more todos for those things.

This commit was sponsored by Henrik Riomar.
This commit is contained in:
Joey Hess 2018-10-20 14:12:04 -04:00
parent 5a39b5a012
commit 4a6ebb1034
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
8 changed files with 77 additions and 25 deletions

View file

@ -19,9 +19,10 @@ module Annex.AdjustedBranch (
fromAdjustedBranch,
getAdjustment,
enterAdjustedBranch,
updateAdjustedBranch,
adjustBranch,
adjustToCrippledFileSystem,
updateAdjustedBranch,
mergeToAdjustedBranch,
propigateAdjustedCommits,
AdjustedClone(..),
checkAdjustedClone,
@ -150,7 +151,7 @@ enterAdjustedBranch :: Adjustment -> Annex Bool
enterAdjustedBranch adj = inRepo Git.Branch.current >>= \case
Just currbranch -> case getAdjustment currbranch of
Just curradj | curradj == adj ->
reenterAdjustedBranch adj currbranch
updateAdjustedBranch adj (AdjBranch currbranch)
(fromAdjustedBranch currbranch)
_ -> go currbranch
Nothing -> do
@ -197,8 +198,8 @@ checkoutAdjustedBranch (AdjBranch b) checkoutparams = do
- deleting and rebuilding the adjusted branch, and then checking it out.
- But, it can be implemented more efficiently than that.
-}
reenterAdjustedBranch :: Adjustment -> Branch -> OrigBranch -> Annex Bool
reenterAdjustedBranch adj@(PresenceAdjustment _ _) currbranch origbranch = do
updateAdjustedBranch :: Adjustment -> AdjBranch -> OrigBranch -> Annex Bool
updateAdjustedBranch adj@(PresenceAdjustment _ _) (AdjBranch currbranch) origbranch = do
b <- preventCommits $ \commitlck -> do
-- Avoid losing any commits that the adjusted branch has that
-- have not yet been propigated back to the origbranch.
@ -319,8 +320,8 @@ findAdjustingCommit (AdjBranch b) = go =<< catCommit b
{- Update the currently checked out adjusted branch, merging the provided
- branch into it. Note that the provided branch should be a non-adjusted
- branch. -}
updateAdjustedBranch :: Branch -> (OrigBranch, Adjustment) -> [Git.Merge.MergeConfig] -> Annex Bool -> Git.Branch.CommitMode -> Annex Bool
updateAdjustedBranch tomerge (origbranch, adj) mergeconfig canresolvemerge commitmode = catchBoolIO $
mergeToAdjustedBranch :: Branch -> (OrigBranch, Adjustment) -> [Git.Merge.MergeConfig] -> Annex Bool -> Git.Branch.CommitMode -> Annex Bool
mergeToAdjustedBranch tomerge (origbranch, adj) mergeconfig canresolvemerge commitmode = catchBoolIO $
join $ preventCommits go
where
adjbranch@(AdjBranch currbranch) = originalToAdjusted origbranch adj