From ebb16a8c45f5ec12aff6fd158090d6a36d5590dc Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 6 Feb 2014 12:43:56 -0400 Subject: --in can now refer to files that were located in a repository at some past date. For example, --in="here@{yesterday}" --- Limit.hs | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'Limit.hs') diff --git a/Limit.hs b/Limit.hs index bc1705bea..6f4101633 100644 --- a/Limit.hs +++ b/Limit.hs @@ -30,6 +30,8 @@ import Types.FileMatcher import Types.Limit import Logs.Group import Logs.Unused +import Logs.Location +import Git.Types (RefDate(..)) import Utility.HumanTime import Utility.DataUnits @@ -112,20 +114,26 @@ matchglob glob (MatchingFile fi) = matchglob _ (MatchingKey _) = False {- Adds a limit to skip files not believed to be present - - in a specfied repository. -} + - in a specfied repository. Optionally on a prior date. -} addIn :: String -> Annex () addIn = addLimit . limitIn limitIn :: MkLimit -limitIn name = Right $ \notpresent -> checkKey $ +limitIn s = Right $ \notpresent -> checkKey $ \key -> if name == "." - then inhere notpresent - else inremote notpresent + then if null date + then inhere notpresent key + else inuuid notpresent key =<< getUUID + else inuuid notpresent key =<< Remote.nameToUUID name where - inremote notpresent key = do - u <- Remote.nameToUUID name - us <- Remote.keyLocations key - return $ u `elem` us && u `S.notMember` notpresent + (name, date) = separate (== '@') s + inuuid notpresent key u + | null date = do + us <- Remote.keyLocations key + return $ u `elem` us && u `S.notMember` notpresent + | otherwise = do + us <- loggedLocationsHistorical (RefDate date) key + return $ u `elem` us inhere notpresent key | S.null notpresent = inAnnex key | otherwise = do -- cgit v1.2.3