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

login
register
mail settings
Submitter Simon Heimberg
Date Feb. 12, 2013, 11:05 p.m.
Message ID <87f4812f32220895202a.1360710330@lapsi.heimberg.home>
Download mbox | patch
Permalink /patch/967/
State Accepted
Commit 15711d9d8b2caebf97d36f54417cd237f1154d93
Headers show

Comments

Simon Heimberg - Feb. 12, 2013, 11:05 p.m.
# HG changeset patch
# User Simon Heimberg <simohe@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.

Patch

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: