D451: revset: remove order information from tree

2017-08-19 Thread quark (Jun Wu)
quark updated this revision to Diff 1099.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D451?vs=1098=1099

REVISION DETAIL
  https://phab.mercurial-scm.org/D451

AFFECTED FILES
  mercurial/revset.py
  mercurial/revsetlang.py
  tests/test-revset.t

CHANGE DETAILS

diff --git a/tests/test-revset.t b/tests/test-revset.t
--- a/tests/test-revset.t
+++ b/tests/test-revset.t
@@ -166,8 +166,7 @@
 None)
   * optimized:
   (rangeall
-None
-define)
+None)
   * set:
   
   0
@@ -495,8 +494,7 @@
 ('symbol', 'foo')
 (func
   ('symbol', '_notpublic')
-  None
-  any))
+  None))
   hg: parse error: can't use a key-value pair in this context
   [255]
 
@@ -538,52 +536,43 @@
 (not
   (func
 ('symbol', 'public')
-None
-any)
-  define)
+None))
 ('symbol', 'generations')
-('symbol', '0')
-define)
+('symbol', '0'))
   * optimized:
   (relsubscript
 (func
   ('symbol', '_notpublic')
-  None
-  any)
+  None)
 ('symbol', 'generations')
-('symbol', '0')
-define)
+('symbol', '0'))
 
 resolution of subscript and relation-subscript ternary operators:
 
   $ hg debugrevspec -p analyzed 'tip[0]'
   * analyzed:
   (subscript
 ('symbol', 'tip')
-('symbol', '0')
-define)
+('symbol', '0'))
   hg: parse error: can't use a subscript in this context
   [255]
 
   $ hg debugrevspec -p analyzed 'tip#rel[0]'
   * analyzed:
   (relsubscript
 ('symbol', 'tip')
 ('symbol', 'rel')
-('symbol', '0')
-define)
+('symbol', '0'))
   hg: parse error: unknown identifier: rel
   [255]
 
   $ hg debugrevspec -p analyzed '(tip#rel)[0]'
   * analyzed:
   (subscript
 (relation
   ('symbol', 'tip')
-  ('symbol', 'rel')
-  define)
-('symbol', '0')
-define)
+  ('symbol', 'rel'))
+('symbol', '0'))
   hg: parse error: can't use a subscript in this context
   [255]
 
@@ -593,23 +582,19 @@
 (relsubscript
   ('symbol', 'tip')
   ('symbol', 'rel')
-  ('symbol', '0')
-  define)
-('symbol', '1')
-define)
+  ('symbol', '0'))
+('symbol', '1'))
   hg: parse error: can't use a subscript in this context
   [255]
 
   $ hg debugrevspec -p analyzed 'tip#rel0#rel1[1]'
   * analyzed:
   (relsubscript
 (relation
   ('symbol', 'tip')
-  ('symbol', 'rel0')
-  define)
+  ('symbol', 'rel0'))
 ('symbol', 'rel1')
-('symbol', '1')
-define)
+('symbol', '1'))
   hg: parse error: unknown identifier: rel1
   [255]
 
@@ -619,11 +604,9 @@
 (relsubscript
   ('symbol', 'tip')
   ('symbol', 'rel0')
-  ('symbol', '0')
-  define)
+  ('symbol', '0'))
 ('symbol', 'rel1')
-('symbol', '1')
-define)
+('symbol', '1'))
   hg: parse error: unknown identifier: rel1
   [255]
 
@@ -700,20 +683,15 @@
 (or
   (list
 ('symbol', '0')
-('symbol', '1'))
-  define)
+('symbol', '1')))
 (not
-  ('symbol', '1')
-  follow)
-define)
+  ('symbol', '1')))
   * optimized:
   (difference
 (func
   ('symbol', '_list')
-  ('string', '0\x001')
-  define)
-('symbol', '1')
-define)
+  ('string', '0\x001'))
+('symbol', '1'))
   0
 
   $ hg debugrevspec -p unknown '0'
@@ -733,18 +711,16 @@
   (and
 (func
   ('symbol', 'r3232')
-  None
-  define)
-('symbol', '2')
-define)
+  None)
+('symbol', '2'))
   * optimized:
-  (and
-('symbol', '2')
-(func
-  ('symbol', 'r3232')
-  None
-  define)
-define)
+  (func
+('symbol', '_flipand')
+(list
+  ('symbol', '2')
+  (func
+('symbol', 'r3232')
+None)))
   * analyzed set:
   
   * optimized set:
@@ -776,8 +752,7 @@
 None)
   * analyzed:
   (rangeall
-None
-define)
+None)
   * set:
   
   0
@@ -793,8 +768,7 @@
   $ try -p analyzed ':1'
   * analyzed:
   (rangepre
-('symbol', '1')
-define)
+('symbol', '1'))
   * set:
   
   0
@@ -805,9 +779,7 @@
 (or
   (list
 ('symbol', '1')
-('symbol', '2'))
-  define)
-define)
+('symbol', '2'
   * set:
   
   0
@@ -818,9 +790,7 @@
   (rangepre
 (and
   ('symbol', '1')
-  ('symbol', '2')
-  define)
-define)
+  ('symbol', '2')))
   * set:
   
 
@@ -1643,11 +1613,8 @@
 (difference
   (range
 ('symbol', '8')
-('symbol', '9')
-define)
-  ('symbol', '8')
-  define)
-define)
+('symbol', '9'))
+  ('symbol', '8')))
   * set:
   
   8
@@ -1663,8 +1630,7 @@
 ('symbol', 'only')
 (list
   ('symbol', '9')
-  ('symbol', '5'))
-define)
+  ('symbol', '5')))
   * set:
   
   2
@@ -1999,18 +1965,13 @@
 (and
   (range
 ('symbol', '3')
-('symbol', '0')
-

D451: revset: remove order information from tree

2017-08-19 Thread yuja (Yuya Nishihara)
yuja added a comment.


  Clever. I haven't looked this carefully, but the general direction seems fine.
  
  > @yuja Let me know if this can simplify `matchtree`, `buildtree` 
implementation.
  
  Actually `matchtree` can ignore extra elements in a node tuple, so the 
existence
  of `order` flag is acceptable, though this will slightly simplify the match 
function.
  
  > I also wonder if it makes sense to move (part of, mostly weight related) 
`_optimize` to runtime (`getset`), since the revset functions could have more 
information. For example, if `sort` gets `rev` as sort key, it could use 
`getset(order=any)` instead of `getset(order=define)`. Some functions like 
`ancestors(revs)` also do not care about the order of `revs`, and we are being 
conservative - using `define` for all function arguments now.
  
  That could be, perhaps.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D451

To: quark, #hg-reviewers
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D451: revset: remove order information from tree

2017-08-19 Thread quark (Jun Wu)
quark added inline comments.

INLINE COMMENTS

> revset.py:58-61
> +# TODO migrate existing functions to accept "order", and maybe wrap
> +# registered functions automatically if they do not accept "order".
> +m = methods[x[0]]
> +return m(repo, subset, *x[1:], order=order)

TODO can be removed.

> revset.py:129
>includepath=True)
>  return subset & xs
>  

In theory this should be:

  if order == defineorder:
  return xs & subset
  else:
  return subset & xs

But it's a bit tricky to find a counterexample. I'm still trying.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D451

To: quark, #hg-reviewers
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D447: templatekw: choose {latesttag} by len(changes), not date (issue5659)

2017-08-19 Thread yuja (Yuya Nishihara)
yuja accepted this revision.
yuja added a comment.
This revision is now accepted and ready to land.


  This one looks good to me, thanks. I leave it to Sean since he said he's 
queued the previous series.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D447

To: martinvonz, #hg-reviewers, yuja
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D358: copytrace: move fb extension to core under flag experimental.fastcopytrace

2017-08-19 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  Any updates on this? The function `_fastmergecopies()` is simply a port of 
`_domergecopies()` from fbhgext/copytrace.py. 
https://phab.mercurial-scm.org/diffusion/FBHGX/browse/default/hgext3rd/copytrace.py;75cfcc6fc62a4f172857beebda6c0e43f318ea87$290

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D358

To: pulkit, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D219: morestatus: move fb extension to core by plugging to `hg status --verbose`

2017-08-19 Thread pulkit (Pulkit Goyal)
pulkit added inline comments.

INLINE COMMENTS

> martinvonz wrote in test-bisect.t:190
> What does None mean here?

Oh, _conflictsmsg() is returning None which is getting printed. I will send a 
follow-up for this.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D219

To: pulkit, #hg-reviewers, durin42
Cc: durin42, quark, akushner, martinvonz, durham, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D451: [RFC] revset: remove order information from tree

2017-08-19 Thread quark (Jun Wu)
quark updated this revision to Diff 1097.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D451?vs=1096=1097

REVISION DETAIL
  https://phab.mercurial-scm.org/D451

AFFECTED FILES
  mercurial/revset.py
  mercurial/revsetlang.py
  tests/test-revset.t

CHANGE DETAILS

diff --git a/tests/test-revset.t b/tests/test-revset.t
--- a/tests/test-revset.t
+++ b/tests/test-revset.t
@@ -166,8 +166,7 @@
 None)
   * optimized:
   (rangeall
-None
-define)
+None)
   * set:
   
   0
@@ -495,8 +494,7 @@
 ('symbol', 'foo')
 (func
   ('symbol', '_notpublic')
-  None
-  any))
+  None))
   hg: parse error: can't use a key-value pair in this context
   [255]
 
@@ -538,52 +536,43 @@
 (not
   (func
 ('symbol', 'public')
-None
-any)
-  define)
+None))
 ('symbol', 'generations')
-('symbol', '0')
-define)
+('symbol', '0'))
   * optimized:
   (relsubscript
 (func
   ('symbol', '_notpublic')
-  None
-  any)
+  None)
 ('symbol', 'generations')
-('symbol', '0')
-define)
+('symbol', '0'))
 
 resolution of subscript and relation-subscript ternary operators:
 
   $ hg debugrevspec -p analyzed 'tip[0]'
   * analyzed:
   (subscript
 ('symbol', 'tip')
-('symbol', '0')
-define)
+('symbol', '0'))
   hg: parse error: can't use a subscript in this context
   [255]
 
   $ hg debugrevspec -p analyzed 'tip#rel[0]'
   * analyzed:
   (relsubscript
 ('symbol', 'tip')
 ('symbol', 'rel')
-('symbol', '0')
-define)
+('symbol', '0'))
   hg: parse error: unknown identifier: rel
   [255]
 
   $ hg debugrevspec -p analyzed '(tip#rel)[0]'
   * analyzed:
   (subscript
 (relation
   ('symbol', 'tip')
-  ('symbol', 'rel')
-  define)
-('symbol', '0')
-define)
+  ('symbol', 'rel'))
+('symbol', '0'))
   hg: parse error: can't use a subscript in this context
   [255]
 
