From 5f497fe9e20cc414113f46b5b97a88e4cb77aef9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Fri, 30 Oct 2026 20:05:36 +0100 Subject: Last tag selection based on creation time --- src/Expression.hs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/Expression.hs') diff --git a/src/Expression.hs b/src/Expression.hs index 994912e..bf35f2a 100644 --- a/src/Expression.hs +++ b/src/Expression.hs @@ -31,6 +31,7 @@ import Data.Maybe import Data.Proxy import Data.Text (Text) import Data.Text qualified as T +import Data.Time.LocalTime import Data.Void import Text.Megaparsec @@ -277,6 +278,9 @@ parseRangeExpression = bimap errorBundlePretty id . runParser parser "" "highesttag" -> do pat <- parseTagPattern return $ SingleRevisionExpression $ StaticRef $ TagRef pat higherTag + "lasttag" -> do + pat <- parseTagPattern + return $ SingleRevisionExpression $ StaticRef $ TagRef pat laterTag _ -> unexpected $ Tokens $ NE.fromList $ chunkToTokens @Text Proxy tok , do @@ -306,3 +310,8 @@ higherTag t t' = Left $ read @Integer $ T.unpack s | otherwise = Right s + +laterTag :: Tag a -> Tag a -> Tag a +laterTag t t' + | zonedTimeToUTC (tagTime t) < zonedTimeToUTC (tagTime t') = t' + | otherwise = t -- cgit v1.2.3