Mercurial > public > mercurial-scm > evolve
diff hgext3rd/topic/topicmap.py @ 1950:99c1a26abf3f
topicmap: move 'cgapply' wrapping into the topicmap module
More gathering of related logic.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Wed, 30 Mar 2016 22:31:24 -0700 |
parents | 79c08d17a3d7 |
children | bdc5bb223b50 |
line wrap: on
line diff
--- a/hgext3rd/topic/topicmap.py Wed Mar 30 22:25:17 2016 -0700 +++ b/hgext3rd/topic/topicmap.py Wed Mar 30 22:31:24 2016 -0700 @@ -3,8 +3,10 @@ from mercurial.node import hex, bin, nullid from mercurial import ( branchmap, + changegroup, encoding, error, + extensions, scmutil, util, ) @@ -60,6 +62,11 @@ branchmap._filename = oldfilename branchmap.read = oldread +def cgapply(orig, repo, *args, **kwargs): + """make sure a topicmap is used when applying a changegroup""" + with usetopicmap(repo): + return orig(repo, *args, **kwargs) + class topiccache(oldbranchcache): def __init__(self, *args, **kwargs): @@ -225,3 +232,7 @@ repo.ui.debug(msg % inst) partial = None return partial + +def modsetup(ui): + """call at uisetup time to install various wrappings""" + extensions.wrapfunction(changegroup.cg1unpacker, 'apply', cgapply)