# HG changeset patch # User Brodie Rao # Date 1285189560 18000 # Node ID c4211177a2fc74dc15e83cc203c2ba4921d43244 # Parent c20c12c560dd3e6f0aa298ebba548d4d44ee3cd9 tests: require regexes in unified tests to be marked with " (re)" Consider this test: $ hg glog --template '{rev}:{node|short} "{desc}"\n' @ 2:20c4f79fd7ac "3" | | o 1:38f24201dcab "2" |/ o 0:2a18120dc1c9 "1" Because each line beginning with "|" can be compiled as a regular expression (equivalent to ".*|"), they will match any output. Similarly: $ echo foo The blank output line can be compiled as a regular expression and will also match any output. With this patch, none of the above output lines will be matched as regular expressions. A line must end in " (re)" in order to be matched as one. Lines are still matched literally first, so the following will pass: $ echo 'foo (re)' foo (re) [ original upstream message ] diff -r c20c12c560dd -r c4211177a2fc tests/run-tests.py --- a/tests/run-tests.py Wed Sep 22 16:05:59 2010 -0500 +++ b/tests/run-tests.py Wed Sep 22 16:06:00 2010 -0500 @@ -503,9 +503,6 @@ def rematch(el, l): try: - # hack to deal with graphlog, which looks like bogus regexes - if el.startswith('|'): - el = '\\' + el # ensure that the regex matches to the end of the string return re.match(el + r'\Z', l) except re.error: @@ -531,10 +528,10 @@ if el == l: # perfect match (fast) postout.append(" " + l) - elif el and el[2:] and rematch(el, l): # fallback regex match - postout.append(" " + el) - else: # mismatch - let diff deal with it - postout.append(" " + l) + elif el and el.endswith(" (re)\n") and rematch(el[:-6] + '\n', l): + postout.append(" " + el) # fallback regex match + else: + postout.append(" " + l) # let diff deal with it if pos in after: postout += after.pop(pos) diff -r c20c12c560dd -r c4211177a2fc tests/test-keyword.t --- a/tests/test-keyword.t Wed Sep 22 16:05:59 2010 -0500 +++ b/tests/test-keyword.t Wed Sep 22 16:06:00 2010 -0500 @@ -27,13 +27,13 @@ Revision = {node|short} Source = {root}/{file},v $Author: test $ - \$Date: ..../../.. ..:..:.. \$ - \$Header: .*/demo\.txt,v ............ ..../../.. ..:..:.. test \$ - \$Id: demo\.txt,v ............ ..../../.. ..:..:.. test \$ + \$Date: ..../../.. ..:..:.. \$ (re) + \$Header: .*/demo\.txt,v ............ ..../../.. ..:..:.. test \$ (re) + \$Id: demo\.txt,v ............ ..../../.. ..:..:.. test \$ (re) $RCSFile: demo.txt,v $ $RCSfile: demo.txt,v $ - \$Revision: ............ \$ - \$Source: .*/demo\.txt,v \$ + \$Revision: ............ \$ (re) + \$Source: .*/demo.txt,v \$ (re) $ hg --quiet kwdemo "Branch = {branches}" [extensions] @@ -71,7 +71,7 @@ hg bundle --base null ../test-keyword.hg $ hg pull -u "$TESTDIR"/test-keyword.hg - pulling from .*test-keyword\.hg + pulling from .*test-keyword\.hg (re) requesting all changes adding changesets adding manifests @@ -150,7 +150,7 @@ do not process $Id: xxx $ ignore $Id$ - a.* + a.* (re) Test hook execution @@ -195,15 +195,15 @@ Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit - Date: .* - Subject: changeset in .* + Date: .* (re) + Subject: changeset in .* (re) From: mercurial X-Hg-Notification: changeset a2392c293916 - Message-Id: + Message-Id: (re) To: Test - changeset a2392c293916 in .* - details: .*\?cmd=changeset;node=a2392c293916 + changeset a2392c293916 in .* (re) + details: .*\?cmd=changeset;node=a2392c293916 (re) description: addsym @@ -218,15 +218,15 @@ Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit - Date:.* - Subject: changeset in.* + Date:.* (re) + Subject: changeset in.* (re) From: User Name X-Hg-Notification: changeset ef63ca68695b - Message-Id: + Message-Id: (re) To: Test - changeset ef63ca68695b in .* - details: .*\?cmd=changeset;node=ef63ca68695b + changeset ef63ca68695b in .* (re) + details: .*\?cmd=changeset;node=ef63ca68695b (re) description: absym @@ -335,7 +335,7 @@ $ hg diff diff -r d17e03c92c97 a --- a/a Wed Dec 31 23:59:51 1969 -0000 - \+\+\+ b/a .* + \+\+\+ b/a .* (re) @@ -2,3 +2,4 @@ foo do not process $Id: @@ -479,7 +479,7 @@ $ hg diff --rev 1 diff -r ef63ca68695b c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 - \+\+\+ b/c .* + \+\+\+ b/c .* (re) @@ -0,0 +1,3 @@ +expand $Id$ +do not process $Id: @@ -527,7 +527,7 @@ do not process $Id: xxx $ ignore $Id$ - a.* + a.* (re) Write custom keyword and prepare multiline commit message @@ -577,7 +577,7 @@ xxx $ $Xinfo: User Name : firstline $ ignore $Id$ - a.* + a.* (re) annotate @@ -648,7 +648,7 @@ > default = ../Test > EOF $ hg incoming - comparing with .*test-keyword\.t/Test + comparing with .*test-keyword\.t/Test (re) searching for changes changeset: 2:bb948857c743 tag: tip @@ -718,7 +718,7 @@ kwexpand nonexistent $ hg kwexpand nonexistent - nonexistent:.* + nonexistent:.* (re) hg serve @@ -907,7 +907,7 @@ xxx $ $Xinfo: User Name : firstline $ ignore $Id$ - a.* + a.* (re) Now disable keyword expansion @@ -924,4 +924,4 @@ xxx $ $Xinfo$ ignore $Id$ - a.* + a.* (re)