summaryrefslogtreecommitdiff
path: root/Limit.hs
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2014-02-06 12:43:56 -0400
committerJoey Hess <joey@kitenet.net>2014-02-06 12:43:56 -0400
commita44e01c29cd1306dae29e126042d7a0ec8023a1b (patch)
treee6a9e546d1e95eb60336e881cd4466233ec25739 /Limit.hs
parente86db3d2ab6938869037c904526b466155988bc6 (diff)
--in can now refer to files that were located in a repository at some past date. For example, --in="here@{yesterday}"
Diffstat (limited to 'Limit.hs')
-rw-r--r--Limit.hs24
1 files changed, 16 insertions, 8 deletions
diff --git a/Limit.hs b/Limit.hs
index bc1705beae..6f41016330 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