Fix tags when using JDBCHistoryCache.

Since the list of tags is already cached in the Repository instance,
stop duplicating that information in the database. Instead, get that
information from the Repository instance when retrieving history from
the cache.

Add a test case to verify that tags now work with JDBCHistoryCache.

Also fix a bug in the hg log template (MercurialRepository.DIR_TEMPLATE),
revealed by the added test case: A missing space in the template makes
the last modified file and the first copied file appear as a single
token (such as abc.txtdef.txt instead of abc.txt and def.txt) and causes
inconsistencies in the history.