diff options
author | Joey Hess <joey@kitenet.net> | 2014-03-19 19:10:35 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-03-19 19:10:55 -0400 |
commit | 000155ea54690088b95b10fefa67711c5ab2a7ba (patch) | |
tree | 56e06297e36e1198fe2fce4ffe9c7c024fd2bed8 /Annex | |
parent | 6ed3cabd704f61ffa3e99d4222c8cf71a27526f1 (diff) |
toplevel lastchanged field
Diffstat (limited to 'Annex')
-rw-r--r-- | Annex/MetaData/StandardFields.hs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/Annex/MetaData/StandardFields.hs b/Annex/MetaData/StandardFields.hs index 00b810593..d41fb1506 100644 --- a/Annex/MetaData/StandardFields.hs +++ b/Annex/MetaData/StandardFields.hs @@ -10,6 +10,7 @@ module Annex.MetaData.StandardFields ( yearMetaField, monthMetaField, lastChangedField, + mkLastChangedField, isLastChangedField ) where @@ -26,13 +27,21 @@ yearMetaField = mkMetaFieldUnchecked "year" monthMetaField :: MetaField monthMetaField = mkMetaFieldUnchecked "month" -lastChangedField :: MetaField -> MetaField -lastChangedField f = mkMetaFieldUnchecked (fromMetaField f ++ lastchanged) +lastChangedField :: MetaField +lastChangedField = mkMetaFieldUnchecked lastchanged + +mkLastChangedField :: MetaField -> MetaField +mkLastChangedField f = mkMetaFieldUnchecked (fromMetaField f ++ lastchangedSuffix) isLastChangedField :: MetaField -> Bool -isLastChangedField f = lastchanged `isSuffixOf` s && s /= lastchanged +isLastChangedField f + | f == lastChangedField = True + | otherwise = lastchanged `isSuffixOf` s && s /= lastchangedSuffix where s = fromMetaField f lastchanged :: String -lastchanged = "-lastchanged" +lastchanged = "lastchanged" + +lastchangedSuffix :: String +lastchangedSuffix = "-lastchanged" |