# HG changeset patch # User Pierre-Yves David # Date 2014-09-17 00:52:40 # Node ID e994b034e91e459d9fc1e024c9271b1363ccda6c # Parent 974389427e5fbe9b1d06333aaef61f2f24649f17 obsolete: add a "format.obsstore-version" config option This option controls what version of the binary format to use when creating a new obsstore file. Default is still the old format. No safeguards are currently placed around the option value, but no clueless users are in danger of harm since it is undocumented. diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -400,7 +400,13 @@ class localrepository(object): @storecache('obsstore') def obsstore(self): - store = obsolete.obsstore(self.sopener) + # read default format for new obsstore. + defaultformat = self.ui.configint('format', 'obsstore-version', None) + # rely on obsstore class default when possible. + kwargs = {} + if defaultformat is not None: + defaultformat['defaultformat'] = defaultformat + store = obsolete.obsstore(self.sopener, **kwargs) if store and not obsolete._enabled: # message is rare enough to not be translated msg = 'obsolete feature not enabled but %i markers found!\n' diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py --- a/mercurial/obsolete.py +++ b/mercurial/obsolete.py @@ -450,7 +450,7 @@ class obsstore(object): # parents: (tuple of nodeid) or None, parents of precursors # None is used when no data has been recorded - def __init__(self, sopener): + def __init__(self, sopener, defaultformat=_fm0version): # caches for various obsolescence related cache self.caches = {} self._all = [] @@ -459,7 +459,7 @@ class obsstore(object): self.children = {} self.sopener = sopener data = sopener.tryread('obsstore') - self._version = _fm0version + self._version = defaultformat if data: self._version, markers = _readmarkers(data) self._load(markers)