Patchwork D7364: repoview: use class literal for creating filteredchangelog

login
register
mail settings
Submitter phabricator
Date Nov. 8, 2019, 7:26 p.m.
Message ID <differential-rev-PHID-DREV-zqhwso4xuux6q6cynat7-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/42982/
State Superseded
Headers show

Comments

phabricator - Nov. 8, 2019, 7:26 p.m.
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




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

Patch

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