subsettable: move from repoview to branchmap, the only place it's used
authorAugie Fackler <raf@durin42.com>
Wed, 06 Nov 2013 14:38:34 -0500
changeset 20032 175c6fd8cacc
parent 20031 6c1adf2067bb
child 20033 f962870712da
subsettable: move from repoview to branchmap, the only place it's used This is a step towards breaking an import cycle between revset and repoview. Import cycles happened to work in Python 2 with implicit relative imports, but breaks on Python 3 when we start using explicit relative imports via 2to3 rewrite rules.
contrib/perf.py
mercurial/branchmap.py
mercurial/repoview.py
--- a/contrib/perf.py	Sat Nov 16 20:12:02 2013 -0500
+++ b/contrib/perf.py	Wed Nov 06 14:38:34 2013 -0500
@@ -386,7 +386,7 @@
     allfilters = []
     while possiblefilters:
         for name in possiblefilters:
-            subset = repoview.subsettable.get(name)
+            subset = branchmap.subsettable.get(name)
             if subset not in possiblefilters:
                 break
         else:
--- a/mercurial/branchmap.py	Sat Nov 16 20:12:02 2013 -0500
+++ b/mercurial/branchmap.py	Wed Nov 06 14:38:34 2013 -0500
@@ -7,7 +7,7 @@
 
 from node import bin, hex, nullid, nullrev
 import encoding
-import util, repoview
+import util
 
 def _filename(repo):
     """name of a branchcache file for a given repo or repoview"""
@@ -58,6 +58,17 @@
 
 
 
+### Nearest subset relation
+# Nearest subset of filter X is a filter Y so that:
+# * Y is included in X,
+# * X - Y is as small as possible.
+# This create and ordering used for branchmap purpose.
+# the ordering may be partial
+subsettable = {None: 'visible',
+               'visible': 'served',
+               'served': 'immutable',
+               'immutable': 'base'}
+
 def updatecache(repo):
     cl = repo.changelog
     filtername = repo.filtername
@@ -67,7 +78,7 @@
     if partial is None or not partial.validfor(repo):
         partial = read(repo)
         if partial is None:
-            subsetname = repoview.subsettable.get(filtername)
+            subsetname = subsettable.get(filtername)
             if subsetname is None:
                 partial = branchcache()
             else:
--- a/mercurial/repoview.py	Sat Nov 16 20:12:02 2013 -0500
+++ b/mercurial/repoview.py	Wed Nov 06 14:38:34 2013 -0500
@@ -98,16 +98,6 @@
                'served': computeunserved,
                'immutable':  computemutable,
                'base':  computeimpactable}
-### Nearest subset relation
-# Nearest subset of filter X is a filter Y so that:
-# * Y is included in X,
-# * X - Y is as small as possible.
-# This create and ordering used for branchmap purpose.
-# the ordering may be partial
-subsettable = {None: 'visible',
-               'visible': 'served',
-               'served': 'immutable',
-               'immutable': 'base'}
 
 def filterrevs(repo, filtername):
     """returns set of filtered revision for this filter name"""
@@ -215,4 +205,3 @@
     @property
     def requirements(self):
         return self._unfilteredrepo.requirements
-