[PATCH 1 of 2] changegroup: don't use 'repo' for non-repo 'self'

Martin von Zweigbergk martinvonz at google.com
Mon Jun 15 12:19:01 CDT 2015


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1434131650 25200
#      Fri Jun 12 10:54:10 2015 -0700
# Node ID 066efa45f4e9ee5276d7a37527231d6a69c281f0
# Parent  2b2108c35bfca8d553602b8e3f765f36b2c97a41
changegroup: don't use 'repo' for non-repo 'self'

'repo' is a very confusing name to use for 'self', especially when
it's not a repo. Also drop repo.ui member (a.k.a. self.ui) now that
'self' doesn't shadow outer 'repo' variable.

diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -743,12 +743,11 @@
         class prog(object):
             step = _('changesets')
             count = 1
-            ui = repo.ui
             total = expectedtotal
-            def __call__(repo):
-                repo.ui.progress(repo.step, repo.count, unit=_('chunks'),
-                                 total=repo.total)
-                repo.count += 1
+            def __call__(self):
+                repo.ui.progress(self.step, self.count, unit=_('chunks'),
+                                 total=self.total)
+                self.count += 1
         pr = prog()
         source.callback = pr
 


More information about the Mercurial-devel mailing list