@@ -593,23 +582,19 @@
 (relsubscript
   ('symbol', 'tip')
   ('symbol', 'rel')
-  ('symbol', '0')
-  define)
-('symbol', '1')
-define)
+  ('symbol', '0'))
+('symbol', '1'))
   hg: parse error: can't use a subscript in this context
   [255]
 
   $ hg debugrevspec -p analyzed 'tip#rel0#rel1[1]'
   * analyzed:
   (relsubscript
 (relation
   ('symbol', 'tip')
-  ('symbol', 'rel0')
-  define)
+  ('symbol', 'rel0'))
 ('symbol', 'rel1')
-('symbol', '1')
-define)
+('symbol', '1'))
   hg: parse error: unknown identifier: rel1
   [255]
 
@@ -619,11 +604,9 @@
 (relsubscript
   ('symbol', 'tip')
   ('symbol', 'rel0')
-  ('symbol', '0')
-  define)
+  ('symbol', '0'))
 ('symbol', 'rel1')
-('symbol', '1')
-define)
+('symbol', '1'))
   hg: parse error: unknown identifier: rel1
   [255]
 
@@ -700,20 +683,15 @@
 (or
   (list
 ('symbol', '0')
-('symbol', '1'))
-  define)
+('symbol', '1')))
 (not
-  ('symbol', '1')
-  follow)
-define)
+  ('symbol', '1')))
   * optimized:
   (difference
 (func
   ('symbol', '_list')
-  ('string', '0\x001')
-  define)
-('symbol', '1')
-define)
+  ('string', '0\x001'))
+('symbol', '1'))
   0
 
   $ hg debugrevspec -p unknown '0'
@@ -733,18 +711,16 @@
   (and
 (func
   ('symbol', 'r3232')
-  None
-  define)
-('symbol', '2')
-define)
+  None)
+('symbol', '2'))
   * optimized:
-  (and
-('symbol', '2')
-(func
-  ('symbol', 'r3232')
-  None
-  define)
-define)
+  (func
+('symbol', '_flipand')
+(list
+  ('symbol', '2')
+  (func
+('symbol', 'r3232')
+None)))
   * analyzed set:
   
   * optimized set:
@@ -776,8 +752,7 @@
 None)
   * analyzed:
   (rangeall
-None
-define)
+None)
   * set:
   
   0
@@ -793,8 +768,7 @@
   $ try -p analyzed ':1'
   * analyzed:
   (rangepre
-('symbol', '1')
-define)
+('symbol', '1'))
   * set:
   
   0
@@ -805,9 +779,7 @@
 (or
   (list
 ('symbol', '1')
-('symbol', '2'))
-  define)
-define)
+('symbol', '2'
   * set:
   
   0
@@ -818,9 +790,7 @@
   (rangepre
 (and
   ('symbol', '1')
-  ('symbol', '2')
-  define)
-define)
+  ('symbol', '2')))
   * set:
   
 
@@ -1643,11 +1613,8 @@
 (difference
   (range
 ('symbol', '8')
-('symbol', '9')
-define)
-  ('symbol', '8')
-  define)
-define)
+('symbol', '9'))
+  ('symbol', '8')))
   * set:
   
   8
@@ -1663,8 +1630,7 @@
 ('symbol', 'only')
 (list
   ('symbol', '9')
-  ('symbol', '5'))
-define)
+  ('symbol', '5')))
   * set:
   
   2
@@ -1999,18 +1965,13 @@
 (and
   (range
 ('symbol', '3')
-('symbol', '0')
-

D451: [RFC] revset: remove order information from tree

2017-08-19 Thread quark (Jun Wu)
quark updated this revision to Diff 1096.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D451?vs=1095=1096

REVISION DETAIL
  https://phab.mercurial-scm.org/D451

AFFECTED FILES
  mercurial/revset.py
  mercurial/revsetlang.py
  tests/test-revset.t

CHANGE DETAILS

diff --git a/tests/test-revset.t b/tests/test-revset.t
--- a/tests/test-revset.t
+++ b/tests/test-revset.t
@@ -166,8 +166,7 @@
 None)
   * optimized:
   (rangeall
-None
-define)
+None)
   * set:
   
   0
@@ -495,8 +494,7 @@
 ('symbol', 'foo')
 (func
   ('symbol', '_notpublic')
-  None
-  any))
+  None))
   hg: parse error: can't use a key-value pair in this context
   [255]
 
@@ -538,52 +536,43 @@
 (not
   (func
 ('symbol', 'public')
-None
-any)
-  define)
+None))
 ('symbol', 'generations')
-('symbol', '0')
-define)
+('symbol', '0'))
   * optimized:
   (relsubscript
 (func
   ('symbol', '_notpublic')
-  None
-  any)
+  None)
 ('symbol', 'generations')
-('symbol', '0')
-define)
+('symbol', '0'))
 
 resolution of subscript and relation-subscript ternary operators:
 
   $ hg debugrevspec -p analyzed 'tip[0]'
   * analyzed:
   (subscript
 ('symbol', 'tip')
-('symbol', '0')
-define)
+('symbol', '0'))
   hg: parse error: can't use a subscript in this context
   [255]
 
   $ hg debugrevspec -p analyzed 'tip#rel[0]'
   * analyzed:
   (relsubscript
 ('symbol', 'tip')
 ('symbol', 'rel')
-('symbol', '0')
-define)
+('symbol', '0'))
   hg: parse error: unknown identifier: rel
   [255]
 
   $ hg debugrevspec -p analyzed '(tip#rel)[0]'
   * analyzed:
   (subscript
 (relation
   ('symbol', 'tip')
-  ('symbol', 'rel')
-  define)
-('symbol', '0')
-define)
+  ('symbol', 'rel'))
+('symbol', '0'))
   hg: parse error: can't use a subscript in this context
   [255]
 
@@ -593,23 +582,19 @@
 (relsubscript
   ('symbol', 'tip')
   ('symbol', 'rel')
-  ('symbol', '0')
-  define)
-('symbol', '1')
-define)
+  ('symbol', '0'))
+('symbol', '1'))
   hg: parse error: can't use a subscript in this context
   [255]
 
   $ hg debugrevspec -p analyzed 'tip#rel0#rel1[1]'
   * analyzed:
   (relsubscript
 (relation
   ('symbol', 'tip')
-  ('symbol', 'rel0')
-  define)
+  ('symbol', 'rel0'))
 ('symbol', 'rel1')
-('symbol', '1')
-define)
+('symbol', '1'))
   hg: parse error: unknown identifier: rel1
   [255]
 
@@ -619,11 +604,9 @@
 (relsubscript
   ('symbol', 'tip')
   ('symbol', 'rel0')
-  ('symbol', '0')
-  define)
+  ('symbol', '0'))
 ('symbol', 'rel1')
-('symbol', '1')
-define)
+('symbol', '1'))
   hg: parse error: unknown identifier: rel1
   [255]
 
@@ -700,20 +683,15 @@
 (or
   (list
 ('symbol', '0')
-('symbol', '1'))
-  define)
+('symbol', '1')))
 (not
-  ('symbol', '1')
-  follow)
-define)
+  ('symbol', '1')))
   * optimized:
   (difference
 (func
   ('symbol', '_list')
-  ('string', '0\x001')
-  define)
-('symbol', '1')
-define)
+  ('string', '0\x001'))
+('symbol', '1'))
   0
 
   $ hg debugrevspec -p unknown '0'
@@ -733,18 +711,16 @@
   (and
 (func
   ('symbol', 'r3232')
-  None
-  define)
-('symbol', '2')
-define)
+  None)
+('symbol', '2'))
   * optimized:
-  (and
-('symbol', '2')
-(func
-  ('symbol', 'r3232')
-  None
-  define)
-define)
+  (func
+('symbol', '_flipand')
+(list
+  ('symbol', '2')
+  (func
+('symbol', 'r3232')
+None)))
   * analyzed set:
   
   * optimized set:
@@ -776,8 +752,7 @@
 None)
   * analyzed:
   (rangeall
-None
-define)
+None)
   * set:
   
   0
@@ -793,8 +768,7 @@
   $ try -p analyzed ':1'
   * analyzed:
   (rangepre
-('symbol', '1')
-define)
+('symbol', '1'))
   * set:
   
   0
@@ -805,9 +779,7 @@
 (or
   (list
 ('symbol', '1')
-('symbol', '2'))
-  define)
-define)
+('symbol', '2'
   * set:
   
   0
@@ -818,9 +790,7 @@
   (rangepre
 (and
   ('symbol', '1')
-  ('symbol', '2')
-  define)
-define)
+  ('symbol', '2')))
   * set:
   
 
@@ -1643,11 +1613,8 @@
 (difference
   (range
 ('symbol', '8')
-('symbol', '9')
-define)
-  ('symbol', '8')
-  define)
-define)
+('symbol', '9'))
+  ('symbol', '8')))
   * set:
   
   8
@@ -1663,8 +1630,7 @@
 ('symbol', 'only')
 (list
   ('symbol', '9')
-  ('symbol', '5'))
-define)
+  ('symbol', '5')))
   * set:
   
   2
@@ -1999,18 +1965,13 @@
 (and
   (range
 ('symbol', '3')
-('symbol', '0')
-

D451: [RFC] revset: remove order information from tree

2017-08-19 Thread quark (Jun Wu)
quark added inline comments.

INLINE COMMENTS

> test-revset.t:2893
>  ,
> ->
> +>
>0

This is caused by `fullreposet` having a default order. If we remove that, it 
would be optimized to `` here.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D451

To: quark, #hg-reviewers
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D451: [RFC] revset: remove order information from tree

2017-08-19 Thread quark (Jun Wu)
quark updated this revision to Diff 1095.
quark edited the summary of this revision.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D451?vs=1094=1095

REVISION DETAIL
  https://phab.mercurial-scm.org/D451

AFFECTED FILES
  mercurial/revset.py
  mercurial/revsetlang.py
  tests/test-revset.t

CHANGE DETAILS

diff --git a/tests/test-revset.t b/tests/test-revset.t
--- a/tests/test-revset.t
+++ b/tests/test-revset.t
@@ -166,8 +166,7 @@
 None)
   * optimized:
   (rangeall
-None
-define)
+None)
   * set:
   
   0
@@ -495,8 +494,7 @@
 ('symbol', 'foo')
 (func
   ('symbol', '_notpublic')
-  None
-  any))
+  None))
   hg: parse error: can't use a key-value pair in this context
   [255]
 
@@ -538,52 +536,43 @@
 (not
   (func
 ('symbol', 'public')
-None
-any)
-  define)
+None))
 ('symbol', 'generations')
-('symbol', '0')
-define)
+('symbol', '0'))
   * optimized:
   (relsubscript
 (func
   ('symbol', '_notpublic')
-  None
-  any)
+  None)
 ('symbol', 'generations')
