better name for LinkPresentAdjustment

This commit is contained in:
Joey Hess 2024-10-21 15:42:01 -04:00
parent 4c1b3ca6bb
commit 2c14181bcb
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
6 changed files with 18 additions and 18 deletions

View file

@ -11,7 +11,7 @@ module Annex.AdjustedBranch (
Adjustment(..), Adjustment(..),
LinkAdjustment(..), LinkAdjustment(..),
PresenceAdjustment(..), PresenceAdjustment(..),
LinkPresentAdjustment(..), LockUnlockPresentAdjustment(..),
adjustmentHidesFiles, adjustmentHidesFiles,
adjustmentIsStable, adjustmentIsStable,
OrigBranch, OrigBranch,
@ -88,11 +88,11 @@ instance AdjustTreeItem Adjustment where
adjustTreeItem p t >>= \case adjustTreeItem p t >>= \case
Nothing -> return Nothing Nothing -> return Nothing
Just t' -> adjustTreeItem l t' Just t' -> adjustTreeItem l t'
adjustTreeItem (LinkPresentAdjustment l) t = adjustTreeItem l t adjustTreeItem (LockUnlockPresentAdjustment l) t = adjustTreeItem l t
adjustmentIsStable (LinkAdjustment l) = adjustmentIsStable l adjustmentIsStable (LinkAdjustment l) = adjustmentIsStable l
adjustmentIsStable (PresenceAdjustment p _) = adjustmentIsStable p adjustmentIsStable (PresenceAdjustment p _) = adjustmentIsStable p
adjustmentIsStable (LinkPresentAdjustment l) = adjustmentIsStable l adjustmentIsStable (LockUnlockPresentAdjustment l) = adjustmentIsStable l
instance AdjustTreeItem LinkAdjustment where instance AdjustTreeItem LinkAdjustment where
adjustTreeItem UnlockAdjustment = adjustTreeItem UnlockAdjustment =
@ -115,7 +115,7 @@ instance AdjustTreeItem PresenceAdjustment where
adjustmentIsStable HideMissingAdjustment = False adjustmentIsStable HideMissingAdjustment = False
adjustmentIsStable ShowMissingAdjustment = True adjustmentIsStable ShowMissingAdjustment = True
instance AdjustTreeItem LinkPresentAdjustment where instance AdjustTreeItem LockUnlockPresentAdjustment where
adjustTreeItem UnlockPresentAdjustment = adjustTreeItem UnlockPresentAdjustment =
ifPresent adjustToPointer adjustToSymlink ifPresent adjustToPointer adjustToSymlink
adjustTreeItem LockPresentAdjustment = adjustTreeItem LockPresentAdjustment =

View file

@ -37,7 +37,7 @@ instance SerializeAdjustment Adjustment where
serializeAdjustment p serializeAdjustment p
serializeAdjustment (PresenceAdjustment p (Just l)) = serializeAdjustment (PresenceAdjustment p (Just l)) =
serializeAdjustment p <> "-" <> serializeAdjustment l serializeAdjustment p <> "-" <> serializeAdjustment l
serializeAdjustment (LinkPresentAdjustment l) = serializeAdjustment (LockUnlockPresentAdjustment l) =
serializeAdjustment l serializeAdjustment l
deserializeAdjustment s = deserializeAdjustment s =
(LinkAdjustment <$> deserializeAdjustment s) (LinkAdjustment <$> deserializeAdjustment s)
@ -46,7 +46,7 @@ instance SerializeAdjustment Adjustment where
<|> <|>
(PresenceAdjustment <$> deserializeAdjustment s <*> pure Nothing) (PresenceAdjustment <$> deserializeAdjustment s <*> pure Nothing)
<|> <|>
(LinkPresentAdjustment <$> deserializeAdjustment s) (LockUnlockPresentAdjustment <$> deserializeAdjustment s)
where where
(s1, s2) = separate' (== (fromIntegral (ord '-'))) s (s1, s2) = separate' (== (fromIntegral (ord '-'))) s
@ -68,7 +68,7 @@ instance SerializeAdjustment PresenceAdjustment where
deserializeAdjustment "showmissing" = Just ShowMissingAdjustment deserializeAdjustment "showmissing" = Just ShowMissingAdjustment
deserializeAdjustment _ = Nothing deserializeAdjustment _ = Nothing
instance SerializeAdjustment LinkPresentAdjustment where instance SerializeAdjustment LockUnlockPresentAdjustment where
serializeAdjustment UnlockPresentAdjustment = "unlockpresent" serializeAdjustment UnlockPresentAdjustment = "unlockpresent"
serializeAdjustment LockPresentAdjustment = "lockpresent" serializeAdjustment LockPresentAdjustment = "lockpresent"
deserializeAdjustment "unlockpresent" = Just UnlockPresentAdjustment deserializeAdjustment "unlockpresent" = Just UnlockPresentAdjustment

View file

@ -359,8 +359,8 @@ addUnlocked matcher mi contentpresent =
go (LinkAdjustment UnFixAdjustment) = False go (LinkAdjustment UnFixAdjustment) = False
go (PresenceAdjustment _ (Just la)) = go (LinkAdjustment la) go (PresenceAdjustment _ (Just la)) = go (LinkAdjustment la)
go (PresenceAdjustment _ Nothing) = False go (PresenceAdjustment _ Nothing) = False
go (LinkPresentAdjustment UnlockPresentAdjustment) = contentpresent go (LockUnlockPresentAdjustment UnlockPresentAdjustment) = contentpresent
go (LinkPresentAdjustment LockPresentAdjustment) = False go (LockUnlockPresentAdjustment LockPresentAdjustment) = False
{- Adds a file to the work tree for the key, and stages it in the index. {- Adds a file to the work tree for the key, and stages it in the index.
- The content of the key may be provided in a temp file, which will be - The content of the key may be provided in a temp file, which will be

View file

@ -513,7 +513,7 @@ applyView'' mkviewedfile getfilemetadata view madj l clean conv = do
Nothing -> stagesymlink uh f k Nothing -> stagesymlink uh f k
Just (LinkAdjustment UnlockAdjustment) -> Just (LinkAdjustment UnlockAdjustment) ->
stagepointerfile uh f k mtreeitemtype stagepointerfile uh f k mtreeitemtype
Just (LinkPresentAdjustment UnlockPresentAdjustment) -> Just (LockUnlockPresentAdjustment UnlockPresentAdjustment) ->
ifM (inAnnex k) ifM (inAnnex k)
( stagepointerfile uh f k mtreeitemtype ( stagepointerfile uh f k mtreeitemtype
, stagesymlink uh f k , stagesymlink uh f k

View file

@ -19,7 +19,7 @@ optParser :: CmdParamsDesc -> Parser Adjustment
optParser _ = optParser _ =
(LinkAdjustment <$> linkAdjustmentParser) (LinkAdjustment <$> linkAdjustmentParser)
<|> (PresenceAdjustment <$> presenceAdjustmentParser <*> maybeLinkAdjustmentParser) <|> (PresenceAdjustment <$> presenceAdjustmentParser <*> maybeLinkAdjustmentParser)
<|> (LinkPresentAdjustment <$> linkPresentAdjustmentParser) <|> (LockUnlockPresentAdjustment <$> lockUnlockPresentAdjustmentParser)
linkAdjustmentParser :: Parser LinkAdjustment linkAdjustmentParser :: Parser LinkAdjustment
linkAdjustmentParser = linkAdjustmentParser =
@ -46,8 +46,8 @@ presenceAdjustmentParser =
<> help "hide annexed files whose content is not present" <> help "hide annexed files whose content is not present"
) )
linkPresentAdjustmentParser :: Parser LinkPresentAdjustment lockUnlockPresentAdjustmentParser :: Parser LockUnlockPresentAdjustment
linkPresentAdjustmentParser = lockUnlockPresentAdjustmentParser =
flag' UnlockPresentAdjustment flag' UnlockPresentAdjustment
( long "unlock-present" ( long "unlock-present"
<> help "unlock files whose content is present; lock rest" <> help "unlock files whose content is present; lock rest"

View file

@ -10,7 +10,7 @@ module Types.AdjustedBranch where
data Adjustment data Adjustment
= LinkAdjustment LinkAdjustment = LinkAdjustment LinkAdjustment
| PresenceAdjustment PresenceAdjustment (Maybe LinkAdjustment) | PresenceAdjustment PresenceAdjustment (Maybe LinkAdjustment)
| LinkPresentAdjustment LinkPresentAdjustment | LockUnlockPresentAdjustment LockUnlockPresentAdjustment
deriving (Show, Eq) deriving (Show, Eq)
data LinkAdjustment data LinkAdjustment
@ -25,7 +25,7 @@ data PresenceAdjustment
| ShowMissingAdjustment | ShowMissingAdjustment
deriving (Show, Eq) deriving (Show, Eq)
data LinkPresentAdjustment data LockUnlockPresentAdjustment
= UnlockPresentAdjustment = UnlockPresentAdjustment
| LockPresentAdjustment | LockPresentAdjustment
deriving (Show, Eq) deriving (Show, Eq)
@ -41,8 +41,8 @@ instance ReversableAdjustment Adjustment where
LinkAdjustment (reverseAdjustment l) LinkAdjustment (reverseAdjustment l)
reverseAdjustment (PresenceAdjustment p ml) = reverseAdjustment (PresenceAdjustment p ml) =
PresenceAdjustment (reverseAdjustment p) (fmap reverseAdjustment ml) PresenceAdjustment (reverseAdjustment p) (fmap reverseAdjustment ml)
reverseAdjustment (LinkPresentAdjustment l) = reverseAdjustment (LockUnlockPresentAdjustment l) =
LinkPresentAdjustment (reverseAdjustment l) LockUnlockPresentAdjustment (reverseAdjustment l)
instance ReversableAdjustment LinkAdjustment where instance ReversableAdjustment LinkAdjustment where
reverseAdjustment UnlockAdjustment = LockAdjustment reverseAdjustment UnlockAdjustment = LockAdjustment
@ -55,7 +55,7 @@ instance ReversableAdjustment PresenceAdjustment where
reverseAdjustment HideMissingAdjustment = ShowMissingAdjustment reverseAdjustment HideMissingAdjustment = ShowMissingAdjustment
reverseAdjustment ShowMissingAdjustment = HideMissingAdjustment reverseAdjustment ShowMissingAdjustment = HideMissingAdjustment
instance ReversableAdjustment LinkPresentAdjustment where instance ReversableAdjustment LockUnlockPresentAdjustment where
reverseAdjustment UnlockPresentAdjustment = LockPresentAdjustment reverseAdjustment UnlockPresentAdjustment = LockPresentAdjustment
reverseAdjustment LockPresentAdjustment = UnlockPresentAdjustment reverseAdjustment LockPresentAdjustment = UnlockPresentAdjustment