Patchwork [1,of,8,v2] subsettable: move from repoview to branchmap, the only place it's used

login
register
mail settings
Submitter Augie Fackler
Date Nov. 17, 2013, 9:37 p.m.
Message ID <175c6fd8cacc46ec6907.1384724239@hit-nxdomain.opendns.com>
Download mbox | patch
Permalink /patch/3036/
State Accepted
Commit 175c6fd8cacc46ec69079e62bdcf611c779c67ea
Headers show

Comments

Augie Fackler - Nov. 17, 2013, 9:37 p.m.
# HG changeset patch
# User Augie Fackler <raf@durin42.com>
# Date 1383766714 18000
#      Wed Nov 06 14:38:34 2013 -0500
# Node ID 175c6fd8cacc46ec69079e62bdcf611c779c67ea
# Parent  6c1adf2067bb7c225f96cf253e9e228b5a7cdcf4
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.
Pierre-Yves David - Nov. 20, 2013, 5:32 a.m.
On 11/17/2013 01:37 PM, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <raf@durin42.com>
> # Date 1383766714 18000
> #      Wed Nov 06 14:38:34 2013 -0500
> # Node ID 175c6fd8cacc46ec69079e62bdcf611c779c67ea
> # Parent  6c1adf2067bb7c225f96cf253e9e228b5a7cdcf4
> subsettable: move from repoview to branchmap, the only place it's used

> diff --git a/mercurial/repoview.py b/mercurial/repoview.py
> --- a/mercurial/repoview.py
> +++ b/mercurial/repoview.py
> @@ -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'}

Please do add a big flashy warning comment that whatever gets added to 
the dictionary right above MUST have a corresponding entry in 
subsettable located at XXX

>   
>   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
> -
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Augie Fackler - Nov. 25, 2013, 1:35 a.m.
On Nov 20, 2013, at 12:32 AM, Pierre-Yves David <pierre-yves.david@ens-lyon.org> wrote:

>> diff --git a/mercurial/repoview.py b/mercurial/repoview.py
>> --- a/mercurial/repoview.py
>> +++ b/mercurial/repoview.py
>> @@ -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'}
> 
> Please do add a big flashy warning comment that whatever gets added to the dictionary right above MUST have a corresponding entry in subsettable located at XXX

Not quite sure what you're asking, send me a patch?

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -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:
diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -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:
diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -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
-