aboutsummaryrefslogtreecommitdiff
path: root/Logs/View.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-03-02 14:53:19 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-03-02 14:53:19 -0400
commitd6744f85d3ad9b924eeee47148d34bec6992b5eb (patch)
treee2e6bd867580e8850a7fbab6df2df18eb12ccf7d /Logs/View.hs
parentbe4e7d409c851eb1f0e65da98f93331c5ba8c1b7 (diff)
view, vfilter: Add support for filtering tags and values out of a view, using !tag and field!=value.
Note that negated globs are not supported. Would have complicated the code to add them, without changing the data type serialization in a non-backwards-compatable way. This commit was sponsored by Denver Gingerich.
Diffstat (limited to 'Logs/View.hs')
-rw-r--r--Logs/View.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/Logs/View.hs b/Logs/View.hs
index 63590d5e9..79c2556b3 100644
--- a/Logs/View.hs
+++ b/Logs/View.hs
@@ -75,12 +75,14 @@ branchView view
| otherwise = "(" ++ branchcomp' c ++ ")"
branchcomp' (ViewComponent metafield viewfilter _) =concat
[ forcelegal (fromMetaField metafield)
- , "="
, branchvals viewfilter
]
- branchvals (FilterValues set) = intercalate "," $
- map (forcelegal . fromMetaValue) $ S.toList set
- branchvals (FilterGlob glob) = forcelegal glob
+ branchvals (FilterValues set) = '=' : branchset set
+ branchvals (FilterGlob glob) = '=' : forcelegal glob
+ branchvals (ExcludeValues set) = "!=" ++ branchset set
+ branchset = intercalate ","
+ . map (forcelegal . fromMetaValue)
+ . S.toList
forcelegal s
| Git.Ref.legal True s = s
| otherwise = map (\c -> if isAlphaNum c then c else '_') s