-('symbol', '0')
-define)
+('symbol', '0'))
 
 resolution of subscript and relation-subscript ternary operators:
 
   $ hg debugrevspec -p analyzed 'tip[0]'
   * analyzed:
   (subscript
 ('symbol', 'tip')
-('symbol', '0')
-define)
+('symbol', '0'))
   hg: parse error: can't use a subscript in this context
   [255]
 
   $ hg debugrevspec -p analyzed 'tip#rel[0]'
   * analyzed:
   (relsubscript
 ('symbol', 'tip')
 ('symbol', 'rel')
-('symbol', '0')
-define)
+('symbol', '0'))
   hg: parse error: unknown identifier: rel
   [255]
 
   $ hg debugrevspec -p analyzed '(tip#rel)[0]'
   * analyzed:
   (subscript
 (relation
   ('symbol', 'tip')
-  ('symbol', 'rel')
-  define)
-('symbol', '0')
-define)
+  ('symbol', 'rel'))
+('symbol', '0'))
   hg: parse error: can't use a subscript in this context
   [255]
 
@@ -593,23 +582,19 @@
 (relsubscript
   ('symbol', 'tip')
   ('symbol', 'rel')
-  ('symbol', '0')
-  define)
-('symbol', '1')
-define)
+  ('symbol', '0'))
+('symbol', '1'))
   hg: parse error: can't use a subscript in this context
   [255]
 
   $ hg debugrevspec -p analyzed 'tip#rel0#rel1[1]'
   * analyzed:
   (relsubscript
 (relation
   ('symbol', 'tip')
-  ('symbol', 'rel0')
-  define)
+  ('symbol', 'rel0'))
 ('symbol', 'rel1')
-('symbol', '1')
-define)
+('symbol', '1'))
   hg: parse error: unknown identifier: rel1
   [255]
 
@@ -619,11 +604,9 @@
 (relsubscript
   ('symbol', 'tip')
   ('symbol', 'rel0')
-  ('symbol', '0')
-  define)
+  ('symbol', '0'))
 ('symbol', 'rel1')
-('symbol', '1')
-define)
+('symbol', '1'))
   hg: parse error: unknown identifier: rel1
   [255]
 
@@ -700,20 +683,15 @@
 (or
   (list
 ('symbol', '0')
-('symbol', '1'))
-  define)
+('symbol', '1')))
 (not
-  ('symbol', '1')
-  follow)
-define)
+  ('symbol', '1')))
   * optimized:
   (difference
 (func
   ('symbol', '_list')
-  ('string', '0\x001')
-  define)
-('symbol', '1')
-define)
+  ('string', '0\x001'))
+('symbol', '1'))
   0
 
   $ hg debugrevspec -p unknown '0'
@@ -733,18 +711,16 @@
   (and
 (func
   ('symbol', 'r3232')
-  None
-  define)
-('symbol', '2')
-define)
+  None)
+('symbol', '2'))
   * optimized:
-  (and
-('symbol', '2')
-(func
-  ('symbol', 'r3232')
-  None
-  define)
-define)
+  (func
+('symbol', '_flipand')
+(list
+  ('symbol', '2')
+  (func
+('symbol', 'r3232')
+None)))
   * analyzed set:
   
   * optimized set:
@@ -776,8 +752,7 @@
 None)
   * analyzed:
   (rangeall
-None
-define)
+None)
   * set:
   
   0
@@ -793,8 +768,7 @@
   $ try -p analyzed ':1'
   * analyzed:
   (rangepre
-('symbol', '1')
-define)
+('symbol', '1'))
   * set:
   
   0
@@ -805,9 +779,7 @@
 (or
   (list
 ('symbol', '1')
-('symbol', '2'))
-  define)
-define)
+('symbol', '2'
   * set:
   
   0
@@ -818,9 +790,7 @@
   (rangepre
 (and
   ('symbol', '1')
-  ('symbol', '2')
-  define)
-define)
+  ('symbol', '2')))
   * set:
   
 
@@ -1643,11 +1613,8 @@
 (difference
   (range
 ('symbol', '8')
-('symbol', '9')
-define)
-  ('symbol', '8')
-  define)
-define)
+('symbol', '9'))
+  ('symbol', '8')))
   * set:
   
   8
@@ -1663,8 +1630,7 @@
 ('symbol', 'only')
 (list
   ('symbol', '9')
-  ('symbol', '5'))
-define)
+  ('symbol', '5')))
   * set:
   
   2
@@ -1999,18 +1965,13 @@
 (and
   (range
 ('symbol', 

D451: [RFC] revset: remove order information from tree

2017-08-19 Thread quark (Jun Wu)
quark updated this revision to Diff 1094.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D451?vs=1093=1094

REVISION DETAIL
  https://phab.mercurial-scm.org/D451

AFFECTED FILES
  mercurial/revset.py
  mercurial/revsetlang.py
  tests/test-revset.t

CHANGE DETAILS

diff --git a/tests/test-revset.t b/tests/test-revset.t
--- a/tests/test-revset.t
+++ b/tests/test-revset.t
@@ -166,8 +166,7 @@
 None)
   * optimized:
   (rangeall
-None
-define)
+None)
   * set:
   
   0
@@ -495,8 +494,7 @@
 ('symbol', 'foo')
 (func
   ('symbol', '_notpublic')
-  None
-  any))
+  None))
   hg: parse error: can't use a key-value pair in this context
   [255]
 
@@ -538,52 +536,43 @@
 (not
   (func
 ('symbol', 'public')
-None
-any)
-  define)
+None))
 ('symbol', 'generations')
-('symbol', '0')
-define)
+('symbol', '0'))
   * optimized:
   (relsubscript
 (func
   ('symbol', '_notpublic')
-  None
-  any)
+  None)
 ('symbol', 'generations')
-('symbol', '0')
-define)
+('symbol', '0'))
 
 resolution of subscript and relation-subscript ternary operators:
 
   $ hg debugrevspec -p analyzed 'tip[0]'
   * analyzed:
   (subscript
 ('symbol', 'tip')
-('symbol', '0')
-define)
+('symbol', '0'))
   hg: parse error: can't use a subscript in this context
   [255]
 
   $ hg debugrevspec -p analyzed 'tip#rel[0]'
   * analyzed:
   (relsubscript
 ('symbol', 'tip')
 ('symbol', 'rel')
-('symbol', '0')
-define)
+('symbol', '0'))
   hg: parse error: unknown identifier: rel
   [255]
 
   $ hg debugrevspec -p analyzed '(tip#rel)[0]'
   * analyzed:
   (subscript
 (relation
   ('symbol', 'tip')
-  ('symbol', 'rel')
-  define)
-('symbol', '0')
-define)
+  ('symbol', 'rel'))
+('symbol', '0'))
   hg: parse error: can't use a subscript in this context
   [255]
 
@@ -593,23 +582,19 @@
 (relsubscript
   ('symbol', 'tip')
   ('symbol', 'rel')
-  ('symbol', '0')
-  define)
-('symbol', '1')
-define)
+  ('symbol', '0'))
+('symbol', '1'))
   hg: parse error: can't use a subscript in this context
   [255]
 
   $ hg debugrevspec -p analyzed 'tip#rel0#rel1[1]'
   * analyzed:
   (relsubscript
 (relation
   ('symbol', 'tip')
-  ('symbol', 'rel0')
-  define)
+  ('symbol', 'rel0'))
 ('symbol', 'rel1')
-('symbol', '1')
-define)
+('symbol', '1'))
   hg: parse error: unknown identifier: rel1
   [255]
 
@@ -619,11 +604,9 @@
 (relsubscript
   ('symbol', 'tip')
   ('symbol', 'rel0')
-  ('symbol', '0')
-  define)
+  ('symbol', '0'))
 ('symbol', 'rel1')
-('symbol', '1')
-define)
+('symbol', '1'))
   hg: parse error: unknown identifier: rel1
   [255]
 
@@ -700,20 +683,15 @@
 (or
   (list
 ('symbol', '0')
-('symbol', '1'))
-  define)
+('symbol', '1')))
 (not
-  ('symbol', '1')
-  follow)
-define)
+  ('symbol', '1')))
   * optimized:
   (difference
 (func
   ('symbol', '_list')
-  ('string', '0\x001')
-  define)
-('symbol', '1')
-define)
+  ('string', '0\x001'))
+('symbol', '1'))
   0
 
   $ hg debugrevspec -p unknown '0'
@@ -733,27 +711,18 @@
   (and
 (func
   ('symbol', 'r3232')
-  None
-  define)
-('symbol', '2')
-define)
+  None)
+('symbol', '2'))
   * optimized:
   (and
-('symbol', '2')
 (func
   ('symbol', 'r3232')
-  None
-  define)
-define)
+  None)
+('symbol', '2'))
   * analyzed set:
   
   * optimized set:
-  
-  --- analyzed
-  +++ optimized
-   2
-  +2
-  [1]
+  
 
   $ hg debugrevspec --no-optimized --verify-optimized '0'
   abort: cannot use --verify-optimized with --no-optimized
@@ -776,8 +745,7 @@
 None)
   * analyzed:
   (rangeall
-None
-define)
+None)
   * set:
   
   0
@@ -793,8 +761,7 @@
   $ try -p analyzed ':1'
   * analyzed:
   (rangepre
-('symbol', '1')
-define)
+('symbol', '1'))
   * set:
   
   0
@@ -805,9 +772,7 @@
 (or
   (list
 ('symbol', '1')
-('symbol', '2'))
-  define)
-define)
+('symbol', '2'
   * set:
   
   0
@@ -818,9 +783,7 @@
   (rangepre
 (and
   ('symbol', '1')
-  ('symbol', '2')
-  define)
-define)
+  ('symbol', '2')))
   * set:
   
 
@@ -1643,11 +1606,8 @@
 (difference
   (range
 ('symbol', '8')
-('symbol', '9')
-define)
-  ('symbol', '8')
-  define)
-define)
+('symbol', '9'))
+  ('symbol', '8')))
   * set:
   
   8
@@ -1663,8 +1623,7 @@
 ('symbol', 'only')
 (list
   ('symbol', '9')
-  ('symbol', '5'))
-define)
+  ('symbol', '5')))
   * set:
   
   2
@@ -1999,18 +1958,13 @@

D451: [RFC] revset: remove order information from tree

2017-08-19 Thread quark (Jun Wu)
quark updated this revision to Diff 1093.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D451?vs=1092=1093

REVISION DETAIL
  https://phab.mercurial-scm.org/D451

AFFECTED FILES
  mercurial/revset.py
  mercurial/revsetlang.py
  tests/test-revset.t

CHANGE DETAILS

diff --git a/tests/test-revset.t b/tests/test-revset.t
--- a/tests/test-revset.t
+++ b/tests/test-revset.t
@@ -166,8 +166,7 @@
 None)
   * optimized:
   (rangeall
-None
-define)
+None)
   * set:
   
   0
@@ -495,8 +494,7 @@
 ('symbol', 'foo')
 (func
   ('symbol', '_notpublic')
-  None
-  any))
+  None))
   hg: parse error: can't use a key-value pair in this context
   [255]
 
@@ -538,52 +536,43 @@
 (not
   (func
 ('symbol', 'public')
-None
-any)
-  define)
+None))
 ('symbol', 'generations')
