Patchwork [2,of,5] log: simplify 'x or ancestors(x)' expression

login
register
mail settings
Submitter Yuya Nishihara
Date Jan. 11, 2018, 1:58 p.m.
Message ID <c0c7ecef4093eae82fcf.1515679121@mimosa>
Download mbox | patch
Permalink /patch/26687/
State Accepted
Headers show

Comments

Yuya Nishihara - Jan. 11, 2018, 1:58 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1514880048 -32400
#      Tue Jan 02 17:00:48 2018 +0900
# Node ID c0c7ecef4093eae82fcff7589e534f96c9e8e8c5
# Parent  da12c978eafe1b414122213c75ce149a5e8d8b5b
log: simplify 'x or ancestors(x)' expression

'ancestors(x)' includes 'x'.

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2352,7 +2352,7 @@  def _makenofollowlogfilematcher(repo, pa
     '_patsfollow':      ('follow(%(val)r)', ' or '),
     '_patsfollowfirst': ('_followfirst(%(val)r)', ' or '),
     'keyword':          ('keyword(%(val)r)', ' or '),
-    'prune':            ('not (%(val)r or ancestors(%(val)r))', ' and '),
+    'prune':            ('not ancestors(%(val)r)', ' and '),
     'user':             ('user(%(val)r)', ' or '),
 }
 
diff --git a/tests/test-glog.t b/tests/test-glog.t
--- a/tests/test-glog.t
+++ b/tests/test-glog.t
@@ -1573,34 +1573,24 @@  glog always reorders nodes which explain
   []
   (and
     (not
-      (or
-        (list
-          (string '31')
-          (func
-            (symbol 'ancestors')
-            (string '31')))))
+      (func
+        (symbol 'ancestors')
+        (string '31')))
     (not
-      (or
-        (list
-          (string '32')
-          (func
-            (symbol 'ancestors')
-            (string '32'))))))
+      (func
+        (symbol 'ancestors')
+        (string '32'))))
   <filteredset
     <filteredset
       <spanset- 0:37>,
       <not
-        <addset
-          <baseset [31]>,
-          <filteredset
-            <spanset- 0:37>,
-            <generatorsetdesc+>>>>>,
-    <not
-      <addset
-        <baseset [32]>,
         <filteredset
           <spanset- 0:37>,
-          <generatorsetdesc+>>>>>
+          <generatorsetdesc+>>>>,
+    <not
+      <filteredset
+        <spanset- 0:37>,
+        <generatorsetdesc+>>>>
 
 Dedicated repo for --follow and paths filtering. The g is crafted to
 have 2 filelog topological heads in a linear changeset graph.