323 except (KeyError, AttributeError): |
324 except (KeyError, AttributeError): |
324 pass |
325 pass |
325 |
326 |
326 cmdutil.summaryhooks.add('topic', summaryhook) |
327 cmdutil.summaryhooks.add('topic', summaryhook) |
327 |
328 |
|
329 templatekw.keywords['topic'] = topickw |
328 # Wrap workingctx extra to return the topic name |
330 # Wrap workingctx extra to return the topic name |
329 extensions.wrapfunction(context.workingctx, '__init__', wrapinit) |
331 extensions.wrapfunction(context.workingctx, '__init__', wrapinit) |
330 # Wrap changelog.add to drop empty topic |
332 # Wrap changelog.add to drop empty topic |
331 extensions.wrapfunction(changelog.changelog, 'add', wrapadd) |
333 extensions.wrapfunction(changelog.changelog, 'add', wrapadd) |
332 |
334 |
488 repo._topics = None |
490 repo._topics = None |
489 if util.safehasattr(repo, 'names'): |
491 if util.safehasattr(repo, 'names'): |
490 repo.names.addnamespace(namespaces.namespace( |
492 repo.names.addnamespace(namespaces.namespace( |
491 'topics', 'topic', namemap=_namemap, nodemap=_nodemap, |
493 'topics', 'topic', namemap=_namemap, nodemap=_nodemap, |
492 listnames=lambda repo: repo.topics)) |
494 listnames=lambda repo: repo.topics)) |
|
495 |
|
496 def topickw(**args): |
|
497 """:topic: String. The topic of the changeset""" |
|
498 return args['ctx'].topic() |
493 |
499 |
494 def wrapinit(orig, self, repo, *args, **kwargs): |
500 def wrapinit(orig, self, repo, *args, **kwargs): |
495 orig(self, repo, *args, **kwargs) |
501 orig(self, repo, *args, **kwargs) |
496 if getattr(repo, 'currenttopic', ''): |
502 if getattr(repo, 'currenttopic', ''): |
497 self._extra[constants.extrakey] = repo.currenttopic |
503 self._extra[constants.extrakey] = repo.currenttopic |