-('symbol', '0')
-define)
+('symbol', '0'))
   * optimized:
   (relsubscript
 (func
   ('symbol', '_notpublic')
-  None
-  any)
+  None)
 ('symbol', 'generations')
-('symbol', '0')
-define)
+('symbol', '0'))
 
 resolution of subscript and relation-subscript ternary operators:
 
   $ hg debugrevspec -p analyzed 'tip[0]'
   * analyzed:
   (subscript
 ('symbol', 'tip')
-('symbol', '0')
-define)
+('symbol', '0'))
   hg: parse error: can't use a subscript in this context
   [255]
 
   $ hg debugrevspec -p analyzed 'tip#rel[0]'
   * analyzed:
   (relsubscript
 ('symbol', 'tip')
 ('symbol', 'rel')
-('symbol', '0')
-define)
+('symbol', '0'))
   hg: parse error: unknown identifier: rel
   [255]
 
   $ hg debugrevspec -p analyzed '(tip#rel)[0]'
   * analyzed:
   (subscript
 (relation
   ('symbol', 'tip')
-  ('symbol', 'rel')
-  define)
-('symbol', '0')
-define)
+  ('symbol', 'rel'))
+('symbol', '0'))
   hg: parse error: can't use a subscript in this context
   [255]
 
@@ -593,23 +582,19 @@
 (relsubscript
   ('symbol', 'tip')
   ('symbol', 'rel')
-  ('symbol', '0')
-  define)
-('symbol', '1')
-define)
+  ('symbol', '0'))
+('symbol', '1'))
   hg: parse error: can't use a subscript in this context
   [255]
 
   $ hg debugrevspec -p analyzed 'tip#rel0#rel1[1]'
   * analyzed:
   (relsubscript
 (relation
   ('symbol', 'tip')
-  ('symbol', 'rel0')
-  define)
+  ('symbol', 'rel0'))
 ('symbol', 'rel1')
-('symbol', '1')
-define)
+('symbol', '1'))
   hg: parse error: unknown identifier: rel1
   [255]
 
@@ -619,11 +604,9 @@
 (relsubscript
   ('symbol', 'tip')
   ('symbol', 'rel0')
-  ('symbol', '0')
-  define)
+  ('symbol', '0'))
 ('symbol', 'rel1')
-('symbol', '1')
-define)
+('symbol', '1'))
   hg: parse error: unknown identifier: rel1
   [255]
 
@@ -700,20 +683,15 @@
 (or
   (list
 ('symbol', '0')
-('symbol', '1'))
-  define)
+('symbol', '1')))
 (not
-  ('symbol', '1')
-  follow)
-define)
+  ('symbol', '1')))
   * optimized:
   (difference
 (func
   ('symbol', '_list')
-  ('string', '0\x001')
-  define)
-('symbol', '1')
-define)
+  ('string', '0\x001'))
+('symbol', '1'))
   0
 
   $ hg debugrevspec -p unknown '0'
@@ -733,27 +711,18 @@
   (and
 (func
   ('symbol', 'r3232')
-  None
-  define)
-('symbol', '2')
-define)
+  None)
+('symbol', '2'))
   * optimized:
   (and
-('symbol', '2')
 (func
   ('symbol', 'r3232')
-  None
-  define)
-define)
+  None)
+('symbol', '2'))
   * analyzed set:
   
   * optimized set:
-  
-  --- analyzed
-  +++ optimized
-   2
-  +2
-  [1]
+  
 
   $ hg debugrevspec --no-optimized --verify-optimized '0'
   abort: cannot use --verify-optimized with --no-optimized
@@ -776,8 +745,7 @@
 None)
   * analyzed:
   (rangeall
-None
-define)
+None)
   * set:
   
   0
@@ -793,8 +761,7 @@
   $ try -p analyzed ':1'
   * analyzed:
   (rangepre
-('symbol', '1')
-define)
+('symbol', '1'))
   * set:
   
   0
@@ -805,9 +772,7 @@
 (or
   (list
 ('symbol', '1')
-('symbol', '2'))
-  define)
-define)
+('symbol', '2'
   * set:
   
   0
@@ -818,9 +783,7 @@
   (rangepre
 (and
   ('symbol', '1')
-  ('symbol', '2')
-  define)
-define)
+  ('symbol', '2')))
   * set:
   
 
@@ -1643,11 +1606,8 @@
 (difference
   (range
 ('symbol', '8')
-('symbol', '9')
-define)
-  ('symbol', '8')
-  define)
-define)
+('symbol', '9'))
+  ('symbol', '8')))
   * set:
   
   8
@@ -1663,8 +1623,7 @@
 ('symbol', 'only')
 (list
   ('symbol', '9')
-  ('symbol', '5'))
-define)
+  ('symbol', '5')))
   * set:
   
   2
@@ -1999,18 +1958,13 @@

D451: [RFC] revset: remove order information from tree

2017-08-19 Thread quark (Jun Wu)
quark updated this revision to Diff 1092.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D451?vs=1091=1092

REVISION DETAIL
  https://phab.mercurial-scm.org/D451

AFFECTED FILES
  mercurial/revset.py
  mercurial/revsetlang.py
  tests/test-revset.t

CHANGE DETAILS

diff --git a/tests/test-revset.t b/tests/test-revset.t
--- a/tests/test-revset.t
+++ b/tests/test-revset.t
@@ -166,8 +166,7 @@
 None)
   * optimized:
   (rangeall
-None
-define)
+None)
   * set:
   
   0
@@ -495,8 +494,7 @@
 ('symbol', 'foo')
 (func
   ('symbol', '_notpublic')
-  None
-  any))
+  None))
   hg: parse error: can't use a key-value pair in this context
   [255]
 
@@ -538,52 +536,43 @@
 (not
   (func
 ('symbol', 'public')
-None
-any)
-  define)
+None))
 ('symbol', 'generations')
-('symbol', '0')
-define)
+('symbol', '0'))
   * optimized:
   (relsubscript
 (func
   ('symbol', '_notpublic')
-  None
-  any)
+  None)
 ('symbol', 'generations')
-('symbol', '0')
-define)
+('symbol', '0'))
 
 resolution of subscript and relation-subscript ternary operators:
 
   $ hg debugrevspec -p analyzed 'tip[0]'
   * analyzed:
   (subscript
 ('symbol', 'tip')
-('symbol', '0')
-define)
+('symbol', '0'))
   hg: parse error: can't use a subscript in this context
   [255]
 
   $ hg debugrevspec -p analyzed 'tip#rel[0]'
   * analyzed:
   (relsubscript
 ('symbol', 'tip')
 ('symbol', 'rel')
-('symbol', '0')
-define)
+('symbol', '0'))
   hg: parse error: unknown identifier: rel
   [255]
 
   $ hg debugrevspec -p analyzed '(tip#rel)[0]'
   * analyzed:
   (subscript
 (relation
   ('symbol', 'tip')
-  ('symbol', 'rel')
-  define)
-('symbol', '0')
-define)
+  ('symbol', 'rel'))
+('symbol', '0'))
   hg: parse error: can't use a subscript in this context
   [255]
 
@@ -593,23 +582,19 @@
 (relsubscript
   ('symbol', 'tip')
   ('symbol', 'rel')
-  ('symbol', '0')
-  define)
-('symbol', '1')
-define)
+  ('symbol', '0'))
+('symbol', '1'))
   hg: parse error: can't use a subscript in this context
   [255]
 
   $ hg debugrevspec -p analyzed 'tip#rel0#rel1[1]'
   * analyzed:
   (relsubscript
 (relation
   ('symbol', 'tip')
-  ('symbol', 'rel0')
-  define)
+  ('symbol', 'rel0'))
 ('symbol', 'rel1')
-('symbol', '1')
-define)
+('symbol', '1'))
   hg: parse error: unknown identifier: rel1
   [255]
 
@@ -619,11 +604,9 @@
 (relsubscript
   ('symbol', 'tip')
   ('symbol', 'rel0')
-  ('symbol', '0')
-  define)
+  ('symbol', '0'))
 ('symbol', 'rel1')
-('symbol', '1')
-define)
+('symbol', '1'))
   hg: parse error: unknown identifier: rel1
   [255]
 
@@ -700,20 +683,15 @@
 (or
   (list
 ('symbol', '0')
-('symbol', '1'))
-  define)
+('symbol', '1')))
 (not
-  ('symbol', '1')
-  follow)
-define)
+  ('symbol', '1')))
   * optimized:
   (difference
 (func
   ('symbol', '_list')
-  ('string', '0\x001')
-  define)
-('symbol', '1')
-define)
+  ('string', '0\x001'))
+('symbol', '1'))
   0
 
   $ hg debugrevspec -p unknown '0'
@@ -733,27 +711,18 @@
   (and
 (func
   ('symbol', 'r3232')
-  None
-  define)
-('symbol', '2')
-define)
+  None)
+('symbol', '2'))
   * optimized:
   (and
-('symbol', '2')
 (func
   ('symbol', 'r3232')
-  None
-  define)
-define)
+  None)
+('symbol', '2'))
   * analyzed set:
   
   * optimized set:
-  
-  --- analyzed
-  +++ optimized
-   2
-  +2
-  [1]
+  
 
   $ hg debugrevspec --no-optimized --verify-optimized '0'
   abort: cannot use --verify-optimized with --no-optimized
@@ -776,8 +745,7 @@
 None)
   * analyzed:
   (rangeall
-None
-define)
+None)
   * set:
   
   0
@@ -793,8 +761,7 @@
   $ try -p analyzed ':1'
   * analyzed:
   (rangepre
-('symbol', '1')
-define)
+('symbol', '1'))
   * set:
   
   0
@@ -805,9 +772,7 @@
 (or
   (list
 ('symbol', '1')
-('symbol', '2'))
-  define)
-define)
+('symbol', '2'
   * set:
   
   0
@@ -818,9 +783,7 @@
   (rangepre
 (and
   ('symbol', '1')
-  ('symbol', '2')
-  define)
-define)
+  ('symbol', '2')))
   * set:
   
 
@@ -1643,11 +1606,8 @@
 (difference
   (range
 ('symbol', '8')
-('symbol', '9')
-define)
-  ('symbol', '8')
-  define)
-define)
+('symbol', '9'))
+  ('symbol', '8')))
   * set:
   
   8
@@ -1663,8 +1623,7 @@
 ('symbol', 'only')
 (list
   ('symbol', '9')
-  ('symbol', '5'))
-define)
+  ('symbol', '5')))
   * set:
   
   2
@@ -1999,18 +1958,13 @@

D451: [RFC] revset: remove order information from tree

2017-08-19 Thread quark (Jun Wu)
quark added a subscriber: yuja.
quark added a comment.


  @yuja Let me know if this can simplify `matchtree`, `buildtree` 
implementation.

INLINE COMMENTS

> test-revset.t:2502
>  
>$ try -p optimized '(reverse(contains("a")) + 2) & 0:2'
>* optimized:

The new code is less efficient here. I guess we it might be solvable by having 
a `_reverseand` operator that `_optimize` may use.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D451

