topic: cleanup the repository wrapping logic in topic discovery
We are know overriding the class so we do not need to update and restore the
pushop itself.
--- a/hgext3rd/topic/discovery.py Sun Jul 02 15:02:51 2017 +0200
+++ b/hgext3rd/topic/discovery.py Sun Jul 02 16:00:38 2017 +0200
@@ -49,17 +49,14 @@
ctx.branch = branch
return ctx
- oldrepo = repo.__class__
+ oldrepocls = repo.__class__
try:
repo.__class__ = repocls
unxx = repo.filtered('unfiltered-topic')
repo.unfiltered = lambda: unxx
if pushoparg:
- try:
- pushop.repo = repo
- summary = orig(pushop)
- finally:
- pushop.repo = repo
+ pushop.repo = repo
+ summary = orig(pushop)
else:
summary = orig(repo, remote, outgoing)
for key, value in summary.iteritems():
@@ -70,7 +67,7 @@
finally:
if 'unfiltered' in vars(repo):
del repo.unfiltered
- repo.__class__ = oldrepo
+ repo.__class__ = oldrepocls
def wireprotobranchmap(orig, repo, proto):
oldrepo = repo.__class__