Mercurial > public > mercurial-scm > hg-stable
diff mercurial/obsolete.py @ 32749:c8177792fef6
obsolete: move obsstore creation logic from localrepo
This code has more to do with obsolete.py than localrepo.py. Let's
move it there.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 08 Jun 2017 21:54:30 -0700 |
parents | 9576974a3b6d |
children | 5ffb138d7b1a |
line wrap: on
line diff
--- a/mercurial/obsolete.py Thu Jun 08 22:18:17 2017 -0700 +++ b/mercurial/obsolete.py Thu Jun 08 21:54:30 2017 -0700 @@ -753,6 +753,22 @@ seennodes |= pendingnodes return seenmarkers +def makestore(ui, repo): + """Create an obsstore instance from a repo.""" + # read default format for new obsstore. + # developer config: format.obsstore-version + defaultformat = ui.configint('format', 'obsstore-version', None) + # rely on obsstore class default when possible. + kwargs = {} + if defaultformat is not None: + kwargs['defaultformat'] = defaultformat + readonly = not isenabled(repo, createmarkersopt) + store = obsstore(repo.svfs, readonly=readonly, **kwargs) + if store and readonly: + ui.warn(_('obsolete feature not enabled but %i markers found!\n') + % len(list(store))) + return store + def _filterprunes(markers): """return a set with no prune markers""" return set(m for m in markers if m[1])