To: quark, #hg-reviewers
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D451: [RFC] revset: remove order information from tree

2017-08-19 Thread quark (Jun Wu)
quark updated this revision to Diff 1091.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D451?vs=1090=1091

REVISION DETAIL
  https://phab.mercurial-scm.org/D451

AFFECTED FILES
  mercurial/revset.py
  mercurial/revsetlang.py
  tests/test-revset.t

CHANGE DETAILS

diff --git a/tests/test-revset.t b/tests/test-revset.t
--- a/tests/test-revset.t
+++ b/tests/test-revset.t
@@ -166,8 +166,7 @@
 None)
   * optimized:
   (rangeall
-None
-define)
+None)
   * set:
   
   0
@@ -495,8 +494,7 @@
 ('symbol', 'foo')
 (func
   ('symbol', '_notpublic')
-  None
-  any))
+  None))
   hg: parse error: can't use a key-value pair in this context
   [255]
 
@@ -538,52 +536,43 @@
 (not
   (func
 ('symbol', 'public')
-None
-any)
-  define)
+None))
 ('symbol', 'generations')
-('symbol', '0')
-define)
+('symbol', '0'))
   * optimized:
   (relsubscript
 (func
   ('symbol', '_notpublic')
-  None
-  any)
+  None)
 ('symbol', 'generations')
-('symbol', '0')
-define)
+('symbol', '0'))
 
 resolution of subscript and relation-subscript ternary operators:
 
   $ hg debugrevspec -p analyzed 'tip[0]'
   * analyzed:
   (subscript
 ('symbol', 'tip')
-('symbol', '0')
-define)
+('symbol', '0'))
   hg: parse error: can't use a subscript in this context
   [255]
 
   $ hg debugrevspec -p analyzed 'tip#rel[0]'
   * analyzed:
   (relsubscript
 ('symbol', 'tip')
 ('symbol', 'rel')
-('symbol', '0')
-define)
+('symbol', '0'))
   hg: parse error: unknown identifier: rel
   [255]
 
   $ hg debugrevspec -p analyzed '(tip#rel)[0]'
   * analyzed:
   (subscript
 (relation
   ('symbol', 'tip')
-  ('symbol', 'rel')
-  define)
-('symbol', '0')
-define)
+  ('symbol', 'rel'))
+('symbol', '0'))
   hg: parse error: can't use a subscript in this context
   [255]
 
@@ -593,23 +582,19 @@
 (relsubscript
   ('symbol', 'tip')
   ('symbol', 'rel')
-  ('symbol', '0')
-  define)
-('symbol', '1')
-define)
+  ('symbol', '0'))
+('symbol', '1'))
   hg: parse error: can't use a subscript in this context
   [255]
 
   $ hg debugrevspec -p analyzed 'tip#rel0#rel1[1]'
   * analyzed:
   (relsubscript
 (relation
   ('symbol', 'tip')
-  ('symbol', 'rel0')
-  define)
+  ('symbol', 'rel0'))
 ('symbol', 'rel1')
-('symbol', '1')
-define)
+('symbol', '1'))
   hg: parse error: unknown identifier: rel1
   [255]
 
@@ -619,11 +604,9 @@
 (relsubscript
   ('symbol', 'tip')
   ('symbol', 'rel0')
-  ('symbol', '0')
-  define)
+  ('symbol', '0'))
 ('symbol', 'rel1')
-('symbol', '1')
-define)
+('symbol', '1'))
   hg: parse error: unknown identifier: rel1
   [255]
 
@@ -700,20 +683,15 @@
 (or
   (list
 ('symbol', '0')
-('symbol', '1'))
-  define)
+('symbol', '1')))
 (not
-  ('symbol', '1')
-  follow)
-define)
+  ('symbol', '1')))
   * optimized:
   (difference
 (func
   ('symbol', '_list')
-  ('string', '0\x001')
-  define)
-('symbol', '1')
-define)
+  ('string', '0\x001'))
+('symbol', '1'))
   0
 
   $ hg debugrevspec -p unknown '0'
@@ -733,27 +711,18 @@
   (and
 (func
   ('symbol', 'r3232')
-  None
-  define)
-('symbol', '2')
-define)
+  None)
+('symbol', '2'))
   * optimized:
   (and
-('symbol', '2')
 (func
   ('symbol', 'r3232')
-  None
-  define)
-define)
+  None)
+('symbol', '2'))
   * analyzed set:
   
   * optimized set:
-  
-  --- analyzed
-  +++ optimized
-   2
-  +2
-  [1]
+  
 
   $ hg debugrevspec --no-optimized --verify-optimized '0'
   abort: cannot use --verify-optimized with --no-optimized
@@ -776,8 +745,7 @@
 None)
   * analyzed:
   (rangeall
-None
-define)
+None)
   * set:
   
   0
@@ -793,8 +761,7 @@
   $ try -p analyzed ':1'
   * analyzed:
   (rangepre
-('symbol', '1')
-define)
+('symbol', '1'))
   * set:
   
   0
@@ -805,9 +772,7 @@
 (or
   (list
 ('symbol', '1')
-('symbol', '2'))
-  define)
-define)
+('symbol', '2'
   * set:
   
   0
@@ -818,9 +783,7 @@
   (rangepre
 (and
   ('symbol', '1')
-  ('symbol', '2')
-  define)
-define)
+  ('symbol', '2')))
   * set:
   
 
@@ -1643,11 +1606,8 @@
 (difference
   (range
 ('symbol', '8')
-('symbol', '9')
-define)
-  ('symbol', '8')
-  define)
-define)
+('symbol', '9'))
+  ('symbol', '8')))
   * set:
   
   8
@@ -1663,8 +1623,7 @@
 ('symbol', 'only')
 (list
   ('symbol', '9')
-  ('symbol', '5'))
-define)
+  ('symbol', '5')))
   * set:
   
   2
@@ -1999,18 +1958,13 @@

D378: contrib: make simplemerge script pass context-like objects

2017-08-19 Thread phillco (Phil Cohen)
phillco added a subscriber: martinvonz.
phillco added inline comments.

INLINE COMMENTS

> simplemerge:44-63
> +class filebackedctx(object):
> +"""simplemerge requires context-like objects"""
> +def __init__(self, path):
> +self._path = path
> +
> +def decodeddata(self):
> +with open(self._path, "rb") as f:

As @martinvonz noted this could probably be combined with the 
`arbitraryfilectx` I made in 
https://bitbucket.org/phillco/hg-imm/commits/0cc65baa328bbba84629aeb4708ee2fa765a50f0.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D378

To: phillco, #hg-reviewers
Cc: martinvonz, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D374: simplemerge: use contexts to read file data from, if passed

2017-08-19 Thread phillco (Phil Cohen)
phillco added inline comments.

INLINE COMMENTS

> martinvonz wrote in simplemerge.py:430
> What is this "post-filter data"? I didn't know hg had this feature. Something 
> like git' clean/smudge filters?

Yeah, exactly. I didn't know about it either. 
https://www.mercurial-scm.org/wiki/EncodeDecodeFilter?highlight=%28filter%29

Perhaps including that link in the comment, or in `wwritedata` (later, 
`decodeddata()`) might be a good idea.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D374

To: phillco, #hg-reviewers
Cc: martinvonz, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D372: simplemerge: add optional context parameters to simplemerge

2017-08-19 Thread phillco (Phil Cohen)
phillco added inline comments.

INLINE COMMENTS

> martinvonz wrote in simplemerge.py:412
> Seems unfortunate to have both files and contexts. This is what you mentioned 
> today you will replace by use of "arbitraryfilectx"?

They get taken out in https://phab.mercurial-scm.org/D381; they have to 
co-exist briefly in order to ensure each step of this series can be applied 
cleanly.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D372

To: phillco, #hg-reviewers
Cc: martinvonz, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D441: revset: optimize "draft() & ::x" pattern

2017-08-19 Thread quark (Jun Wu)
quark added inline comments.

INLINE COMMENTS

> yuja wrote in revsetlang.py:492
> I'll rebase my patches then. I'm sure that isn't trivial because I introduced 
> the order flag.

Maybe `order` could be removed from AST since they can be inferred during tree 
traversal? I have a draft https://phab.mercurial-scm.org/D451 that verifies the 
idea.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D441

To: quark, #hg-reviewers
Cc: yuja, martinvonz, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D376: filemerge: extract `_picklabels` as a helper function

2017-08-19 Thread phillco (Phil Cohen)
phillco added inline comments.

INLINE COMMENTS

> martinvonz wrote in simplemerge.py:411-423
>   def _picklabels(defaults, overrides):
> if len(overrides) > 3:
>   raise error.Abort(_("can only specify three labels."))
> result = defaults[:]
> for i, override in enumerate(overrides):
>   result[i] = override
> return result
> 
> no?

I think so, not sure why the original was so weird. I'll replace it.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D376

To: phillco, #hg-reviewers
Cc: martinvonz, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D451: [RFC] revset: remove order information from tree

2017-08-19 Thread quark (Jun Wu)
quark created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Keeping `order` in tree makes AST operation harder. And there could be
  certain invalid cases, like:
  
A(order=define) | B(order=define)
  ^^ couldn't be satisfied
  
  This patch changes the code to calculate order on the fly, during tree
  traversal.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D451

AFFECTED FILES
  mercurial/revset.py
  mercurial/revsetlang.py
  tests/test-revset.t

CHANGE DETAILS

diff --git a/tests/test-revset.t b/tests/test-revset.t
--- a/tests/test-revset.t
+++ b/tests/test-revset.t
@@ -166,8 +166,7 @@
 None)
   * optimized:
   (rangeall
-None
-define)
+None)
   * set:
   
   0
@@ -495,8 +494,7 @@
 ('symbol', 'foo')
 (func
   ('symbol', '_notpublic')
-  None
-  any))
+  None))
   hg: parse error: can't use a key-value pair in this context
   [255]
 
@@ -538,52 +536,43 @@
 (not
   (func
 ('symbol', 'public')
-None
-any)
-  define)
+None))
 ('symbol', 'generations')
-('symbol', '0')
-define)
+('symbol', '0'))
   * optimized:
   (relsubscript
 (func
   ('symbol', '_notpublic')
-  None
-  any)
+  None)
 ('symbol', 'generations')
-('symbol', '0')
-define)
+('symbol', '0'))
 
 resolution of subscript and relation-subscript ternary operators:
 
   $ hg debugrevspec -p analyzed 'tip[0]'
   * analyzed:
   (subscript
 ('symbol', 'tip')
-('symbol', '0')
-define)
+('symbol', '0'))
   hg: parse error: can't use a subscript in this context
   [255]
 
   $ hg debugrevspec -p analyzed 'tip#rel[0]'
   * analyzed:
   (relsubscript
 ('symbol', 'tip')
 ('symbol', 'rel')
-('symbol', '0')
-define)
+('symbol', '0'))
   hg: parse error: unknown identifier: rel
   [255]
 
   $ hg debugrevspec -p analyzed '(tip#rel)[0]'
   * analyzed:
   (subscript
 (relation
   ('symbol', 'tip')
-  ('symbol', 'rel')
-  define)
-('symbol', '0')
-define)
+  ('symbol', 'rel'))
+('symbol', '0'))
   hg: parse error: can't use a subscript in this context
   [255]
 
