From a757a9136683147a942f384b304b9a3326321171 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 25 Oct 2017 15:11:12 -0400 Subject: Add day to metadata when annex.genmetadata is enabled. Thanks, Sean T Parsons --- Annex/MetaData.hs | 3 ++- Annex/MetaData/StandardFields.hs | 4 ++++ CHANGELOG | 2 ++ doc/bugs/Add_day_to_metadata..mdwn | 2 ++ doc/git-annex.mdwn | 2 +- 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Annex/MetaData.hs b/Annex/MetaData.hs index e22ed05a6..355c5124a 100644 --- a/Annex/MetaData.hs +++ b/Annex/MetaData.hs @@ -60,10 +60,11 @@ dateMetaData :: UTCTime -> MetaData -> MetaData dateMetaData mtime old = MetaData $ M.fromList $ filter isnew [ (yearMetaField, S.singleton $ toMetaValue $ show y) , (monthMetaField, S.singleton $ toMetaValue $ show m) + , (dayMetaField, S.singleton $ toMetaValue $ show d) ] where isnew (f, _) = S.null (currentMetaDataValues f old) - (y, m, _d) = toGregorian $ utctDay mtime + (y, m, d) = toGregorian $ utctDay mtime {- Parses field=value, field+=value, field-=value, field?=value -} parseModMeta :: String -> Either String ModMeta diff --git a/Annex/MetaData/StandardFields.hs b/Annex/MetaData/StandardFields.hs index c91b53930..b9ea47e2f 100644 --- a/Annex/MetaData/StandardFields.hs +++ b/Annex/MetaData/StandardFields.hs @@ -9,6 +9,7 @@ module Annex.MetaData.StandardFields ( tagMetaField, yearMetaField, monthMetaField, + dayMetaField, lastChangedField, mkLastChangedField, isLastChangedField @@ -27,6 +28,9 @@ yearMetaField = mkMetaFieldUnchecked "year" monthMetaField :: MetaField monthMetaField = mkMetaFieldUnchecked "month" +dayMetaField :: MetaField +dayMetaField = mkMetaFieldUnchecked "day" + lastChangedField :: MetaField lastChangedField = mkMetaFieldUnchecked lastchanged diff --git a/CHANGELOG b/CHANGELOG index f02e82642..bb6189604 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -7,6 +7,8 @@ git-annex (6.20171019) UNRELEASED; urgency=medium instead. * stack.yaml: Added nix packages section. Thanks, Sean T Parsons + * Add day to metadata when annex.genmetadata is enabled. + Thanks, Sean T Parsons -- Joey Hess Tue, 24 Oct 2017 13:12:52 -0400 diff --git a/doc/bugs/Add_day_to_metadata..mdwn b/doc/bugs/Add_day_to_metadata..mdwn index f92a2a11f..24188a4bc 100644 --- a/doc/bugs/Add_day_to_metadata..mdwn +++ b/doc/bugs/Add_day_to_metadata..mdwn @@ -11,3 +11,5 @@ There's also a tiny bit extra for stack.yaml which will only affect people who h ### Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders) git-annex is awesome, I lean on it heavily nearly every single day. + +> [[merged|done]]. Thanks for the patch! --[[Joey]] diff --git a/doc/git-annex.mdwn b/doc/git-annex.mdwn index 1e8155988..c3aa8b991 100644 --- a/doc/git-annex.mdwn +++ b/doc/git-annex.mdwn @@ -911,7 +911,7 @@ Here are all the supported configuration settings. Set this to `true` to make git-annex automatically generate some metadata when adding files to the repository. - In particular, it stores year and month metadata, from the file's + In particular, it stores year, month, and day metadata, from the file's modification date. When importfeed is used, it stores additional metadata from the feed, -- cgit v1.2.3