summaryrefslogtreecommitdiff
path: root/Limit.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-02-06 12:43:56 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-02-06 12:43:56 -0400
commitebb16a8c45f5ec12aff6fd158090d6a36d5590dc (patch)
treedf6630b4844709e8266f330a875857d395c03454 /Limit.hs
parentd6a25390ad9006d3c8eeeefd535703626dd09490 (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 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