142 |
143 |
143 testedwith = '4.0.2 4.1.3 4.2.3 4.3.3' |
144 testedwith = '4.0.2 4.1.3 4.2.3 4.3.3' |
144 minimumhgversion = '4.0' |
145 minimumhgversion = '4.0' |
145 buglink = 'https://bz.mercurial-scm.org/' |
146 buglink = 'https://bz.mercurial-scm.org/' |
146 |
147 |
|
148 if util.safehasattr(registrar, 'configitem'): |
|
149 configtable = {} |
|
150 configitem = registrar.configitem(configtable) |
|
151 |
|
152 configitem('experimental', 'enforce-topic', |
|
153 default=False, |
|
154 ) |
|
155 configitem('experimental', 'topic-mode', |
|
156 default=None, |
|
157 ) |
|
158 configitem('_internal', 'keep-topic', |
|
159 default=False, |
|
160 ) |
|
161 |
|
162 def extsetup(ui): |
|
163 # register config that strickly belong to other code (thg, core, etc) |
|
164 # |
|
165 # To ensure all config items we used are registerd, we register them if |
|
166 # nobody else did so far. |
|
167 from mercurial import configitems |
|
168 extraitem = functools.partial(configitems._register, ui._knownconfig) |
|
169 if ('experimental' not in ui._knownconfig |
|
170 or not ui._knownconfig['experimental'].get('thg.displaynames')): |
|
171 extraitem('experimental', 'thg.displaynames', |
|
172 default=None, |
|
173 ) |
|
174 if ('devel' not in ui._knownconfig |
|
175 or not ui._knownconfig['devel'].get('random')): |
|
176 extraitem('devel', 'randomseed', |
|
177 default=None, |
|
178 ) |
|
179 |
147 def _contexttopic(self, force=False): |
180 def _contexttopic(self, force=False): |
148 if not (force or self.mutable()): |
181 if not (force or self.mutable()): |
149 return '' |
182 return '' |
150 return self.extra().get(constants.extrakey, '') |
183 return self.extra().get(constants.extrakey, '') |
151 context.basectx.topic = _contexttopic |
184 context.basectx.topic = _contexttopic |
247 if not isinstance(repo, localrepo.localrepository): |
280 if not isinstance(repo, localrepo.localrepository): |
248 return # this can be a peer in the ssh case (puzzling) |
281 return # this can be a peer in the ssh case (puzzling) |
249 |
282 |
250 repo = repo.unfiltered() |
283 repo = repo.unfiltered() |
251 |
284 |
252 if repo.ui.config('experimental', 'thg.displaynames', None) is None: |
285 if repo.ui.config('experimental', 'thg.displaynames') is None: |
253 repo.ui.setconfig('experimental', 'thg.displaynames', 'topics', |
286 repo.ui.setconfig('experimental', 'thg.displaynames', 'topics', |
254 source='topic-extension') |
287 source='topic-extension') |
255 |
288 |
256 class topicrepo(repo.__class__): |
289 class topicrepo(repo.__class__): |
257 |
290 |
926 ] |
959 ] |
927 |
960 |
928 def _configtopicmode(ui): |
961 def _configtopicmode(ui): |
929 """ Parse the config to get the topicmode |
962 """ Parse the config to get the topicmode |
930 """ |
963 """ |
931 topicmode = ui.config('experimental', 'topic-mode', default=None) |
964 topicmode = ui.config('experimental', 'topic-mode') |
932 |
965 |
933 # Fallback to read enforce-topic |
966 # Fallback to read enforce-topic |
934 if topicmode is None: |
967 if topicmode is None: |
935 enforcetopic = ui.configbool('experimental', 'enforce-topic') |
968 enforcetopic = ui.configbool('experimental', 'enforce-topic') |
936 if enforcetopic: |
969 if enforcetopic: |