diff options
author | Joey Hess <joey@kitenet.net> | 2014-02-22 18:16:28 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-02-22 18:16:28 -0400 |
commit | e0ae2f6bba897367ae23bfb1a6584ebd4843452e (patch) | |
tree | d20ab29f19cd123b00caaced95fe989e108ee6ac /Annex/View.hs | |
parent | 71bd7a787166087a1a0bb8372027dd8cf94d0a2e (diff) |
exclude derived metadata when extracting metadata from a viewed file
Diffstat (limited to 'Annex/View.hs')
-rw-r--r-- | Annex/View.hs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Annex/View.hs b/Annex/View.hs index ece5d099e..69d064753 100644 --- a/Annex/View.hs +++ b/Annex/View.hs @@ -211,14 +211,19 @@ pathProduct (l:ls) = foldl combinel l ls combinel xs ys = [combine x y | x <- xs, y <- ys] {- Extracts the metadata from a ViewedFile, based on the view that was used - - to construct it. -} + - to construct it. + - + - Derived metadata is excluded. + -} fromView :: View -> ViewedFile -> MetaData -fromView view f = foldr (uncurry updateMetaData) newMetaData (zip fields values) +fromView view f = MetaData $ + M.fromList (zip fields values) `M.difference` derived where visible = filter viewVisible (viewComponents view) fields = map viewField visible - paths = splitDirectories $ dropFileName f - values = map fromViewPath paths + paths = splitDirectories (dropFileName f) + values = map (S.singleton . fromViewPath) paths + MetaData derived = getViewedFileMetaData f {- Constructing a view that will match arbitrary metadata, and applying - it to a file yields a set of ViewedFile which all contain the same |