Patchwork [V2] revset: omit dropping tip from the result of tag() (BC)

login
register
mail settings
Submitter Katsunori FUJIWARA
Date Feb. 4, 2015, 7:05 a.m.
Message ID <be0452c3be1b5f4bb9b4.1423033539@juju>
Download mbox | patch
Permalink /patch/7656/
State Rejected
Headers show

Comments

Katsunori FUJIWARA - Feb. 4, 2015, 7:05 a.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1423033325 -32400
#      Wed Feb 04 16:02:05 2015 +0900
# Node ID be0452c3be1b5f4bb9b425049a36f81238873fc2
# Parent  e1dbe0b215ae137eec53ceb12440536d570a83d2
revset: omit dropping tip from the result of tag() (BC)

Before this patch, revset predicate "tag()" and "named('tags')" differ
from each other, because the former doesn't include "tip" but the
latter does.

For equivalence between "hg tags", "tag()" and "named('tags')", this
patch omits dropping "tip" from the result of "tags" predicate, when
no pattern is specified to it.

This patch chooses this policy for simplicity, even though this may
break backward compatibility for existing tools, which expect that
"tip" isn't listed up in the result of "tag()".
Augie Fackler - Feb. 4, 2015, 9:04 p.m.
On Wed, Feb 4, 2015 at 2:05 AM, FUJIWARA Katsunori
<foozy@lares.dti.ne.jp> wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
> # Date 1423033325 -32400
> #      Wed Feb 04 16:02:05 2015 +0900
> # Node ID be0452c3be1b5f4bb9b425049a36f81238873fc2
> # Parent  e1dbe0b215ae137eec53ceb12440536d570a83d2
> revset: omit dropping tip from the result of tag() (BC)

I don't know how mpm feels, but I feel like this is going the wrong
way. More things should omit tip, rather than show it.

>
> Before this patch, revset predicate "tag()" and "named('tags')" differ
> from each other, because the former doesn't include "tip" but the
> latter does.
>
> For equivalence between "hg tags", "tag()" and "named('tags')", this
> patch omits dropping "tip" from the result of "tags" predicate, when
> no pattern is specified to it.
>
> This patch chooses this policy for simplicity, even though this may
> break backward compatibility for existing tools, which expect that
> "tip" isn't listed up in the result of "tag()".
>
> diff --git a/mercurial/revset.py b/mercurial/revset.py
> --- a/mercurial/revset.py
> +++ b/mercurial/revset.py
> @@ -1824,7 +1824,7 @@ def tag(repo, subset, x):
>          else:
>              s = set([cl.rev(n) for t, n in repo.tagslist() if matcher(t)])
>      else:
> -        s = set([cl.rev(n) for t, n in repo.tagslist() if t != 'tip'])
> +        s = set([cl.rev(n) for t, n in repo.tagslist()])
>      return subset & s
>
>  def tagged(repo, subset, x):
> diff --git a/tests/test-revset-dirstate-parents.t b/tests/test-revset-dirstate-parents.t
> --- a/tests/test-revset-dirstate-parents.t
> +++ b/tests/test-revset-dirstate-parents.t
> @@ -33,13 +33,20 @@ null revision
>  working dir with a single parent
>    $ echo a > a
>    $ hg ci -Aqm0
> +  $ log 'tag()'
> +  0
> +  $ log 'tip'
> +  0
>    $ log 'p1()'
>    0
>    $ log 'tag() and p1()'
> +  0
>    $ log 'p2()'
>    $ log 'parents()'
>    0
>    $ log 'tag() and parents()'
> +  0
> +  $ log 'tag() and p2()'
>
>  merge in progress
>    $ echo b > b
> diff --git a/tests/test-revset.t b/tests/test-revset.t
> --- a/tests/test-revset.t
> +++ b/tests/test-revset.t
> @@ -544,8 +544,10 @@ Test null revision
>    4
>    $ log 'tagged()'
>    6
> +  9
>    $ log 'tag()'
>    6
> +  9
>    $ log 'tag(1.0)'
>    6
>    $ log 'tag(tip)'
> @@ -789,6 +791,7 @@ we can use patterns when searching for t
>
>    $ log 'tag()'
>    6
> +  9
>    $ log 'named("tags")'
>    6
>    9
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Matt Mackall - Feb. 4, 2015, 9:36 p.m.
On Wed, 2015-02-04 at 16:04 -0500, Augie Fackler wrote:
> On Wed, Feb 4, 2015 at 2:05 AM, FUJIWARA Katsunori
> <foozy@lares.dti.ne.jp> wrote:
> > # HG changeset patch
> > # User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
> > # Date 1423033325 -32400
> > #      Wed Feb 04 16:02:05 2015 +0900
> > # Node ID be0452c3be1b5f4bb9b425049a36f81238873fc2
> > # Parent  e1dbe0b215ae137eec53ceb12440536d570a83d2
> > revset: omit dropping tip from the result of tag() (BC)
> 
> I don't know how mpm feels, but I feel like this is going the wrong
> way. More things should omit tip, rather than show it.

