rename to --unlock-present and better reverse adjusting

An --unlock-present branch reverses back to a branch where
all files that get modified or renamed become locked, even if they were
originally unlocked. This is the same that reversing a --unlock branch
works, and the new name makes that commonality more clear.
This commit is contained in:
Joey Hess 2020-11-13 14:32:06 -04:00
parent 3899e216af
commit e66b7d2e1b
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
6 changed files with 42 additions and 37 deletions

View file

@ -10,7 +10,7 @@ module Types.AdjustedBranch where
data Adjustment
= LinkAdjustment LinkAdjustment
| PresenceAdjustment PresenceAdjustment (Maybe LinkAdjustment)
| LinkMissingAdjustment LinkMissingAdjustment
| LinkPresentAdjustment LinkPresentAdjustment
deriving (Show, Eq)
data LinkAdjustment
@ -25,9 +25,9 @@ data PresenceAdjustment
| ShowMissingAdjustment
deriving (Show, Eq)
data LinkMissingAdjustment
= LockMissingAdjustment
| UnlockMissingAdjustment
data LinkPresentAdjustment
= UnlockPresentAdjustment
| LockPresentAdjustment
deriving (Show, Eq)
-- Adjustments have to be able to be reversed, so that commits made to the
@ -41,8 +41,8 @@ instance ReversableAdjustment Adjustment where
LinkAdjustment (reverseAdjustment l)
reverseAdjustment (PresenceAdjustment p ml) =
PresenceAdjustment (reverseAdjustment p) (fmap reverseAdjustment ml)
reverseAdjustment (LinkMissingAdjustment l) =
LinkMissingAdjustment (reverseAdjustment l)
reverseAdjustment (LinkPresentAdjustment l) =
LinkPresentAdjustment (reverseAdjustment l)
instance ReversableAdjustment LinkAdjustment where
reverseAdjustment UnlockAdjustment = LockAdjustment
@ -55,9 +55,9 @@ instance ReversableAdjustment PresenceAdjustment where
reverseAdjustment HideMissingAdjustment = ShowMissingAdjustment
reverseAdjustment ShowMissingAdjustment = HideMissingAdjustment
instance ReversableAdjustment LinkMissingAdjustment where
reverseAdjustment LockMissingAdjustment = UnlockMissingAdjustment
reverseAdjustment UnlockMissingAdjustment = LockMissingAdjustment
instance ReversableAdjustment LinkPresentAdjustment where
reverseAdjustment UnlockPresentAdjustment = LockPresentAdjustment
reverseAdjustment LockPresentAdjustment = UnlockPresentAdjustment
adjustmentHidesFiles :: Adjustment -> Bool
adjustmentHidesFiles (PresenceAdjustment HideMissingAdjustment _) = True