repository: introduce a convenience config snapshot method

Accessing the repository's config and immediately taking a snapshot of
it is a common operation, so let's provide a convenience function for
it.