@@ -593,23 +582,19 @@
 (relsubscript
   ('symbol', 'tip')
   ('symbol', 'rel')
-  ('symbol', '0')
-  define)
-('symbol', '1')
-define)
+  ('symbol', '0'))
+('symbol', '1'))
   hg: parse error: can't use a subscript in this context
   [255]
 
   $ hg debugrevspec -p analyzed 'tip#rel0#rel1[1]'
   * analyzed:
   (relsubscript
 (relation
   ('symbol', 'tip')
-  ('symbol', 'rel0')
-  define)
+  ('symbol', 'rel0'))
 ('symbol', 'rel1')
-('symbol', '1')
-define)
+('symbol', '1'))
   hg: parse error: unknown identifier: rel1
   [255]
 
@@ -619,11 +604,9 @@
 (relsubscript
   ('symbol', 'tip')
   ('symbol', 'rel0')
-  ('symbol', '0')
-  define)
+  ('symbol', '0'))
 ('symbol', 'rel1')
-('symbol', '1')
-define)
+('symbol', '1'))
   hg: parse error: unknown identifier: rel1
   [255]
 
@@ -700,20 +683,15 @@
 (or
   (list
 ('symbol', '0')
-('symbol', '1'))
-  define)
+('symbol', '1')))
 (not
-  ('symbol', '1')
-  follow)
-define)
+  ('symbol', '1')))
   * optimized:
   (difference
 (func
   ('symbol', '_list')
-  ('string', '0\x001')
-  define)
-('symbol', '1')
-define)
+  ('string', '0\x001'))
+('symbol', '1'))
   0
 
   $ hg debugrevspec -p unknown '0'
@@ -733,27 +711,18 @@
   (and
 (func
   ('symbol', 'r3232')
-  None
-  define)
-('symbol', '2')
-define)
+  None)
+('symbol', '2'))
   * optimized:
   (and
-('symbol', '2')
 (func
   ('symbol', 'r3232')
-  None
-  define)
-define)
+  None)
+('symbol', '2'))
   * analyzed set:
   
   * optimized set:
-  
-  --- analyzed
-  +++ optimized
-   2
-  +2
-  [1]
+  
 
   $ hg debugrevspec --no-optimized --verify-optimized '0'
   abort: cannot use --verify-optimized with --no-optimized
@@ -776,8 +745,7 @@
 None)
   * analyzed:
   (rangeall
-None
-define)
+None)
   * set:
   
   0
@@ -793,8 +761,7 @@
   $ try -p analyzed ':1'
   * analyzed:
   (rangepre
-('symbol', '1')
-define)
+('symbol', '1'))
   * set:
   
   0
@@ -805,9 +772,7 @@
 (or
   (list
 ('symbol', '1')
-('symbol', '2'))
-  define)
-define)
+('symbol', '2'
   * set:
   
   0
@@ -818,9 +783,7 @@
   (rangepre
 (and
   ('symbol', '1')
-  ('symbol', '2')
-  define)
-define)
+  ('symbol', '2')))
   * set:
   
 
@@ -1643,11 +1606,8 @@
 (difference
   (range
 ('symbol', '8')
-('symbol', '9')
-define)
-  ('symbol', '8')
-  define)
-

D447: templatekw: choose {latesttag} by len(changes), not date (issue5659)

2017-08-19 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments.

INLINE COMMENTS

> yuja wrote in templatekw.py:222
> > I'm not changing latesttagdistance (AFAIK), only the definition of 
> > latesttag.
> 
> Try `ptags = reversed(...)` and run tests. The largest `pdist` should be 
> selected
> so that `latesttagdistance` returns the longest path.

>> I'm not changing latesttagdistance (AFAIK), only the definition of latesttag.
> 
> Try ptags = reversed(...) and run tests. The largest pdist should be selected
>  so that latesttagdistance returns the longest path.

Ah, right, when the tag is in the common ancestor, we should choose the longest 
branch. Good catch.  See how you like this change.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D447

To: martinvonz, #hg-reviewers, yuja
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D447: templatekw: choose {latesttag} by len(changes), not date (issue5659)

2017-08-19 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 1089.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D447?vs=1088=1089

REVISION DETAIL
  https://phab.mercurial-scm.org/D447

AFFECTED FILES
  mercurial/templatekw.py
  tests/test-command-template.t

CHANGE DETAILS

diff --git a/tests/test-command-template.t b/tests/test-command-template.t
--- a/tests/test-command-template.t
+++ b/tests/test-command-template.t
@@ -2885,7 +2885,7 @@
   o  0: null+1
   
 
-One common tag: longest path wins:
+One common tag: longest path wins for {latesttagdistance}:
 
   $ hg tag -r 1 -m t1 -d '6 0' t1
   $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n'
@@ -2904,7 +2904,7 @@
   o  0: null+1
   
 
-One ancestor tag: more recent wins:
+One ancestor tag: closest wins:
 
   $ hg tag -r 2 -m t2 -d '7 0' t2
   $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n'
@@ -2925,7 +2925,7 @@
   o  0: null+1
   
 
-Two branch tags: more recent wins:
+Two branch tags: more recent wins if same number of changes:
 
   $ hg tag -r 3 -m t3 -d '8 0' t3
   $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n'
@@ -2948,12 +2948,39 @@
   o  0: null+1
   
 
+Two branch tags: fewest changes wins:
+
+  $ hg tag -r 4 -m t4 -d '4 0' t4 # older than t2, but should not matter
+  $ hg log -G --template "{rev}: {latesttag % '{tag}+{distance},{changes} '}\n"
+  @  9: t4+5,6
+  |
+  o  8: t4+4,5
+  |
+  o  7: t4+3,4
+  |
+  o  6: t4+2,3
+  |
+  o5: t4+1,2
+  |\
+  | o  4: t4+0,0
+  | |
+  | o  3: t3+0,0
+  | |
+  o |  2: t2+0,0
+  |/
+  o  1: t1+0,0
+  |
+  o  0: null+1,1
+  
+
 Merged tag overrides:
 
   $ hg tag -r 5 -m t5 -d '9 0' t5
   $ hg tag -r 3 -m at3 -d '10 0' at3
   $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n'
-  @  10: t5+5
+  @  11: t5+6
+  |
+  o  10: t5+5
   |
   o  9: t5+4
   |
@@ -2965,7 +2992,7 @@
   |
   o5: t5+0
   |\
-  | o  4: at3:t3+1
+  | o  4: t4+0
   | |
   | o  3: at3:t3+0
   | |
@@ -2977,7 +3004,9 @@
   
 
   $ hg log -G --template "{rev}: {latesttag % '{tag}+{distance},{changes} '}\n"
-  @  10: t5+5,5
+  @  11: t5+6,6
+  |
+  o  10: t5+5,5
   |
   o  9: t5+4,4
   |
@@ -2989,7 +3018,7 @@
   |
   o5: t5+0,0
   |\
-  | o  4: at3+1,1 t3+1,1
+  | o  4: t4+0,0
   | |
   | o  3: at3+0,0 t3+0,0
   | |
@@ -3001,7 +3030,9 @@
   
 
   $ hg log -G --template "{rev}: {latesttag('re:^t[13]$') % '{tag}, C: 
{changes}, D: {distance}'}\n"
-  @  10: t3, C: 8, D: 7
+  @  11: t3, C: 9, D: 8
+  |
+  o  10: t3, C: 8, D: 7
   |
   o  9: t3, C: 7, D: 6
   |
@@ -3044,7 +3075,7 @@
   > EOF
 
   $ hg -R latesttag tip
-  test 10:9b4a630e5f5f
+  test 11:97e5943b523a
 
 Test recursive showlist template (issue1989):
 
@@ -3057,7 +3088,7 @@
 
   $ hg -R latesttag log -r tip --style=style1989
   M|test
-  10,test
+  11,test
   branch: test
 
 Test new-style inline templating:
@@ -3090,6 +3121,7 @@
   $ hg log -R latesttag --template '{desc}\n'
   at3
   t5
+  t4
   t3
   t2
   t1
@@ -3103,6 +3135,7 @@
   $ hg log -R latesttag --template '{strip(desc, "te")}\n'
   at3
   5
+  4
   3
   2
   1
@@ -3118,6 +3151,7 @@
   $ hg log -R latesttag --template 'date: {date(date, "%y %m %d %S %z")}\n'
   date: 70 01 01 10 +
   date: 70 01 01 09 +
+  date: 70 01 01 04 +
   date: 70 01 01 08 +
   date: 70 01 01 07 +
   date: 70 01 01 06 +
diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -208,10 +208,22 @@
 latesttags[rev] = ctx.date()[0], 0, [t for t in sorted(tags)]
 continue
 try:
-# The tuples are laid out so the right one can be found by
-# comparison.
-pdate, pdist, ptag = max(
-latesttags[p.rev()] for p in ctx.parents())
+ptags = [latesttags[p.rev()] for p in ctx.parents()]
+if len(ptags) > 1:
+if ptags[0][2] == ptags[1][2]:
+# The tuples are laid out so the right one can be found by
+# comparison in this case.
+pdate, pdist, ptag = max(ptags)
+else:
+def key(x):
+changessincetag = len(repo.revs('only(%d, %s)',
+ctx.rev(), x[2][0]))
+# Smallest number of changes since tag wins. Date is
+# used as tiebreaker.
+return [-changessincetag, x[0]]
+pdate, pdist, ptag = max(ptags, key=key)
+else:
+pdate, pdist, ptag = ptags[0]
 except KeyError:
 # Cache miss - recurse
 todo.append(rev)



To: martinvonz, #hg-reviewers, yuja
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


mercurial@33807: 5 new changesets

2017-08-19 Thread Mercurial Commits
5 new changesets in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/707750e5310b
changeset:   33803:707750e5310b
user:Gregory Szorc 
date:Wed Aug 09 23:52:25 2017 -0700
summary: localrepo: use peer interfaces

https://www.mercurial-scm.org/repo/hg/rev/1f8460b55986
changeset:   33804:1f8460b55986
user:Gregory Szorc 
date:Sun Aug 06 17:59:48 2017 -0700
summary: sshpeer: use peer interface

https://www.mercurial-scm.org/repo/hg/rev/f913e90f15a0
changeset:   33805:f913e90f15a0
user:Gregory Szorc 
date:Sun Aug 06 18:00:19 2017 -0700
summary: httppeer: use peer interface

https://www.mercurial-scm.org/repo/hg/rev/dedab036215d
changeset:   33806:dedab036215d
user:Gregory Szorc 
date:Thu Aug 10 20:58:28 2017 -0700
summary: wireproto: use new peer interface

