D7235: repoview: extract a function for wrapping changelog
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Wed Nov 6 00:59:09 UTC 2019
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
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.
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D7235
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
@@ -217,6 +217,10 @@
repo.filteredrevcache[filtername] = func(repo.unfiltered())
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 +290,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
To: martinvonz, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list