Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 22950:bb8278b289ee
obsolete: add readonly flag to obstore constructor
Previously, obstore read the obsolete._enabled flag to determine whether to
allow writes to the obstore. Since obsolete._enabled will be moving into a repo
specific config, we can't read it globally, and therefore must pass the
information into the constructor.
author | Durham Goode <durham@fb.com> |
---|---|
date | Tue, 14 Oct 2014 13:20:31 -0700 |
parents | c136e26953aa |
children | 6c86c673dde6 |
comparison
equal
deleted
inserted
replaced
22949:714f6ef43f3a | 22950:bb8278b289ee |
---|---|
404 defaultformat = self.ui.configint('format', 'obsstore-version', None) | 404 defaultformat = self.ui.configint('format', 'obsstore-version', None) |
405 # rely on obsstore class default when possible. | 405 # rely on obsstore class default when possible. |
406 kwargs = {} | 406 kwargs = {} |
407 if defaultformat is not None: | 407 if defaultformat is not None: |
408 kwargs['defaultformat'] = defaultformat | 408 kwargs['defaultformat'] = defaultformat |
409 store = obsolete.obsstore(self.sopener, **kwargs) | 409 store = obsolete.obsstore(self.sopener, readonly=not obsolete._enabled, |
410 **kwargs) | |
410 if store and not obsolete._enabled: | 411 if store and not obsolete._enabled: |
411 # message is rare enough to not be translated | 412 # message is rare enough to not be translated |
412 msg = 'obsolete feature not enabled but %i markers found!\n' | 413 msg = 'obsolete feature not enabled but %i markers found!\n' |
413 self.ui.warn(msg % len(list(store))) | 414 self.ui.warn(msg % len(list(store))) |
414 return store | 415 return store |