https://www.mercurial-scm.org/repo/hg/rev/b70029f355a3
changeset:   33807:b70029f355a3
bookmark:@
tag: tip
user:Gregory Szorc 
date:Thu Aug 10 21:00:30 2017 -0700
summary: tests: verify that peer instances only expose interface members

-- 
Repository URL: https://www.mercurial-scm.org/repo/hg
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D447: templatekw: choose {latesttag} by len(changes), not date (issue5659)

2017-08-19 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments.

INLINE COMMENTS

> martinvonz wrote in templatekw.py:222
> > This should be enabled only if ptags[0][2] != ptags[1][2].
> 
> Good point. Done.
> 
> > The latesttagdistance is documented to return the longest path to the 
> > latest tag.
> 
> I'm not changing latesttagdistance (AFAIK), only the definition of latesttag.
> 
> > https://phab.mercurial-scm.org/rHGf04d179124410d491a8def230e408c3b6c98cbfc
> 
> Luckily, that's just the commit message and "hg help templates.latesttag" 
> just says "The global tags on the most recent globally tagged ancestor of 
> this changeset" and doesn't define what "most recent" is.

>> This should be enabled only if ptags[0][2] != ptags[1][2].
> 
> Good point. Done.

Great point, actually! See updated timings in commit message.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D447

To: martinvonz, #hg-reviewers, yuja
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D447: templatekw: choose {latesttag} by len(changes), not date (issue5659)

2017-08-19 Thread yuja (Yuya Nishihara)
yuja added inline comments.

INLINE COMMENTS

> martinvonz wrote in templatekw.py:222
> > This should be enabled only if ptags[0][2] != ptags[1][2].
> 
> Good point. Done.
> 
> > The latesttagdistance is documented to return the longest path to the 
> > latest tag.
> 
> I'm not changing latesttagdistance (AFAIK), only the definition of latesttag.
> 
> > https://phab.mercurial-scm.org/rHGf04d179124410d491a8def230e408c3b6c98cbfc
> 
> Luckily, that's just the commit message and "hg help templates.latesttag" 
> just says "The global tags on the most recent globally tagged ancestor of 
> this changeset" and doesn't define what "most recent" is.

> I'm not changing latesttagdistance (AFAIK), only the definition of latesttag.

Try `ptags = reversed(...)` and run tests. The largest `pdist` should be 
selected
so that `latesttagdistance` returns the longest path.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D447

To: martinvonz, #hg-reviewers, yuja
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D447: templatekw: choose {latesttag} by len(changes), not date (issue5659)

2017-08-19 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 1088.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D447?vs=1080=1088

REVISION DETAIL
  https://phab.mercurial-scm.org/D447

AFFECTED FILES
  mercurial/templatekw.py
  tests/test-command-template.t

CHANGE DETAILS

diff --git a/tests/test-command-template.t b/tests/test-command-template.t
--- a/tests/test-command-template.t
+++ b/tests/test-command-template.t
@@ -2885,7 +2885,7 @@
   o  0: null+1
   
 
-One common tag: longest path wins:
+One common tag: longest path wins for {latesttagdistance}:
 
   $ hg tag -r 1 -m t1 -d '6 0' t1
   $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n'
@@ -2904,7 +2904,7 @@
   o  0: null+1
   
 
-One ancestor tag: more recent wins:
+One ancestor tag: closest wins:
 
   $ hg tag -r 2 -m t2 -d '7 0' t2
   $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n'
@@ -2925,7 +2925,7 @@
   o  0: null+1
   
 
-Two branch tags: more recent wins:
+Two branch tags: more recent wins if same number of changes:
 
   $ hg tag -r 3 -m t3 -d '8 0' t3
   $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n'
@@ -2948,12 +2948,39 @@
   o  0: null+1
   
 
+Two branch tags: fewest changes wins:
+
+  $ hg tag -r 4 -m t4 -d '4 0' t4 # older than t2, but should not matter
+  $ hg log -G --template "{rev}: {latesttag % '{tag}+{distance},{changes} '}\n"
+  @  9: t4+5,6
+  |
+  o  8: t4+4,5
+  |
+  o  7: t4+3,4
+  |
+  o  6: t4+2,3
+  |
+  o5: t4+1,2
+  |\
+  | o  4: t4+0,0
+  | |
+  | o  3: t3+0,0
+  | |
+  o |  2: t2+0,0
+  |/
+  o  1: t1+0,0
+  |
+  o  0: null+1,1
+  
+
 Merged tag overrides:
 
   $ hg tag -r 5 -m t5 -d '9 0' t5
   $ hg tag -r 3 -m at3 -d '10 0' at3
   $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n'
-  @  10: t5+5
+  @  11: t5+6
+  |
+  o  10: t5+5
   |
   o  9: t5+4
   |
@@ -2965,7 +2992,7 @@
   |
   o5: t5+0
   |\
-  | o  4: at3:t3+1
+  | o  4: t4+0
   | |
   | o  3: at3:t3+0
   | |
@@ -2977,7 +3004,9 @@
   
 
   $ hg log -G --template "{rev}: {latesttag % '{tag}+{distance},{changes} '}\n"
-  @  10: t5+5,5
+  @  11: t5+6,6
+  |
+  o  10: t5+5,5
   |
   o  9: t5+4,4
   |
@@ -2989,7 +3018,7 @@
   |
   o5: t5+0,0
   |\
-  | o  4: at3+1,1 t3+1,1
+  | o  4: t4+0,0
   | |
   | o  3: at3+0,0 t3+0,0
   | |
@@ -3001,7 +3030,9 @@
   
 
   $ hg log -G --template "{rev}: {latesttag('re:^t[13]$') % '{tag}, C: 
{changes}, D: {distance}'}\n"
-  @  10: t3, C: 8, D: 7
+  @  11: t3, C: 9, D: 8
+  |
+  o  10: t3, C: 8, D: 7
   |
   o  9: t3, C: 7, D: 6
   |
@@ -3044,7 +3075,7 @@
   > EOF
 
   $ hg -R latesttag tip
-  test 10:9b4a630e5f5f
+  test 11:97e5943b523a
 
 Test recursive showlist template (issue1989):
 
@@ -3057,7 +3088,7 @@
 
   $ hg -R latesttag log -r tip --style=style1989
   M|test
-  10,test
+  11,test
   branch: test
 
 Test new-style inline templating:
@@ -3090,6 +3121,7 @@
   $ hg log -R latesttag --template '{desc}\n'
   at3
   t5
+  t4
   t3
   t2
   t1
@@ -3103,6 +3135,7 @@
   $ hg log -R latesttag --template '{strip(desc, "te")}\n'
   at3
   5
+  4
   3
   2
   1
@@ -3118,6 +3151,7 @@
   $ hg log -R latesttag --template 'date: {date(date, "%y %m %d %S %z")}\n'
   date: 70 01 01 10 +
   date: 70 01 01 09 +
+  date: 70 01 01 04 +
   date: 70 01 01 08 +
   date: 70 01 01 07 +
   date: 70 01 01 06 +
diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -208,10 +208,18 @@
 latesttags[rev] = ctx.date()[0], 0, [t for t in sorted(tags)]
 continue
 try:
-# The tuples are laid out so the right one can be found by
-# comparison.
-pdate, pdist, ptag = max(
-latesttags[p.rev()] for p in ctx.parents())
+def key(x):
+changessincetag = len(repo.revs('only(%d, %s)',
+ctx.rev(), x[2][0]))
+# Smallest number of changes since tag wins. Date is used
+# as tiebreaker.
+return [-changessincetag, x[0]]
+ptags = [latesttags[p.rev()] for p in ctx.parents()]
+if len(ptags) > 1 and ptags[0][2] != ptags[1][2]:
+pdate, pdist, ptag = max(ptags, key=key)
+else:
+# Don't call expensive key function if not necessary
+pdate, pdist, ptag = ptags[0]
 except KeyError:
 # Cache miss - recurse
 todo.append(rev)



To: martinvonz, #hg-reviewers, yuja
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D447: templatekw: choose {latesttag} by len(changes), not date (issue5659)

2017-08-19 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments.

INLINE COMMENTS

> yuja wrote in templatekw.py:222
> This should be enabled only if `ptags[0][2] != ptags[1][2]`.
> 
> The latesttagdistance is documented to return the longest path to the latest 
> tag.
> https://phab.mercurial-scm.org/rHGf04d179124410d491a8def230e408c3b6c98cbfc

> This should be enabled only if ptags[0][2] != ptags[1][2].

Good point. Done.

> The latesttagdistance is documented to return the longest path to the latest 
> tag.

I'm not changing latesttagdistance (AFAIK), only the definition of latesttag.

> https://phab.mercurial-scm.org/rHGf04d179124410d491a8def230e408c3b6c98cbfc

Luckily, that's just the commit message and "hg help templates.latesttag" just 
says "The global tags on the most recent globally tagged ancestor of this 
changeset" and doesn't define what "most recent" is.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D447

To: martinvonz, #hg-reviewers, yuja
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


mercurial@33802: 3 new changesets

2017-08-19 Thread Mercurial Commits
3 new changesets in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/f257943e47ab
changeset:   33800:f257943e47ab
user:Gregory Szorc 
date:Sun Aug 13 10:58:48 2017 -0700
summary: repository: formalize peer interface with abstract base class

https://www.mercurial-scm.org/repo/hg/rev/558f5b2ee10e
changeset:   33801:558f5b2ee10e
user:Gregory Szorc 
date:Sun Aug 13 11:04:42 2017 -0700
summary: repository: formalize wire protocol interface

https://www.mercurial-scm.org/repo/hg/rev/a0aad86b3b6a
changeset:   33802:a0aad86b3b6a
bookmark:@
tag: tip
user:Gregory Szorc 
date:Sun Aug 06 16:47:25 2017 -0700
summary: repository: implement generic capability methods on peer class

-- 
Repository URL: https://www.mercurial-scm.org/repo/hg
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D447: templatekw: choose {latesttag} by len(changes), not date (issue5659)

2017-08-19 Thread yuja (Yuya Nishihara)
yuja requested changes to this revision.
yuja added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> templatekw.py:222
> +# Don't call expensive key function if not necessary
> +pdate, pdist, ptag = ptags[0]
>  except KeyError:

This should be enabled only if `ptags[0][2] != ptags[1][2]`.

The latesttagdistance is documented to return the longest path to the latest 
tag.
https://phab.mercurial-scm.org/rHGf04d179124410d491a8def230e408c3b6c98cbfc

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D447

To: martinvonz, #hg-reviewers, yuja
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH] copies: use intersectmatchers() in non-merge p1 optimization

2017-08-19 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1503109413 -32400
#  Sat Aug 19 11:23:33 2017 +0900
# Node ID 57b175605401373c0c37bd9937a209676a734947
# Parent  6f6c87888b228948e202bd5967dc306bed56af7d
copies: use intersectmatchers() in non-merge p1 optimization

This enables the optimization introduced by d4247c306d82 for non-rebase cases.
Before, the match couldn't be narrowed if it was e.g. alwaysmatcher.

