log: simplify 'x or ancestors(x)' expression
authorYuya Nishihara <yuya@tcha.org>
Tue, 02 Jan 2018 17:00:48 +0900
changeset 35643 668c5a527eff
parent 35642 e64baf32782a
child 35644 7a0a90d63a8c
log: simplify 'x or ancestors(x)' expression 'ancestors(x)' includes 'x'.
mercurial/cmdutil.py
tests/test-glog.t
--- a/mercurial/cmdutil.py	Tue Jan 02 16:58:37 2018 +0900
+++ b/mercurial/cmdutil.py	Tue Jan 02 17:00:48 2018 +0900
@@ -2352,7 +2352,7 @@
     '_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 '),
 }
 
--- a/tests/test-glog.t	Tue Jan 02 16:58:37 2018 +0900
+++ b/tests/test-glog.t	Tue Jan 02 17:00:48 2018 +0900
@@ -1573,34 +1573,24 @@
   []
   (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.