Patchwork [RFC] revset: completely ignore "null" symbol in new-style query (BC)

login
register
mail settings
Submitter Yuya Nishihara
Date Jan. 4, 2015, 3:21 a.m.
Message ID <20150104122107.5c9620763f58c2b0d2b1514b@tcha.org>
Download mbox | patch
Permalink /patch/7314/
State Changes Requested
Headers show

Comments

Yuya Nishihara - Jan. 4, 2015, 3:21 a.m.
This depends on my previous patch "revset: drop pre-lazyset optimization for
stringset of subset == entire repo."  I want to know if "null" revision is
supported in revset.

# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1420338954 -32400
#      Sun Jan 04 11:35:54 2015 +0900
# Branch stable
# Node ID 144888bd0388a9ebf12d72ce3ea5d3f347fb6b8e
# Parent  e96450f354b1b693385d9cd1e1374fa910e1bf5f
revset: completely ignore "null" symbol in new-style query (BC)

I'm confused about the current state of "null" revision in revset.  Should we
fix "len(subset) == len(repo)" so that at least "null::" can be used with
evolve-enabled repository?

test-mq.t is updated not to use "null::".

correct (old-style query handled by scmutil.revrange):
 % hg log -r null                => (-1,)
 % hg log -r null:               => (-1, 0, 1, ...)

correct if no hidden revision exists (i.e. len(subset) == len(repo)):
 % hg log -r null::              => (-1, 0, 1, ...)
 % hg log -r 'null:: and null::' => (-1, 0, 1, ...)

incorrect:
 % hg log -r 'null: and null:'   => (0, 1, 2, ...)
 % hg log -r 'first(null:)'      => (0,)
 % hg log -r 'first(null::)'     => ()
Matt Mackall - Jan. 5, 2015, 9:45 p.m.
On Sun, 2015-01-04 at 12:21 +0900, Yuya Nishihara wrote:
> This depends on my previous patch "revset: drop pre-lazyset optimization for
> stringset of subset == entire repo."  I want to know if "null" revision is
> supported in revset.

We probably do want to support null. It's one of the primary barriers to
eliminating old-style queries. We also want to eventually support a
symbol/identifier that means "the working copy".

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -253,8 +253,6 @@  def _getrevsource(repo, r):
 
 def stringset(repo, subset, x):
     x = repo[x].rev()
-    if x == -1 and len(subset) == len(repo):
-        return baseset([-1])
     if x in subset:
         return baseset([x])
     return baseset()
diff --git a/tests/test-mq.t b/tests/test-mq.t
--- a/tests/test-mq.t
+++ b/tests/test-mq.t
@@ -1508,7 +1508,7 @@  Proper phase default with mq:
 1. mq.secret=false
 
   $ rm .hg/store/phaseroots
-  $ hg phase 'qparent::'
+  $ hg phase 'qparent:'
   -1: public
   0: draft
   1: draft
@@ -1516,7 +1516,7 @@  1. mq.secret=false
   $ echo '[mq]' >> $HGRCPATH
   $ echo 'secret=true' >> $HGRCPATH
   $ rm -f .hg/store/phaseroots
-  $ hg phase 'qparent::'
+  $ hg phase 'qparent:'
   -1: public
   0: secret
   1: secret