diff options
author | Joey Hess <joey@kitenet.net> | 2014-02-06 12:43:56 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-02-06 12:43:56 -0400 |
commit | ebb16a8c45f5ec12aff6fd158090d6a36d5590dc (patch) | |
tree | df6630b4844709e8266f330a875857d395c03454 /Logs/Presence.hs | |
parent | d6a25390ad9006d3c8eeeefd535703626dd09490 (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 'Logs/Presence.hs')
-rw-r--r-- | Logs/Presence.hs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/Logs/Presence.hs b/Logs/Presence.hs index 516d59618..7545f5afc 100644 --- a/Logs/Presence.hs +++ b/Logs/Presence.hs @@ -6,7 +6,7 @@ - A line of the log will look like: "date N INFO" - Where N=1 when the INFO is present, and 0 otherwise. - - - Copyright 2010-2011 Joey Hess <joey@kitenet.net> + - Copyright 2010-2014 Joey Hess <joey@kitenet.net> - - Licensed under the GNU GPL version 3 or higher. -} @@ -16,7 +16,8 @@ module Logs.Presence ( addLog, readLog, logNow, - currentLog + currentLog, + historicalLog ) where import Data.Time.Clock.POSIX @@ -24,6 +25,7 @@ import Data.Time.Clock.POSIX import Logs.Presence.Pure as X import Common.Annex import qualified Annex.Branch +import Git.Types (RefDate) addLog :: FilePath -> LogLine -> Annex () addLog file line = Annex.Branch.change file $ \s -> @@ -43,3 +45,12 @@ logNow s i = do {- Reads a log and returns only the info that is still in effect. -} currentLog :: FilePath -> Annex [String] currentLog file = map info . filterPresent <$> readLog file + +{- Reads a historical version of a log and returns the info that was in + - effect at that time. + - + - The date is formatted as shown in gitrevisions man page. + -} +historicalLog :: RefDate -> FilePath -> Annex [String] +historicalLog refdate file = map info . filterPresent . parseLog + <$> Annex.Branch.getHistorical refdate file |