In format_repo_ident(), look for the "repository" annotation if PKG_REPONAME is undefined.  Use this to implement the %R query pattern.
Merge pull request #855 from dag-erling/query-R

Implement the %R query pattern