diff tests/test-revset.t @ 23765:537a2669a113

revset: use '%' as an operator for 'only' With this patch, we can make it much easier to specify 'only(A,B)' -> A%B. Similarly, 'only(A)' -> A%. On Windows, '%' is a semi-reserved symbol in the following way: using non-bash shells (e.g. cmd.exe but NOT PowerShell, ConEmu, and cmder), %var% is only expanded when 'var' exists and is surrounded by '%'. That only leaves batch scripts which could prove to be problematic. I posit that this isn't a big issue because any developer of batch scripts already knows that to use '%' one needs to escape it by using a double '%%'. Alternatives to '%' could be '=' but that might be limiting our future if we ever decide to use temporary assignments in a revset.
author Sean Farley <sean.michael.farley@gmail.com>
date Thu, 06 Nov 2014 14:55:18 -0800
parents 3a4d8a6ce432
children 9b1d3bac61a7
line wrap: on
line diff
--- a/tests/test-revset.t	Tue Jan 06 21:56:33 2015 -0800
+++ b/tests/test-revset.t	Thu Nov 06 14:55:18 2014 -0800
@@ -438,6 +438,32 @@
   8
   9
 
+Test '%' operator
+
+  $ log '9%'
+  8
+  9
+  $ log '9%5'
+  2
+  4
+  8
+  9
+  $ log '(7 + 9)%(5 + 2)'
+  4
+  6
+  7
+  8
+  9
+
+Test the order of operations
+
+  $ log '7 + 9%5 + 2'
+  7
+  2
+  4
+  8
+  9
+
 Test explicit numeric revision
   $ log 'rev(-1)'
   $ log 'rev(0)'