From e8eacf96d5bf1fdef22253c2956838dfef39d425 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 25 Oct 2017 15:11:12 -0400 Subject: [PATCH] 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 e22ed05a60..355c5124af 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 c91b539302..b9ea47e2f6 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 f02e826429..bb61896048 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 f92a2a11f4..24188a4bcb 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 1e81559886..c3aa8b9912 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,