views: add automatically constructed file location metadata
When constructing views, metadata is available about the location of the file in the view's reference branch. Allows incorporating parts of the directory hierarchy in a view. For example `git annex view tag=* podcasts/=*` makes a view in the form tag/showname. Performance impact: I benchmarked git annex view tag=* in the conference proceedings repo to take 6.459s before this change, and 6.544s after. FWIW, I considered making the syntax for this be podcasts/*, which might be easier for the user to learn. However, I think it's not as good: * The user has to then juggle two different syntaxes, and podcasts/* will be expanded by the shell so they also need to quote it, while podcasts/=* is unlikely to be expanded by the shell. * It would allow for things like podcasts/*/* and *.mp3 which do not map well into views. This commit was sponsored by Aurélien Pinceaux.
This commit is contained in:
parent
73a5245502
commit
079b35a1a8
8 changed files with 89 additions and 25 deletions
|
@ -70,7 +70,7 @@ metadata is derived, at least year=yyyy and probably also month, etc.
|
|||
|
||||
### directory hierarchy metadata
|
||||
|
||||
TODO From the original filename used in the master branch, when
|
||||
From the original filename used in the master branch, when
|
||||
constructing a view, generate fields. For example foo/bar/baz.mp3
|
||||
would get /=foo, foo/=bar, foo/bar/=baz, and .=mp3.
|
||||
|
||||
|
@ -82,11 +82,12 @@ This allows using whatever directory hierarchy exists to inform the view,
|
|||
without locking the view into using it.
|
||||
|
||||
Complication: When refining a view, it only looks at the filenames in
|
||||
the view, so it would need to map from
|
||||
the view, so it has to map from
|
||||
those filenames to derive the same metadata, unless there is persistent
|
||||
storage. Luckily, the filenames used in the views currently include the
|
||||
subdirs (although not quite in a parseable format, would need some small
|
||||
changes).
|
||||
subdirs.
|
||||
|
||||
**done**!
|
||||
|
||||
# other uses for metadata
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue