repoview: extract a function for wrapping changelog
I would like to clean up the changelog class by moving out knowledge
of filtering. The filtering will instead be done in a class that wraps
the changelog. This patch prepares for that.
Differential Revision: https://phab.mercurial-scm.org/D7235
--- a/mercurial/repoview.py Tue Nov 05 14:42:08 2019 -0800
+++ b/mercurial/repoview.py Tue Nov 05 14:00:46 2019 -0800
@@ -218,6 +218,12 @@
return repo.filteredrevcache[filtername]
+def wrapchangelog(unfichangelog, filteredrevs):
+ cl = copy.copy(unfichangelog)
+ cl.filteredrevs = filteredrevs
+ return cl
+
+
class repoview(object):
"""Provide a read/write view of a repo through a filtered changelog
@@ -286,8 +292,7 @@
cl = None
# could have been made None by the previous if
if cl is None:
- cl = copy.copy(unfichangelog)
- cl.filteredrevs = revs
+ cl = wrapchangelog(unfichangelog, revs)
object.__setattr__(self, r'_clcache', cl)
object.__setattr__(self, r'_clcachekey', newkey)
return cl