[PATCH 3 of 3] revset: drop factory that promotes spanset to fullreposet

Yuya Nishihara yuya at tcha.org
Mon May 4 20:05:11 CDT 2015


On Mon, 04 May 2015 17:19:35 -0700, Pierre-Yves David wrote:
> On 02/10/2015 07:50 AM, Yuya Nishihara wrote:
> > # HG changeset patch
> > # User Yuya Nishihara <yuya at tcha.org>
> > # Date 1420728195 -32400
> > #      Thu Jan 08 23:43:15 2015 +0900
> > # Node ID 9962a866325681d8e4523ea30edd3e2ed8343f98
> > # Parent  f04a70f7f3a11b5c66dc739cdf6bcf57d59183ff
> > revset: drop factory that promotes spanset to fullreposet
> 
> This overlooked the 'all()' revset as a place were spanset was used 
> (making combinaison with involving all() less efficients as they 
> should). We cannot just fix 'all()' to used 'fullreposet' because 
> fullreposet is now doing working copy magic too. This lead to these two 
> test failure when tried. Yuya, can I get you to look at this?
> 
> --- /home/marmoute/mercurial-testing/tests/test-glog.t
> +++ /home/marmoute/mercurial-testing/tests/test-glog.t.err
> @@ -2370,9 +2370,9 @@
>     $ hg log -G -r 'all()' | tail -6
>     |
>     o  changeset:   0:f8035bb17114
> -     user:        test
> -     date:        Thu Jan 01 00:00:00 1970 +0000
> -     summary:     add a
> -
> +  |  user:        test
> +  |  date:        Thu Jan 01 00:00:00 1970 +0000
> +  |  summary:     add a
> +  |

Does this solve the efficiency problem?

It backs out 2de9ee016425 and wraps fullreposet at match() instead. It
assumes that the optimization provided by fullreposet is necessary while
calculating revset.

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -996,7 +996,7 @@ def getall(repo, subset, x):
     """
     # i18n: "all" is a keyword
     getargs(x, 0, 0, _("all takes no arguments"))
-    return subset & spanset(repo)  # drop "null" if any
+    return subset
 
 def grep(repo, subset, x):
     """``grep(regex)``
@@ -2522,6 +2522,9 @@ def match(ui, spec, repo=None):
             result = getset(repo, subset, tree)
         else:
             result = getset(repo, baseset(subset), tree)
+        if isinstance(result, fullreposet):
+            # do not expose fullreposet because its __contains__ causes problem
+            result &= spanset(repo)
         return result
     return mfunc
 
diff --git a/tests/test-revset.t b/tests/test-revset.t
--- a/tests/test-revset.t
+++ b/tests/test-revset.t
@@ -600,9 +600,6 @@ Test null revision
   -1
   $ log 'min(null:)'
   -1
-  $ log 'tip:null and all()' | tail -2
-  1
-  0
 
 Test working-directory revision
   $ hg debugrevspec 'wdir()'


More information about the Mercurial-devel mailing list