The logic is copied from bd56bea5ecf8.

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -10,6 +10,7 @@ from __future__ import absolute_import
 import heapq
 
 from . import (
+match as matchmod,
 node,
 pathutil,
 scmutil,
@@ -182,8 +183,9 @@ def _forwardcopies(a, b, match=None):
 # optimization, since the ctx.files() for a merge commit is not correct for
 # this comparison.
 forwardmissingmatch = match
-if not match and b.p1() == a and b.p2().node() == node.nullid:
-forwardmissingmatch = scmutil.matchfiles(a._repo, b.files())
+if b.p1() == a and b.p2().node() == node.nullid:
+filesmatcher = scmutil.matchfiles(a._repo, b.files())
+forwardmissingmatch = matchmod.intersectmatchers(match, filesmatcher)
 missing = _computeforwardmissing(a, b, match=forwardmissingmatch)
 
 ancestrycontext = a._repo.changelog.ancestors([b.rev()], inclusive=True)
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D445: demandimport: move HGDEMANDIMPORT test to __init__.py

2017-08-19 Thread quark (Jun Wu)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG8fb5212652ec: demandimport: move HGDEMANDIMPORT test to 
__init__.py (authored by quark).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D445?vs=1077=1086

REVISION DETAIL
  https://phab.mercurial-scm.org/D445

AFFECTED FILES
  hgdemandimport/__init__.py
  hgdemandimport/demandimportpy2.py
  hgdemandimport/demandimportpy3.py

CHANGE DETAILS

diff --git a/hgdemandimport/demandimportpy3.py 
b/hgdemandimport/demandimportpy3.py
--- a/hgdemandimport/demandimportpy3.py
+++ b/hgdemandimport/demandimportpy3.py
@@ -27,7 +27,6 @@
 from __future__ import absolute_import
 
 import contextlib
-import os
 import sys
 
 import importlib.abc
@@ -81,8 +80,7 @@
 pass
 
 def enable():
-if os.environ.get('HGDEMANDIMPORT') != 'disable':
-sys.path_hooks.insert(0, _makefinder)
+sys.path_hooks.insert(0, _makefinder)
 
 @contextlib.contextmanager
 def deactivated():
diff --git a/hgdemandimport/demandimportpy2.py 
b/hgdemandimport/demandimportpy2.py
--- a/hgdemandimport/demandimportpy2.py
+++ b/hgdemandimport/demandimportpy2.py
@@ -28,7 +28,6 @@
 
 import __builtin__ as builtins
 import contextlib
-import os
 import sys
 
 contextmanager = contextlib.contextmanager
@@ -285,8 +284,7 @@
 
 def enable():
 "enable global demand-loading of modules"
-if os.environ.get('HGDEMANDIMPORT') != 'disable':
-builtins.__import__ = _demandimport
+builtins.__import__ = _demandimport
 
 def disable():
 "disable global demand-loading of modules"
diff --git a/hgdemandimport/__init__.py b/hgdemandimport/__init__.py
--- a/hgdemandimport/__init__.py
+++ b/hgdemandimport/__init__.py
@@ -13,6 +13,7 @@
 
 from __future__ import absolute_import
 
+import os
 import sys
 
 if sys.version_info[0] >= 3:
@@ -68,6 +69,9 @@
 
 # Re-export.
 isenabled = demandimport.isenabled
-enable = demandimport.enable
 disable = demandimport.disable
 deactivated = demandimport.deactivated
+
+def enable():
+if os.environ.get('HGDEMANDIMPORT') != 'disable':
+demandimport.enable()



To: quark, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D351: demandimport: disable if chg is being used

2017-08-19 Thread quark (Jun Wu)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG3cfc9070245f: demandimport: disable if chg is being used 
(authored by quark).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D351?vs=1078=1087

REVISION DETAIL
  https://phab.mercurial-scm.org/D351

AFFECTED FILES
  hgdemandimport/__init__.py
  mercurial/chgserver.py

CHANGE DETAILS

diff --git a/mercurial/chgserver.py b/mercurial/chgserver.py
--- a/mercurial/chgserver.py
+++ b/mercurial/chgserver.py
@@ -565,8 +565,11 @@
 self._hashstate, self._baseaddress)
 
 def chgunixservice(ui, repo, opts):
-# CHGINTERNALMARK is temporarily set by chg client to detect if chg will
-# start another chg. drop it to avoid possible side effects.
+# CHGINTERNALMARK is set by chg client. It is an indication of things are
+# started by chg so other code can do things accordingly, like disabling
+# demandimport or detecting chg client started by chg client. When executed
+# here, CHGINTERNALMARK is no longer useful and hence dropped to make
+# environ cleaner.
 if 'CHGINTERNALMARK' in encoding.environ:
 del encoding.environ['CHGINTERNALMARK']
 
diff --git a/hgdemandimport/__init__.py b/hgdemandimport/__init__.py
--- a/hgdemandimport/__init__.py
+++ b/hgdemandimport/__init__.py
@@ -73,5 +73,7 @@
 deactivated = demandimport.deactivated
 
 def enable():
-if os.environ.get('HGDEMANDIMPORT') != 'disable':
+# chg pre-imports modules so do not enable demandimport for it
+if ('CHGINTERNALMARK' not in os.environ
+and os.environ.get('HGDEMANDIMPORT') != 'disable'):
 demandimport.enable()



To: quark, #hg-reviewers, phillco, yuja
Cc: phillco, sid0, yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D351: demandimport: disable if chg is being used

2017-08-19 Thread yuja (Yuya Nishihara)
yuja accepted this revision.
yuja added a comment.
This revision is now accepted and ready to land.


  Queued this, thanks.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D351

To: quark, #hg-reviewers, phillco, yuja
Cc: phillco, sid0, yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


mercurial@33799: 44 new changesets

2017-08-19 Thread Mercurial Commits
44 new changesets in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/5866ba5e9c48
changeset:   33756:5866ba5e9c48
parent:  33750:a0e28577f7d4
user:Yuya Nishihara 
date:Mon Jul 31 22:12:24 2017 +0900
summary: cext: move _dict_new_presized() to header

https://www.mercurial-scm.org/repo/hg/rev/e9996bd7203f
changeset:   33757:e9996bd7203f
user:Yuya Nishihara 
date:Mon Jul 31 22:28:27 2017 +0900
summary: cext: split character encoding functions to new compilation unit

https://www.mercurial-scm.org/repo/hg/rev/0f4ac3b6dee4
changeset:   33758:0f4ac3b6dee4
user:Yuya Nishihara 
date:Sun May 21 14:23:22 2017 +0900
summary: cext: factor out header for charencode.c

https://www.mercurial-scm.org/repo/hg/rev/a22339d389d4
changeset:   33759:a22339d389d4
user:Yuya Nishihara 
date:Mon Jul 31 22:58:06 2017 +0900
summary: cext: modernize charencode.c to use Py_ssize_t

https://www.mercurial-scm.org/repo/hg/rev/cd2aca0808f8
changeset:   33760:cd2aca0808f8
user:Yuya Nishihara 
date:Mon Jul 31 23:40:36 2017 +0900
summary: policy: reroute proxy modules internally

https://www.mercurial-scm.org/repo/hg/rev/f5fc54e7e467
changeset:   33761:f5fc54e7e467
user:Yuya Nishihara 
date:Mon Jul 31 23:13:47 2017 +0900
summary: encoding: drop circular import by proxying through 
'.charencode'

https://www.mercurial-scm.org/repo/hg/rev/c26a76e1af36
changeset:   33762:c26a76e1af36
user:André Klitzing 
date:Fri Aug 11 15:20:41 2017 +0200
summary: histedit: check first changeset for verb "roll" or "fold" 
(issue5498)

https://www.mercurial-scm.org/repo/hg/rev/dcdc17551653
changeset:   33763:dcdc17551653
user:Gregory Szorc 
date:Wed Aug 09 21:04:03 2017 -0700
summary: largefiles: remove remotestore.batch()

https://www.mercurial-scm.org/repo/hg/rev/297d1b70685c
changeset:   33764:297d1b70685c
user:Gregory Szorc 
date:Wed Aug 09 21:51:45 2017 -0700
summary: wireproto: properly implement batchable checking

https://www.mercurial-scm.org/repo/hg/rev/e2fc2122029c
changeset:   33765:e2fc2122029c
user:Gregory Szorc 
date:Wed Aug 09 22:52:05 2017 -0700
summary: wireproto: remove support for local results in @batchable (API)

https://www.mercurial-scm.org/repo/hg/rev/4c706037adef
changeset:   33766:4c706037adef
user:Gregory Szorc 
date:Wed Aug 09 23:29:30 2017 -0700
summary: wireproto: overhaul iterating batcher code (API)

https://www.mercurial-scm.org/repo/hg/rev/b47fe9733d76
changeset:   33767:b47fe9733d76
user:Gregory Szorc 
date:Wed Aug 09 23:35:20 2017 -0700
summary: peer: remove non iterating batcher (API)

https://www.mercurial-scm.org/repo/hg/rev/82d564d5ac4f
changeset:   33768:82d564d5ac4f
user:Gregory Szorc 
date:Thu Aug 10 20:55:28 2017 -0700
summary: sshpeer: make instance attributes and methods internal

https://www.mercurial-scm.org/repo/hg/rev/dd35abc409ee
changeset:   33769:dd35abc409ee
user:Jun Wu 
date:Thu Aug 10 09:37:50 2017 -0700
summary: fsmonitor: correct an error message

https://www.mercurial-scm.org/repo/hg/rev/119e1c6be1ce
changeset:   33770:119e1c6be1ce
user:Boris Feld 
date:Wed Aug 09 17:01:21 2017 +0200
summary: bundle2: fix transaction availability detection

https://www.mercurial-scm.org/repo/hg/rev/96f43981c1c4
changeset:   33771:96f43981c1c4
user:Pulkit Goyal <7895pul...@gmail.com>
date:Thu Aug 03 05:12:35 2017 +0530
summary: morestatus: move fb extension to core by plugging to `hg status 
--verbose`

https://www.mercurial-scm.org/repo/hg/rev/d434a7f0685c
changeset:   33772:d434a7f0685c
user:Boris Feld 
date:Thu Aug 03 11:38:22 2017 +0200
summary: config: rename evolution config into stabilization

https://www.mercurial-scm.org/repo/hg/rev/6c1a9fd8361b
changeset:   33773:6c1a9fd8361b
user:Boris Feld 
date:Fri Aug 04 18:41:16 2017 +0200
summary: test: update evolution config

https://www.mercurial-scm.org/repo/hg/rev/9dcc3529e002
changeset:   33774:9dcc3529e002
user:Boris Feld 
date:Thu Aug 03 13:48:39 2017 +0200
summary: revset: rename unstable into orphan

https://www.mercurial-scm.org/repo/hg/rev/f078d7358e90
changeset:   33775:f078d7358e90
user:Boris Feld 
date:Thu Aug 03 14:01:51 2017 +0200
summary: revset: remane divergent into contentdivergent

https://www.mercurial-scm.org/repo/hg/rev/ed99d3afef88
changeset: