# HG changeset patch # User Pierre-Yves David # Date 1459400572 25200 # Node ID f4f5bf8b4d17939f4d88649257495e3cec4d0d6b # Parent daad8249d5cf036f05e9a5538e458335ea625c37 patch: move import/export wrapping close to the function definition This gather similar logic together. diff -r daad8249d5cf -r f4f5bf8b4d17 hgext3rd/topic/__init__.py --- a/hgext3rd/topic/__init__.py Wed Mar 30 21:53:55 2016 -0700 +++ b/hgext3rd/topic/__init__.py Wed Mar 30 22:02:52 2016 -0700 @@ -345,6 +345,15 @@ if 'topic' in patchdata: extra['topic'] = patchdata['topic'] +if util.safehasattr(cmdutil, 'extraexport'): + cmdutil.extraexport.append('topic') + cmdutil.extraexportmap['topic'] = _exporttopic +if util.safehasattr(cmdutil, 'extrapreimport'): + cmdutil.extrapreimport.append('topic') + cmdutil.extrapreimportmap['topic'] = _importtopic +if util.safehasattr(patch, 'patchheadermap'): + patch.patchheadermap.append(('EXP-Topic', 'topic')) + extensions.afterloaded('rebase', _fixrebase) entry = extensions.wrapcommand(commands.table, 'commit', commitwrap) @@ -356,11 +365,3 @@ extensions.wrapfunction(changegroup.cg1unpacker, 'apply', cgapply) cmdutil.summaryhooks.add('topic', summaryhook) -if util.safehasattr(cmdutil, 'extraexport'): - cmdutil.extraexport.append('topic') - cmdutil.extraexportmap['topic'] = _exporttopic -if util.safehasattr(cmdutil, 'extrapreimport'): - cmdutil.extrapreimport.append('topic') - cmdutil.extrapreimportmap['topic'] = _importtopic -if util.safehasattr(patch, 'patchheadermap'): - patch.patchheadermap.append(('EXP-Topic', 'topic'))