Yep, I'd go the other way and drop it from named(). 'tip' is definitely
an idea we're trying to eliminate.
Pierre-Yves David - Feb. 4, 2015, 10 p.m.
On 02/04/2015 09:36 PM, Matt Mackall wrote:
> On Wed, 2015-02-04 at 16:04 -0500, Augie Fackler wrote:
>> On Wed, Feb 4, 2015 at 2:05 AM, FUJIWARA Katsunori
>> <foozy@lares.dti.ne.jp> wrote:
>>> # HG changeset patch
>>> # User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
>>> # Date 1423033325 -32400
>>> #      Wed Feb 04 16:02:05 2015 +0900
>>> # Node ID be0452c3be1b5f4bb9b425049a36f81238873fc2
>>> # Parent  e1dbe0b215ae137eec53ceb12440536d570a83d2
>>> revset: omit dropping tip from the result of tag() (BC)
>>
>> I don't know how mpm feels, but I feel like this is going the wrong
>> way. More things should omit tip, rather than show it.
>
> Yep, I'd go the other way and drop it from named(). 'tip' is definitely
> an idea we're trying to eliminate.

I probably mis-convoyed something in my previous review set. I agree 
with Augie and Matt here. Lets drop tip into oblivion for new API.
Katsunori FUJIWARA - Feb. 5, 2015, 3:59 a.m.
At Wed, 04 Feb 2015 22:00:05 +0000,
Pierre-Yves David wrote:
> 
> 
> 
> On 02/04/2015 09:36 PM, Matt Mackall wrote:
> > On Wed, 2015-02-04 at 16:04 -0500, Augie Fackler wrote:
> >> On Wed, Feb 4, 2015 at 2:05 AM, FUJIWARA Katsunori
> >> <foozy@lares.dti.ne.jp> wrote:
> >>> # HG changeset patch
> >>> # User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
> >>> # Date 1423033325 -32400
> >>> #      Wed Feb 04 16:02:05 2015 +0900
> >>> # Node ID be0452c3be1b5f4bb9b425049a36f81238873fc2
> >>> # Parent  e1dbe0b215ae137eec53ceb12440536d570a83d2
> >>> revset: omit dropping tip from the result of tag() (BC)
> >>
> >> I don't know how mpm feels, but I feel like this is going the wrong
> >> way. More things should omit tip, rather than show it.
> >
> > Yep, I'd go the other way and drop it from named(). 'tip' is definitely
> > an idea we're trying to eliminate.
> 
> I probably mis-convoyed something in my previous review set. I agree 
> with Augie and Matt here. Lets drop tip into oblivion for new API.

OK, I'll re-post the previous patch dropping "tip" from
"named('tags')" with some revises.


> -- 
> Pierre-Yves David
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

----------------------------------------------------------------------
[FUJIWARA Katsunori]                             foozy@lares.dti.ne.jp

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -1824,7 +1824,7 @@  def tag(repo, subset, x):
         else:
             s = set([cl.rev(n) for t, n in repo.tagslist() if matcher(t)])
     else:
-        s = set([cl.rev(n) for t, n in repo.tagslist() if t != 'tip'])
+        s = set([cl.rev(n) for t, n in repo.tagslist()])
     return subset & s
 
 def tagged(repo, subset, x):
diff --git a/tests/test-revset-dirstate-parents.t b/tests/test-revset-dirstate-parents.t
--- a/tests/test-revset-dirstate-parents.t
+++ b/tests/test-revset-dirstate-parents.t
@@ -33,13 +33,20 @@  null revision
 working dir with a single parent
   $ echo a > a
   $ hg ci -Aqm0
+  $ log 'tag()'
+  0
+  $ log 'tip'
+  0
   $ log 'p1()'
   0
   $ log 'tag() and p1()'
+  0
   $ log 'p2()'
   $ log 'parents()'
   0
   $ log 'tag() and parents()'
+  0
+  $ log 'tag() and p2()'
 
 merge in progress
   $ echo b > b
diff --git a/tests/test-revset.t b/tests/test-revset.t
--- a/tests/test-revset.t
+++ b/tests/test-revset.t
@@ -544,8 +544,10 @@  Test null revision
   4
   $ log 'tagged()'
   6
+  9
   $ log 'tag()'
   6
+  9
   $ log 'tag(1.0)'
   6
   $ log 'tag(tip)'
@@ -789,6 +791,7 @@  we can use patterns when searching for t
 
   $ log 'tag()'
   6
+  9
   $ log 'named("tags")'
   6
   9