Add day to metadata when annex.genmetadata is enabled.

Thanks, Sean T Parsons
This commit is contained in:
Joey Hess 2017-10-25 15:11:12 -04:00
parent 64f1c09526
commit e8eacf96d5
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 11 additions and 2 deletions

View file

@ -60,10 +60,11 @@ dateMetaData :: UTCTime -> MetaData -> MetaData
dateMetaData mtime old = MetaData $ M.fromList $ filter isnew dateMetaData mtime old = MetaData $ M.fromList $ filter isnew
[ (yearMetaField, S.singleton $ toMetaValue $ show y) [ (yearMetaField, S.singleton $ toMetaValue $ show y)
, (monthMetaField, S.singleton $ toMetaValue $ show m) , (monthMetaField, S.singleton $ toMetaValue $ show m)
, (dayMetaField, S.singleton $ toMetaValue $ show d)
] ]
where where
isnew (f, _) = S.null (currentMetaDataValues f old) 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 -} {- Parses field=value, field+=value, field-=value, field?=value -}
parseModMeta :: String -> Either String ModMeta parseModMeta :: String -> Either String ModMeta

View file

@ -9,6 +9,7 @@ module Annex.MetaData.StandardFields (
tagMetaField, tagMetaField,
yearMetaField, yearMetaField,
monthMetaField, monthMetaField,
dayMetaField,
lastChangedField, lastChangedField,
mkLastChangedField, mkLastChangedField,
isLastChangedField isLastChangedField
@ -27,6 +28,9 @@ yearMetaField = mkMetaFieldUnchecked "year"
monthMetaField :: MetaField monthMetaField :: MetaField
monthMetaField = mkMetaFieldUnchecked "month" monthMetaField = mkMetaFieldUnchecked "month"
dayMetaField :: MetaField
dayMetaField = mkMetaFieldUnchecked "day"
lastChangedField :: MetaField lastChangedField :: MetaField
lastChangedField = mkMetaFieldUnchecked lastchanged lastChangedField = mkMetaFieldUnchecked lastchanged

View file

@ -7,6 +7,8 @@ git-annex (6.20171019) UNRELEASED; urgency=medium
instead. instead.
* stack.yaml: Added nix packages section. * stack.yaml: Added nix packages section.
Thanks, Sean T Parsons Thanks, Sean T Parsons
* Add day to metadata when annex.genmetadata is enabled.
Thanks, Sean T Parsons
-- Joey Hess <id@joeyh.name> Tue, 24 Oct 2017 13:12:52 -0400 -- Joey Hess <id@joeyh.name> Tue, 24 Oct 2017 13:12:52 -0400

View file

@ -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) ### 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. git-annex is awesome, I lean on it heavily nearly every single day.
> [[merged|done]]. Thanks for the patch! --[[Joey]]

View file

@ -911,7 +911,7 @@ Here are all the supported configuration settings.
Set this to `true` to make git-annex automatically generate some metadata Set this to `true` to make git-annex automatically generate some metadata
when adding files to the repository. 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. modification date.
When importfeed is used, it stores additional metadata from the feed, When importfeed is used, it stores additional metadata from the feed,