[PATCH 1 of 4] tests: quickly check if the glob line already matches the output

Simon Heimberg simohe at besonet.ch
Tue Feb 12 17:05:30 CST 2013


# HG changeset patch
# User Simon Heimberg <simohe at besonet.ch>
# Date 1350334939 -7200
# Node ID 87f4812f32220895202a185a92a7977bdee5f0a0
# Parent  6204e4d4dd6d10834540357dbf1deac6636077c8
tests: quickly check if the glob line already matches the output

This happens when a path with "/" as only glob char is matched on a non windows
platform. (Currently one third of all glob matches.)
The the slowdown on windows and the speedup on other os and are neglectable.

diff -r 6204e4d4dd6d -r 87f4812f3222 tests/run-tests.py
--- a/tests/run-tests.py	Son Feb 10 04:04:22 2013 -0600
+++ b/tests/run-tests.py	Mon Okt 15 23:02:19 2012 +0200
@@ -541,6 +541,8 @@
 def globmatch(el, l):
     # The only supported special characters are * and ? plus / which also
     # matches \ on windows. Escaping of these caracters is supported.
+    if el + '\n' == l:
+        return True
     i, n = 0, len(el)
     res = ''
     while i < n:


More information about the Mercurial-devel mailing list