D7364: repoview: use class literal for creating filteredchangelog

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Fri Nov 8 19:26:49 UTC 2019


martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The type name is constant, so we don't need to create it dynamically
  using type(). As suggested by Yuya.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D7364

AFFECTED FILES
  mercurial/repoview.py

CHANGE DETAILS

diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -227,9 +227,10 @@
     cl = copy.copy(unfichangelog)
     cl.filteredrevs = filteredrevs
 
-    cl.__class__ = type(
-        'filteredchangelog', (filteredchangelogmixin, cl.__class__), {}
-    )
+    class filteredchangelog(filteredchangelogmixin, cl.__class__):
+        pass
+
+    cl.__class__ = filteredchangelog
 
     return cl
 



To: martinvonz, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list