diff hgext3rd/topic/discovery.py @ 2695:b4824e169f18

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.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 02 Jul 2017 16:00:38 +0200
parents 10dedac0d82e
children a32afe67e8a6
line wrap: on
line diff
--- 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__